-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Samagra-Development/gitpod
Fixes related to Gitpod
- Loading branch information
Showing
8 changed files
with
117 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,7 @@ redis-data | |
redis.conf | ||
.DS_Store | ||
node_modules/ | ||
pgdata | ||
redisinsight | ||
broker | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,38 @@ | ||
#!/bin/sh | ||
|
||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||
|
||
# Load NVM | ||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||
nvm install 16 | ||
nvm use 16 | ||
|
||
cp sample.env .env | ||
cd apps/api | ||
sudo apt-get install unzip | ||
unzip pgdata.zip | ||
docker-compose up -d shortdb gql yaus-broker shortnr-cache | ||
npx nx serve api | ||
rm -rf pgdata.zip | ||
rm -rf __MACOSX | ||
|
||
# Resolving permission errors | ||
mkdir -p broker | ||
mkdir -p redisinsight | ||
sudo chown -R 1001:1001 broker | ||
sudo chown -R 1001:1001 redisinsight | ||
|
||
docker-compose -f docker-compose.gitpod.yml up -d | ||
|
||
yarn install | ||
npx prisma generate --schema=/workspace/yaus/apps/api/src/app/prisma/schema.prisma | ||
|
||
# sleep for 15 seconds | ||
sleep 30 | ||
|
||
# Starting Server - https://8888- | ||
serverBaseURL=${GITPOD_WORKSPACE_URL:-default_value} | ||
serverBaseURL="https://8088-${serverBaseURL:8}/add/?name=shortnr&host=shortnr-cache&port=6379" | ||
curl "${serverBaseURL}" | ||
echo "Open this URL in a the browser to add redis to redisInsight ${serverBaseURL}" | ||
|
||
# start api server | ||
npx nx serve api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
version: '3' | ||
|
||
services: | ||
shortdb: | ||
container_name: shortdb | ||
image: postgres:12 | ||
env_file: | ||
- .env | ||
environment: | ||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD} | ||
- POSTGRES_DB=${POSTGRES_DB} | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- ./pgdata:/var/lib/postgresql/data | ||
|
||
gql: | ||
image: hasura/graphql-engine:v2.7.0 | ||
ports: | ||
- 15003:8080 | ||
env_file: | ||
- .env | ||
environment: | ||
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgresql:${POSTGRES_PASSWORD}@shortdb:5432/${POSTGRES_DB} | ||
PG_DATABASE_URL: postgres://postgresql:${POSTGRES_PASSWORD}@shortdb:5432/${POSTGRES_DB} | ||
HASURA_GRAPHQL_ENABLE_CONSOLE: "true" # set to "false" to disable console | ||
HASURA_GRAPHQL_DEV_MODE: "true" | ||
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log | ||
HASURA_GRAPHQL_ADMIN_SECRET: ${HASURA_ADMIN_SECRET} | ||
depends_on: | ||
- shortdb | ||
restart: always | ||
|
||
yaus-broker: | ||
container_name: yaus-broker | ||
image: "docker.io/bitnami/rabbitmq:latest" | ||
environment: | ||
- RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD} | ||
- RABBITMQ_USERNAME=${RABBITMQ_USERNAME} | ||
ports: | ||
- 4369:4369 | ||
- 5672:5672 | ||
- 25672:25672 | ||
- 15672:15672 | ||
volumes: | ||
- ./broker:/bitnami | ||
|
||
shortnr-cache: | ||
container_name: shortnr-cache | ||
restart: always | ||
image: redis:latest | ||
ports: | ||
- "6381:6379" | ||
command: ["redis-server", "--appendonly", "yes"] | ||
hostname: redis | ||
volumes: | ||
- ./redis-data:/data | ||
- ./redis.conf:/usr/local/etc/redis/redis.conf | ||
|
||
redis-ui: | ||
container_name: redis-ui | ||
image: redislabs/redisinsight:latest | ||
restart: always | ||
volumes: | ||
- ./redisinsight:/db | ||
ports: | ||
- 8088:8001 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,6 @@ | ||
### Setting Up Backend | ||
## YAUS | ||
|
||
```shell | ||
cd apps/api | ||
unzip pgdata.zip | ||
docker-compose up -d shortdb gql yaus-broker shortnr-cache | ||
npx nx serve api | ||
``` | ||
### Contributing | ||
It is recommended to develop on Gitpod since everything is coupled with a bunch of dependencies. To start your Gitpod session click on the button below. | ||
|
||
### Setting up Frontend | ||
|
||
```shell | ||
npx nx server admin | ||
``` | ||
|
||
### Try It | ||
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Samagra-Development/yaus) | ||
|
||
### TODO | ||
- [x] Migrate to Fastify | ||
- [x] Add all the routes that are not yet implemented | ||
- [x] Prisma Schema Setup | ||
- [x] Posthog integration -- (Discuss and add events) | ||
- [x] Health Check APIs (https://docs.nestjs.com/recipes/terminus) -- (Add for Db, Hasura, Redis, RabbitMq) | ||
- [] Admin APIs | ||
- [x] Integrate Swagger --- (Pending: Add detailed descriptions for APIs) | ||
- [x] Added interceptor for API execution time tracking | ||
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Samagra-Development/yaus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters