diff --git a/docs/Vachan-deployment-steps.md b/docs/Vachan-deployment-steps.md index 1de7748f..051141cf 100644 --- a/docs/Vachan-deployment-steps.md +++ b/docs/Vachan-deployment-steps.md @@ -11,53 +11,39 @@ server: api.vachanengine.org(206.189.131.230) systemctl disable --now SERVICE-NAME ``` -## Setup repo +## For settingup Vachan-API repo -Decide a location and clone version-2 code(we have used /home/gitautodeploy) +Decide a location and clone version-2 code(we have used /home/vachanproduction) ``` git clone --branch git clone --branch version-2 https://github.com/Bridgeconn/vachan-api.git ``` -Copy prod.env file to vachan-api/docker -Change the workflow file as per the decided location - - - -## Docker and docker-compose - -prefered versions -docker: 24.0.1 - -for docker installation, if required -https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository - -to remove sudo need +After cloning, enter the following command to see the repo: ``` -> sudo groupadd docker -> sudo usermod -aG docker $USER -> newgrp docker -> docker run hello-world #(to test) +ls ``` -## Start App - -``` -cd vachan-api/docker +If we need to remove the repo from the server using the following command: ``` +rm -rf vachan-api -For Staging: ``` -docker compose -f docker-compose-staging.yml --env-file prod.env --profile deployment up --build --force-recreate -d + +Next step is to include the `prod.env` file. First, navigate to the docker directory: ``` +cd vachan-api +cd docker +touch prod.env -For Production: ``` -docker compose -f docker-compose-production.yml --env-file prod.env --profile deployment up --build --force-recreate -d +To dd the required environmental variables in the `prod.env` or `.env` file. ``` +nano prod.env +``` -The environment values to be set in `prod.env` or `.env` file and their expected format are: +The environment values to be set in `prod.env` file and their expected format are: ``` VACHAN_SUPER_USERNAME="" VACHAN_SUPER_PASSWORD="" @@ -79,6 +65,55 @@ VACHAN_AI_CRON_HOUR= VACHAN_AI_CRON_MINUTE= VACHAN_AI_DATA_PATH= ``` + +To see the contents of the `prod.env` file after editing, use the following command: +``` +cat prod.env + +``` + + + + + +## To install Docker and docker-compose + +Prefered versions +docker: 24.0.1 + +For docker installation, if required +https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository + +To avoid using `sudo` with Docker, follow these steps: +``` +> sudo groupadd docker +> sudo usermod -aG docker $USER +> newgrp docker +> docker run hello-world #(to test) +``` + +If you encounter a `sudo permission denied` error, contact the server team for assistance. + + +## To start App + +``` +cd vachan-api/docker +``` + +For Staging: +``` +docker compose -f docker-compose-staging.yml --profile deployment --env-file prod.env up --force-recreate --build -d +``` + +For Production: +``` +docker compose -f docker-compose-production.yml --profile deployment --env-file prod.env up --force-recreate --build -d +``` + +Give correct path inside `web-server-with-cert` container inorder to avoid the errors related to the ssl path . +If you encounter ssl related errors, contact the server team for assistance. + ## To Down the App For Staging: @@ -94,10 +129,6 @@ docker compose -f docker-compose-production.yml --profile deployment --env-file ``` -` - -``` - ## Enable Auto deployment via github actions ### RSA Keys @@ -108,9 +139,11 @@ docker compose -f docker-compose-production.yml --profile deployment --env-file # (name the file github-actions # dont give passphrase) > cat github-actions.pub >> authorized_keys + ``` refernce: https://zellwk.com/blog/github-actions-deploy/ + ### Add secrets in github * VACHAN_DO_HOST = 206.189.131.230 @@ -118,9 +151,20 @@ refernce: https://zellwk.com/blog/github-actions-deploy/ * SSH_KEY -## Add SSL -Referenced article: https://mindsers.blog/post/https-using-nginx-certbot-docker/ + +## To Add SSL + +Referenced article: +https://mindsers.blog/post/https-using-nginx-certbot-docker/ + +Create an `ssl` folder in the home directory: + +``` +mkdir ssl +``` + +Copy the required files from your local machine to the RDS, then move them to the production server. You can use the `scp` or `mv` commands for this.