From f09b24fa3e72807eec265b54529160c26358adfb Mon Sep 17 00:00:00 2001 From: yuvraj Date: Fri, 26 May 2023 18:22:00 +0530 Subject: [PATCH 1/5] fix gitpod setup --- deploy.sh | 10 +++++----- docker-compose.gitpod.yml | 4 ++-- sample.gitpod.env | 28 ++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 sample.gitpod.env diff --git a/deploy.sh b/deploy.sh index c6e67920..d79daee3 100644 --- a/deploy.sh +++ b/deploy.sh @@ -8,7 +8,7 @@ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || pr nvm install 16 nvm use 16 -cp sample.env .env +cp sample.gitpod.env .env # sudo apt-get install unzip # unzip pgdata.zip # rm -rf pgdata.zip @@ -31,10 +31,10 @@ npx prisma db seed 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}" +# 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 diff --git a/docker-compose.gitpod.yml b/docker-compose.gitpod.yml index 987409b8..17aea850 100644 --- a/docker-compose.gitpod.yml +++ b/docker-compose.gitpod.yml @@ -3,7 +3,7 @@ version: '3' services: shortdb: container_name: shortdb - image: postgres:12 + image: postgres:14 env_file: - .env environment: @@ -72,4 +72,4 @@ volumes: pgdata: broker: redisinsight: - driver: local \ No newline at end of file + driver: local diff --git a/sample.gitpod.env b/sample.gitpod.env new file mode 100644 index 00000000..dc5d68ae --- /dev/null +++ b/sample.gitpod.env @@ -0,0 +1,28 @@ +POSTGRES_DB=shortdb +POSTGRES_USER=postgres +POSTGRES_PASSWORD=yoursupersecret +REDIS_URI=redis://localhost:6381 +REDIS_NAME=db +GRAPHQL_URI=http://localhost:8080/v1/graphql +HASURA_ADMIN_SECRET=4GeEB2JCU5rBdLvQ4AbeqqrPGu7kk9SZDhJUZm7A +BASE_URL=https://www.yaus.xyz/ +RABBITMQ_PASSWORD=password +RABBITMQ_USERNAME=username +RMQ_URL=amqp://username:password@localhost:5672 +RMQ_QUEUE=clicks +RMQ_QUEUE_DURABLE=false +POSTHOG_API_KEY=test +POSTHOG_API_HOST=https://app.posthog.com/ +POSTHOG_DISTINCT_KEY=YAUS Events +POSTHOG_BATCH_SIZE=20 +POSTHOG_FLUSH_INTERVAL=10000 +CLICK_BACKUP_CRON=* * 1 * * * + +# This was inserted by `prisma init`: +# Environment variables declared in this file are automatically made available to Prisma. +# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema + +# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB (Preview). +# See the documentation for all the connection string options: https://pris.ly/d/connection-strings + +DATABASE_URL="postgresql://postgres:yoursupersecret@localhost:5432/shortdb?schema=public" From 46ea95f159980ed44eb341f3e5be168cc2c93a5b Mon Sep 17 00:00:00 2001 From: yuvraj Date: Fri, 26 May 2023 18:36:01 +0530 Subject: [PATCH 2/5] ignore gitpod ports and add sample env for gitpod --- .gitpod.yml | 10 +++++++--- sample.gitpod.env => gitpod.env | 0 2 files changed, 7 insertions(+), 3 deletions(-) rename sample.gitpod.env => gitpod.env (100%) diff --git a/.gitpod.yml b/.gitpod.yml index 775991bd..9c53c03a 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,8 +1,6 @@ tasks: - name: YAUS Server init: bash ./deploy.sh - env: - DATABASE_URL: "postgresql://postgres:yoursupersecret@localhost:5432/shortdb?schema=public" ports: - port: 5432 @@ -27,5 +25,11 @@ ports: onOpen: ignore visibility: public - port: 3333 + onOpen: open-browser + visibility: public + - port: 9229 + onOpen: ignore + visibility: public + - port: 6381 onOpen: ignore - visibility: public \ No newline at end of file + visibility: public diff --git a/sample.gitpod.env b/gitpod.env similarity index 100% rename from sample.gitpod.env rename to gitpod.env From d5119ce3855a251fb919de4bc08534420afb1270 Mon Sep 17 00:00:00 2001 From: yuvraj Date: Fri, 26 May 2023 18:40:15 +0530 Subject: [PATCH 3/5] use gitpod.env in deploy.sh --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index d79daee3..94f41b69 100644 --- a/deploy.sh +++ b/deploy.sh @@ -8,7 +8,7 @@ export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || pr nvm install 16 nvm use 16 -cp sample.gitpod.env .env +cp gitpod.env .env # sudo apt-get install unzip # unzip pgdata.zip # rm -rf pgdata.zip From cf98201882de18d47425b3073b72225fd422bb75 Mon Sep 17 00:00:00 2001 From: yuvraj Date: Sat, 27 May 2023 17:04:08 +0530 Subject: [PATCH 4/5] add gitpod instructions in readme --- readme.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/readme.md b/readme.md index 9ac369cb..d5b64b25 100644 --- a/readme.md +++ b/readme.md @@ -6,6 +6,18 @@ Batteries included URL Shortener that is designed for speed and scalability. [Docs here](https://github.com/Samagra-Development/yaus/tree/master/docs) +## Setup + +There are two ways in which you can get up and running with this project. + +If you are just looking around and want to see quickly how this project works we recommend you start with [Gitpod](https://www.gitpod.io/) it is a service that runs your code in the cloud. + +All you have to do is click the button below. This will open this project in Gitpod and launch a new tab with the `https://3333-XXXXX.gitpod.io` type of link. (In case your browser doesn't launch this in a new tab then please check the browser's popup setting). + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Samagra-Development/yaus) + +The other usual way is to set up everything locally on your system, for that, you can follow the instructions given below. + ## Installation ### Prerequisites From 700b889483af9016fd336bb960b74b88c1b43f73 Mon Sep 17 00:00:00 2001 From: yuvraj Date: Sat, 27 May 2023 17:34:50 +0530 Subject: [PATCH 5/5] add frontend to gitpod --- .gitpod.yml | 3 +++ deploy.sh | 2 +- readme.md | 7 +++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 9c53c03a..9ca720a3 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -33,3 +33,6 @@ ports: - port: 6381 onOpen: ignore visibility: public + - port: 4200 + onOpen: open-browser + visibility: public diff --git a/deploy.sh b/deploy.sh index 94f41b69..578150c2 100644 --- a/deploy.sh +++ b/deploy.sh @@ -37,4 +37,4 @@ sleep 30 # echo "Open this URL in a the browser to add redis to redisInsight ${serverBaseURL}" # start api server -npx nx serve api +npx nx run-many --target=serve --all diff --git a/readme.md b/readme.md index d5b64b25..7777babc 100644 --- a/readme.md +++ b/readme.md @@ -12,10 +12,13 @@ There are two ways in which you can get up and running with this project. If you are just looking around and want to see quickly how this project works we recommend you start with [Gitpod](https://www.gitpod.io/) it is a service that runs your code in the cloud. -All you have to do is click the button below. This will open this project in Gitpod and launch a new tab with the `https://3333-XXXXX.gitpod.io` type of link. (In case your browser doesn't launch this in a new tab then please check the browser's popup setting). - +All you have to do is click the button below. [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/Samagra-Development/yaus) +This will open this project in Gitpod and launch two new tabs. The one with the `https://3333-XXXXX.gitpod.io` type of link is for the backend and the other with the `https://4200-XXXXX.gitpod.io` type of link is for frontend. + +(In case your browser doesn't launch these tabs then please check the browser's popup setting). + The other usual way is to set up everything locally on your system, for that, you can follow the instructions given below. ## Installation