diff --git a/.gitpod.yml b/.gitpod.yml index 775991bd..9ca720a3 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,14 @@ 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 + - port: 4200 + onOpen: open-browser + visibility: public diff --git a/deploy.sh b/deploy.sh index c6e67920..578150c2 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 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 +npx nx run-many --target=serve --all 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/gitpod.env b/gitpod.env new file mode 100644 index 00000000..dc5d68ae --- /dev/null +++ b/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" diff --git a/readme.md b/readme.md index 9ac369cb..7777babc 100644 --- a/readme.md +++ b/readme.md @@ -6,6 +6,21 @@ 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. +[![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 ### Prerequisites