From 45c2a8f1ed32542de62e9477e9e950cfb662aace Mon Sep 17 00:00:00 2001 From: "Noel.Sudhish" Date: Fri, 19 Jul 2024 11:24:48 +0530 Subject: [PATCH 01/11] vachan-ai auth token url change --- docker/docker-compose-production.yml | 4 ++-- docker/docker-compose-staging.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose-production.yml b/docker/docker-compose-production.yml index 098b61c0..552ebc1b 100644 --- a/docker/docker-compose-production.yml +++ b/docker/docker-compose-production.yml @@ -346,7 +346,7 @@ services: vachan-ai: - image: vachanengine/vachan-ai:0.0.0-alpha.11 + image: vachanengine/vachan-ai:0.0.0-alpha.12 healthcheck: timeout: 45s interval: 10s @@ -418,7 +418,7 @@ services: worker: - image: vachanengine/vachan-ai:0.0.0-alpha.11 + image: vachanengine/vachan-ai:0.0.0-alpha.12 healthcheck: timeout: 45s interval: 10s diff --git a/docker/docker-compose-staging.yml b/docker/docker-compose-staging.yml index 4d84f92e..13a1bc68 100644 --- a/docker/docker-compose-staging.yml +++ b/docker/docker-compose-staging.yml @@ -346,7 +346,7 @@ services: vachan-ai: - image: vachanengine/vachan-ai:0.0.0-alpha.11 + image: vachanengine/vachan-ai:0.0.0-alpha.12 healthcheck: timeout: 45s interval: 10s @@ -418,7 +418,7 @@ services: worker: - image: vachanengine/vachan-ai:0.0.0-alpha.11 + image: vachanengine/vachan-ai:0.0.0-alpha.12 healthcheck: timeout: 45s interval: 10s From 255217dd47f630d99ae28e2f83406fa9e57e5cef Mon Sep 17 00:00:00 2001 From: "Noel.Sudhish" Date: Fri, 19 Jul 2024 13:46:08 +0530 Subject: [PATCH 02/11] revert vachan-ai changes --- docker/docker-compose-production.yml | 4 ++-- docker/docker-compose-staging.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose-production.yml b/docker/docker-compose-production.yml index 552ebc1b..a882a083 100644 --- a/docker/docker-compose-production.yml +++ b/docker/docker-compose-production.yml @@ -346,7 +346,7 @@ services: vachan-ai: - image: vachanengine/vachan-ai:0.0.0-alpha.12 + image: vachanengine/vachan-ai:0.0.0-alpha.8 healthcheck: timeout: 45s interval: 10s @@ -418,7 +418,7 @@ services: worker: - image: vachanengine/vachan-ai:0.0.0-alpha.12 + image: vachanengine/vachan-ai:0.0.0-alpha.8 healthcheck: timeout: 45s interval: 10s diff --git a/docker/docker-compose-staging.yml b/docker/docker-compose-staging.yml index 13a1bc68..6dd554fe 100644 --- a/docker/docker-compose-staging.yml +++ b/docker/docker-compose-staging.yml @@ -346,7 +346,7 @@ services: vachan-ai: - image: vachanengine/vachan-ai:0.0.0-alpha.12 + image: vachanengine/vachan-ai:0.0.0-alpha.8 healthcheck: timeout: 45s interval: 10s @@ -418,7 +418,7 @@ services: worker: - image: vachanengine/vachan-ai:0.0.0-alpha.12 + image: vachanengine/vachan-ai:0.0.0-alpha.8 healthcheck: timeout: 45s interval: 10s From cf58c12a06a18f757972bcf69f0168937071ea94 Mon Sep 17 00:00:00 2001 From: bcs-cicd-bot Date: Fri, 19 Jul 2024 08:53:58 +0000 Subject: [PATCH 03/11] Bump version automatically on release --- app/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index f4bcba32..6d440701 100644 --- a/app/main.py +++ b/app/main.py @@ -22,7 +22,7 @@ if root_url is not None and not root_url.startswith("http://"): root_url = "http://" + root_url -app = FastAPI(title="Vachan-API", version="2.0.7", +app = FastAPI(title="Vachan-API", version="2.0.8", description=f"The server application that provides APIs to interact \ with the underlying Databases and modules in Vachan-Engine. \ \n • For Vachan-CMS docs: {root_url}/v2/cms/rest/docs,\ @@ -239,7 +239,7 @@ def custom_openapi(): openapi_schema = get_openapi( title="Vachan-API", - version="2.0.7", + version="2.0.8", description=( "The server application that provides APIs to interact with the \ underlying Databases \and modules in Vachan-Engine. " From b09238c1c92c3cae6d6f381591946f843cb715c3 Mon Sep 17 00:00:00 2001 From: shimilgithub Date: Tue, 23 Jul 2024 16:16:18 +0530 Subject: [PATCH 04/11] documentation updates after docker compose changes --- README.md | 10 ++--- docs/Vachan-deployment-steps.md | 20 ++++++++-- docs/docker-guide.md | 66 +++++++++++++++++++++++++-------- 3 files changed, 73 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index d50d3ca2..ec756aff 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,14 @@ Implemented Using ```cd vachan-api/docker``` -```docker compose --profile local-run up``` +``` docker compose -f docker-compose-staging.yml --profile local-run up``` or -```sudo -E docker compose --profile local-run up``` +```sudo -E docker compose -f docker-compose-staging.yml --profile local-run up``` Set environment variables VACHAN_SUPER_USERNAME, VACHAN_SUPER_PASSWORD. Use `--build` and `--force-recreate` flags if there has been code change. Refer [the detailed usage guide](./docs/docker-guide.md#to-start-app-locally) and [section on environments variables](#set-up-environmental-variables), for more information. If all goes well you should be able to get proper outputs at `http://localhost`, `http://localhost/docs`, -`http://localhost/v2/cms/rest/docs`,`http://localhost/v2/text/translate/token-based/docs`,`http://localhost/v2/auth/docs`,`http://localhost//v2/ai/docs`,`http://127.0.0.1:4434/identities`and connect to postgresDB at `localhost`, `5433` +`http://localhost/v2/cms/rest/docs`,`http://localhost/v2/text/translate/token-based/docs`,`http://localhost/v2/auth/docs`,`http://localhost//v2/ai/docs`,`http://localhost/v2/graphql`,`http://localhost/v2/demos`,`http://127.0.0.1:4434/identities` and connect to postgresDB at `localhost`, `5433` ## Set up locally for development and testing(without docker) @@ -83,7 +83,7 @@ Edit the following contents appropriatetly and paste to the `.bashrc` file export VACHAN_LOGGING_LEVEL="WARNING" export VACHAN_KRATOS_ADMIN_URL="http://127.0.0.1:4434/" export VACHAN_KRATOS_PUBLIC_URL="http://127.0.0.1:4433/" - export VACHAN_SUPER_USERNAME="" + export VACHAN_SUPER_USERNAME="" export VACHAN_SUPER_PASSWORD="" export VACHAN_DOMAIN=127.0.0.1:8000 ``` @@ -117,7 +117,7 @@ If you need to run the app on another port `--port` can be used. To run in debug ### Access Documentations -Once the app is running, from your browser access http://127.0.0.1:8000/docs for swagger documentation. +Once the app is running, from your browser access http://127.0.0.1:8000/docs for swagger documentation links of microservices. Redoc documentaion is also available at http://127.0.0.1:8000/redoc diff --git a/docs/Vachan-deployment-steps.md b/docs/Vachan-deployment-steps.md index 8f77c257..e7020552 100644 --- a/docs/Vachan-deployment-steps.md +++ b/docs/Vachan-deployment-steps.md @@ -44,13 +44,22 @@ to remove sudo need ``` cd vachan-api/docker -docker compose --env-file prod.env --profile deployment up --build --force-recreate -d +``` + +For Staging: +``` +docker compose -f docker-compose-staging.yml --env-file prod.env --profile deployment up --build --force-recreate -d +``` + +For Production: +``` +docker compose -f docker-compose-production.yml --env-file prod.env --profile deployment up --build --force-recreate -d ``` The environment values to be set in `prod.env` or `.env` file and their expected format are: ``` -VACHAN_SUPER_USERNAME="" +VACHAN_SUPER_USERNAME="" VACHAN_SUPER_PASSWORD="" VACHAN_AUTH_DATABASE="postgresql://:@kratos-postgresd:/" VACHAN_SUPPORT_EMAIL_CREDS="smtps://:::/?skip_ssl_verify=true&legacy_ssl=true" @@ -59,12 +68,17 @@ VACHAN_DOMAIN=api.vachanengine.org VACHAN_KRATOS_PUBLIC_URL="http://api.vachanengine.org:4433/" VACHAN_KRATOS_ADMIN_URL="http://api.vachanengine.org:4434/" VACHAN_POSTGRES_PASSWORD="" - VACHAN_KRATOS_DB_USER="" VACHAN_KRATOS_DB_PASSWORD="" VACHAN_KRATOS_DB_NAME="" VACHAN_GITLAB_TOKEN="" VACHAN_REDIS_PASS="" +VACHAN_AI_DELETION_PERIOD= +VACHAN_AI_CRON_DAY= +VACHAN_AI_CRON_HOUR= +VACHAN_AI_CRON_MINUTE= +VACHAN_AI_DATA_PATH= +``` ``` diff --git a/docs/docker-guide.md b/docs/docker-guide.md index 3325ce2f..af9e8fcd 100644 --- a/docs/docker-guide.md +++ b/docs/docker-guide.md @@ -36,40 +36,40 @@ If you have already set up the repo and remotes for development, pull latest cod VACHAN_SUPER_USERNAME, VACHAN_SUPER_PASSWORD are the minimum required environment variables. This can either be set in the `~/.bashrc` file or save in a local `.env` file and passed via command line. ``` - export VACHAN_SUPER_USERNAME="" + export VACHAN_SUPER_USERNAME="" export VACHAN_SUPER_PASSWORD="" ``` The username should be your email id and password must be a strong password. If you just want to setup and start app locally, from the vachan-api/docker folder, do -```docker compose --profile local-run up``` +```docker compose -f docker-compose-staging.yml --profile local-run up``` or -```docker compose --env-file=path/to/file.env --profile local-run up``` +```docker compose -f docker-compose-staging.yml --env-file=path/to/file.env --profile local-run up``` -If all goes well you should be able to get proper outputs at `http://localhost`, `http://localhost/docs`, `http://localhost/v2/demos`, -`http://127.0.0.1:4434/identities` and connect to postgresDB at `localhost`, `5433` +If all goes well you should be able to get proper outputs at `http://localhost`, `http://localhost/docs`, +`http://localhost/v2/cms/rest/docs`,`http://localhost/v2/text/translate/token-based/docs`,`http://localhost/v2/auth/docs`,`http://localhost//v2/ai/docs`,`http://localhost/v2/graphql`,`http://localhost/v2/demos`,`http://127.0.0.1:4434/identities` and connect to postgresDB at `localhost`, `5433` (Error reports from Kratos container related to failed email sending can be ignored as long as above URLs are accessible). To turn the app down, use -```docker compose --profile local-run down``` +```docker compose -f docker-compose-staging.yml --profile local-run down``` ## To run tests This method is recommended to just run all the tests once to make sure everything works, like in production, CI/CD or locally when verifying a PR. While doing local development and when we may have to run tests selectively and multiple times, after code changes, use the method specificed in [readme](../README.md#set-up-locally-for-development-and-testingwithout-docker). ``` -docker compose up # to start the dependancies -docker compose run vachan-api-test --build +docker compose -f docker-compose-staging.yml up # to start the dependancies +docker compose -f docker-compose-staging.yml run vachan-api-test --build ``` To turn down the running containers after test has been exited, -```docker compose down``` +```docker compose -f docker-compose-staging.yml down``` ## To deploy on server Install docker, docker-compose & git and set up the right repo and branch. @@ -87,23 +87,41 @@ VACHAN_DOMAIN=api.vachanengine.org VACHAN_KRATOS_PUBLIC_URL="http://api.vachanengine.org:4433/" VACHAN_KRATOS_ADMIN_URL="http://api.vachanengine.org:4434/" VACHAN_POSTGRES_PASSWORD="" - VACHAN_KRATOS_DB_USER="" VACHAN_KRATOS_DB_PASSWORD="" VACHAN_KRATOS_DB_NAME="" VACHAN_GITLAB_TOKEN="" VACHAN_REDIS_PASS="" - +VACHAN_AI_DELETION_PERIOD= +VACHAN_AI_CRON_DAY= +VACHAN_AI_CRON_HOUR= +VACHAN_AI_CRON_MINUTE= +VACHAN_AI_DATA_PATH= ``` Once the ENV file is ready, pass it to CLI and start the services as below: + +For Staging: +``` +docker compose -f docker-compose-staging.yml --env-file=prod.env --profile deployment up --build --force-recreate -d +``` + +For Production: ``` -docker compose --env-file=prod.env --profile deployment up --build --force-recreate -d +docker compose -f docker-compose-production.yml --env-file=prod.env --profile deployment up --build --force-recreate -d ``` To re-create SSL certificates, follow instructions [here](https://mindsers.blog/post/https-using-nginx-certbot-docker/) +For Staging: + +``` +docker compose -f docker-compose-staging.yml --profile deployment run --rm certbot renew +``` + +For Production: + ``` -docker compose --profile deployment run --rm certbot renew +docker compose -f docker-compose-production.yml --profile deployment run --rm certbot renew ``` After this make sure the certificate folder in the app root has access permission. or change it with `sudo chmod -R 777 certbot/`. Then the App needs to be restarted as shown below to use the updated ceritifcate. @@ -112,7 +130,15 @@ After this make sure the certificate folder in the app root has access permissio ``` cd ~/vachan-api/docker -docker compose --env-file=prod.env --profile deployment up --build --force-recreate -d +``` +For Staging: +``` +docker compose -f docker-compose-staging.yml --env-file=prod.env --profile deployment up --build --force-recreate -d +``` + +For Production: +``` +docker compose -f docker-compose-production.yml --env-file=prod.env --profile deployment up --build --force-recreate -d ``` ### To re-deploy on server @@ -126,7 +152,17 @@ git pull origin cd docker ``` -```docker compose --env-file=prod.env --profile deployment up --build --force-recreate -d``` +For Staging: + +``` +docker compose -f docker-compose-staging.yml --env-file=prod.env --profile deployment up --build --force-recreate -d +``` + +For Production: + +``` +docker compose -f docker-compose-production.yml --env-file=prod.env --profile deployment up --build --force-recreate -d +``` To start with a fresh DB, stop and remove containers and remove volume `vachan-db-vol`. From 19c817a5195251b4c1fdb70f7a3e28e220726c25 Mon Sep 17 00:00:00 2001 From: shimilgithub Date: Tue, 23 Jul 2024 18:07:40 +0530 Subject: [PATCH 05/11] added few more instructions --- docs/Vachan-deployment-steps.md | 17 ++++++++++++++++- docs/docker-guide.md | 18 +++++++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/docs/Vachan-deployment-steps.md b/docs/Vachan-deployment-steps.md index e7020552..1de7748f 100644 --- a/docs/Vachan-deployment-steps.md +++ b/docs/Vachan-deployment-steps.md @@ -79,6 +79,22 @@ VACHAN_AI_CRON_HOUR= VACHAN_AI_CRON_MINUTE= VACHAN_AI_DATA_PATH= ``` +## To Down the App + +For Staging: + +``` +docker compose -f docker-compose-staging.yml --profile deployment --env-file prod.env down +``` + +For Production: + +``` +docker compose -f docker-compose-production.yml --profile deployment --env-file prod.env down +``` + + +` ``` @@ -108,4 +124,3 @@ Referenced article: https://mindsers.blog/post/https-using-nginx-certbot-docker/ - diff --git a/docs/docker-guide.md b/docs/docker-guide.md index af9e8fcd..78d63964 100644 --- a/docs/docker-guide.md +++ b/docs/docker-guide.md @@ -58,6 +58,7 @@ To turn the app down, use ```docker compose -f docker-compose-staging.yml --profile local-run down``` + ## To run tests This method is recommended to just run all the tests once to make sure everything works, like in production, CI/CD or locally when verifying a PR. While doing local development and when we may have to run tests selectively and multiple times, after code changes, use the method specificed in [readme](../README.md#set-up-locally-for-development-and-testingwithout-docker). @@ -141,6 +142,21 @@ For Production: docker compose -f docker-compose-production.yml --env-file=prod.env --profile deployment up --build --force-recreate -d ``` +## To Down the App + +For Staging: + +``` +docker compose -f docker-compose-staging.yml --profile deployment --env-file prod.env down +``` + +For Production: + +``` +docker compose -f docker-compose-production.yml --profile deployment --env-file prod.env down +``` + + ### To re-deploy on server After git pull, running the same command above, will re-build and re-start the containers. @@ -171,7 +187,7 @@ To clear all user data, remove the volume `kratos-postgres-vol`, on local or on Some useful commands for the above tasks ``` -docker compose down +docker compose -f docker-compose-staging.yml down docker ps # list all running containers docker ps -a # list all running and stopped containers From 926b2bc49eafee385c77c09098c0fba0304e508e Mon Sep 17 00:00:00 2001 From: shimilgithub Date: Wed, 24 Jul 2024 13:19:32 +0530 Subject: [PATCH 06/11] access and cms releases --- docker/docker-compose-production.yml | 4 ++-- docker/docker-compose-staging.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docker/docker-compose-production.yml b/docker/docker-compose-production.yml index a882a083..74e60686 100644 --- a/docker/docker-compose-production.yml +++ b/docker/docker-compose-production.yml @@ -201,7 +201,7 @@ services: - VE-network vachan-cms-rest: - image: vachanengine/vachan-cms-rest:v2.0.13 + image: vachanengine/vachan-cms-rest:v2.0.14 expose: - 8005 command: uvicorn main:app --host 0.0.0.0 --port 8005 @@ -307,7 +307,7 @@ services: - VE-network vachan-access: - image: vachanengine/vachan-access:v2.0.10 + image: vachanengine/vachan-access:v2.0.11 environment: - VACHAN_POSTGRES_HOST=vachan-db - VACHAN_POSTGRES_USER=${VACHAN_POSTGRES_USER:-postgres} diff --git a/docker/docker-compose-staging.yml b/docker/docker-compose-staging.yml index 6dd554fe..04c38d8d 100644 --- a/docker/docker-compose-staging.yml +++ b/docker/docker-compose-staging.yml @@ -201,7 +201,7 @@ services: - VE-network vachan-cms-rest: - image: vachanengine/vachan-cms-rest:v2.0.13 + image: vachanengine/vachan-cms-rest:v2.0.14 expose: - 8005 command: uvicorn main:app --host 0.0.0.0 --port 8005 @@ -307,7 +307,7 @@ services: - VE-network vachan-access: - image: vachanengine/vachan-access:v2.0.10 + image: vachanengine/vachan-access:v2.0.11 environment: - VACHAN_POSTGRES_HOST=vachan-db - VACHAN_POSTGRES_USER=${VACHAN_POSTGRES_USER:-postgres} From 241fd6138309315d064fef76ea67d9aea2f32524 Mon Sep 17 00:00:00 2001 From: "Noel.Sudhish" Date: Wed, 24 Jul 2024 13:18:34 +0530 Subject: [PATCH 07/11] version alpha.13 for vachan-ai for auth --- docker/docker-compose-production.yml | 6 +++--- docker/docker-compose-staging.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docker/docker-compose-production.yml b/docker/docker-compose-production.yml index 74e60686..c846ddab 100644 --- a/docker/docker-compose-production.yml +++ b/docker/docker-compose-production.yml @@ -346,7 +346,7 @@ services: vachan-ai: - image: vachanengine/vachan-ai:0.0.0-alpha.8 + image: vachanengine/vachan-ai:0.0.0-alpha.13 healthcheck: timeout: 45s interval: 10s @@ -389,7 +389,7 @@ services: - VACHAN_AI_CRON_HOUR=${VACHAN_AI_CRON_HOUR:-12} - VACHAN_AI_CRON_MINUTE=${VACHAN_AI_CRON_MINUTE:-30} - VACHAN_AI_BASEPATH=/v2/ai - - VACHAN_DOMAIN=${VACHAN_DOMAIN:-http://vachan-access:8007} + - VACHAN_DOMAIN=http://vachan-access:8007 - VACHAN_AI_DOMAIN=http://vachan-api command: uvicorn main:app --host 0.0.0.0 --port 8009 volumes: @@ -418,7 +418,7 @@ services: worker: - image: vachanengine/vachan-ai:0.0.0-alpha.8 + image: vachanengine/vachan-ai:0.0.0-alpha.13 healthcheck: timeout: 45s interval: 10s diff --git a/docker/docker-compose-staging.yml b/docker/docker-compose-staging.yml index 04c38d8d..9a6acf87 100644 --- a/docker/docker-compose-staging.yml +++ b/docker/docker-compose-staging.yml @@ -346,7 +346,7 @@ services: vachan-ai: - image: vachanengine/vachan-ai:0.0.0-alpha.8 + image: vachanengine/vachan-ai:0.0.0-alpha.13 healthcheck: timeout: 45s interval: 10s @@ -389,7 +389,7 @@ services: - VACHAN_AI_CRON_HOUR=${VACHAN_AI_CRON_HOUR:-12} - VACHAN_AI_CRON_MINUTE=${VACHAN_AI_CRON_MINUTE:-30} - VACHAN_AI_BASEPATH=/v2/ai - - VACHAN_DOMAIN=${VACHAN_DOMAIN:-http://vachan-access:8007} + - VACHAN_DOMAIN=http://vachan-access:8007 - VACHAN_AI_DOMAIN=http://vachan-api command: uvicorn main:app --host 0.0.0.0 --port 8009 volumes: @@ -418,7 +418,7 @@ services: worker: - image: vachanengine/vachan-ai:0.0.0-alpha.8 + image: vachanengine/vachan-ai:0.0.0-alpha.13 healthcheck: timeout: 45s interval: 10s From c2a4ec6ddf1beb42738f2fad53850c591409e83a Mon Sep 17 00:00:00 2001 From: shimilgithub Date: Wed, 24 Jul 2024 13:36:56 +0530 Subject: [PATCH 08/11] to update changes after pull --- docker/docker-compose-production.yml | 1 - docker/docker-compose-staging.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/docker/docker-compose-production.yml b/docker/docker-compose-production.yml index c846ddab..68cfdba3 100644 --- a/docker/docker-compose-production.yml +++ b/docker/docker-compose-production.yml @@ -344,7 +344,6 @@ services: networks: - VE-network - vachan-ai: image: vachanengine/vachan-ai:0.0.0-alpha.13 healthcheck: diff --git a/docker/docker-compose-staging.yml b/docker/docker-compose-staging.yml index 9a6acf87..c5ace5a6 100644 --- a/docker/docker-compose-staging.yml +++ b/docker/docker-compose-staging.yml @@ -344,7 +344,6 @@ services: networks: - VE-network - vachan-ai: image: vachanengine/vachan-ai:0.0.0-alpha.13 healthcheck: From a5eeac2b573fd8045139e1d212830d11fdaf55ff Mon Sep 17 00:00:00 2001 From: AthulyaMS Date: Fri, 2 Aug 2024 13:56:15 +0530 Subject: [PATCH 09/11] Release on cms and access and changes in staging docker compose --- docker/docker-compose-staging.yml | 76 ++--------------------------- docker/nginx/prod/app.conf.template | 4 +- 2 files changed, 7 insertions(+), 73 deletions(-) diff --git a/docker/docker-compose-staging.yml b/docker/docker-compose-staging.yml index c5ace5a6..e2b465fe 100644 --- a/docker/docker-compose-staging.yml +++ b/docker/docker-compose-staging.yml @@ -15,11 +15,7 @@ services: volumes: - kratos-postgres-vol:/var/lib/postgresql/data - kratos-db-backup:/var/backups:rw - labels: - ofelia.enabled: "true" - ofelia.job-exec.kratos-backup.schedule: "0 0 1 * * *" #"Takes a single dump within the db container every day at 01:00 am" - ofelia.job-exec.kratos-backup.command: "pg_dump --dbname=postgresql://$VACHAN_KRATOS_DB_USER:$VACHAN_KRATOS_DB_PASSWORD@localhost:5432/$VACHAN_KRATOS_DB_NAME --file=/var/backups/kratos_db_backup_latest.sql" - networks: + networks: - VE-network kratos-migrate: @@ -100,10 +96,6 @@ services: # - ../db/csvs:/csvs # - ../db/seed_DB.sql:/docker-entrypoint-initdb.d/seed_DB.sql - vachan-db-backup:/var/backups:rw - labels: - ofelia.enabled: "true" - ofelia.job-exec.vachan-backup.schedule: "0 0 0 * * *" #"Takes a single dump within the db container every day at 00:00 am" - ofelia.job-exec.vachan-backup.command: "pg_dump --dbname=postgresql://$VACHAN_POSTGRES_USER:$VACHAN_POSTGRES_PASSWORD@localhost:5432/$VACHAN_POSTGRES_DATABASE --file=/var/backups/vachan_db_backup_latest.sql" #vachan-api app vachan-api: @@ -201,7 +193,7 @@ services: - VE-network vachan-cms-rest: - image: vachanengine/vachan-cms-rest:v2.0.14 + image: vachanengine/vachan-cms-rest:v2.0.15 expose: - 8005 command: uvicorn main:app --host 0.0.0.0 --port 8005 @@ -307,7 +299,7 @@ services: - VE-network vachan-access: - image: vachanengine/vachan-access:v2.0.11 + image: vachanengine/vachan-access:v2.0.12 environment: - VACHAN_POSTGRES_HOST=vachan-db - VACHAN_POSTGRES_USER=${VACHAN_POSTGRES_USER:-postgres} @@ -486,8 +478,7 @@ services: - vachan-api volumes: - ./nginx/prod/app.conf.template:/etc/nginx/templates/default.conf.template:ro - - ./certbot/www:/var/www/certbot/:ro - - ./certbot/conf/:/etc/nginx/ssl/:ro + - /home/vachanstaging/ssl:/etc/nginx/ssl:ro - logs-vol:/var/log/nginx/ environment: - VACHAN_DOMAIN=${VACHAN_DOMAIN} @@ -496,65 +487,8 @@ services: networks: - VE-network - certbot: - image: certbot/certbot:latest - volumes: - - ./certbot/www/:/var/www/certbot/:rw - - ./certbot/conf/:/etc/letsencrypt/:rw - profiles: - - deployment - networks: - - VE-network - -# ofelia-scheduler: -# image: mcuadros/ofelia:v0.3.7 -# depends_on: -# - kratos-postgresd -# - vachan-db -# command: daemon --docker -# volumes: -# - /var/run/docker.sock:/var/run/docker.sock:ro -# - kratos-db-backup:/var/backups/kratos:ro -# - vachan-db-backup:/var/backups/vachan:ro -# - /mnt/vachanapi_backup/backups:/var/backup-copies/:rw -# - logs-vol:/app/logs -# environment: -# - TZ=${TIMEZONE:-Asia/Calcutta} -# labels: -# # Vachan DB Backup Jobs -# ofelia.job-local.copy-vachan-backup-daily.schedule: "0 0 3 * * *" # Copies latest dump from Vachan DB container every day at 03:00 am -# ofelia.job-local.copy-vachan-backup-daily.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then cp /var/backups/vachan/vachan_db_backup_latest.sql /var/backup-copies/vachan_db_backup_daily_`date +%Y-%m-%d_%H_%M_%S`.sql && echo `date`':Daily backup successful(vachan-db)' >> /app/logs/backup.log || echo `date`':Daily backup failed(vachan)' >> /app/logs/backup.log; else echo `date`':Skipping backup as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.prune-vachan-daily-backup.schedule: "0 0 0 * * *" # Retains only latest 7 of the daily backups -# ofelia.job-local.prune-vachan-daily-backup.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then ls -tr /var/backup-copies/vachan_db_backup_daily* | head -n -7 | xargs rm -f -- && echo `date`':Daily Prune successful(vachan-db)' >> /app/logs/backup.log || echo `date`':Daily Prune failed(vachan)' >> /app/logs/backup.log; else echo `date`':Skipping prune as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.copy-vachan-backup-weekly.schedule: "0 0 3 ? * SUN" # Copies latest dump on every Sunday at 03:00 am -# ofelia.job-local.copy-vachan-backup-weekly.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then cp /var/backups/vachan/vachan_db_backup_latest.sql /var/backup-copies/vachan_db_backup_weekly_`date +%Y-%m-%d_%H_%M_%S`.sql && echo `date`':Weekly backup successful(vachan-db)' >> /app/logs/backup.log || echo `date`':Weekly backup failed(vachan)' >> /app/logs/backup.log; else echo `date`':Skipping backup as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.prune-vachan-weekly-backup.schedule: "0 0 0 ? * SUN" # Retains only latest 4 of the weekly backups -# ofelia.job-local.prune-vachan-weekly-backup.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then ls -tr /var/backup-copies/vachan_db_backup_weekly* | head -n -4 | xargs rm -f -- && echo `date`':Weekly Prune successful(vachan-db)' >> /app/logs/backup.log || echo `date`':Weekly Prune failed(vachan)' >> /app/logs/backup.log; else echo `date`':Skipping prune as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.copy-vachan-backup-monthly.schedule: "0 0 3 1 * *" # Copies latest dump on first day of every month -# ofelia.job-local.copy-vachan-backup-monthly.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then cp /var/backups/vachan/vachan_db_backup_latest.sql /var/backup-copies/vachan_db_backup_monthly_`date +%Y-%m-%d_%H_%M_%S`.sql && echo `date`':Monthly backup successful(vachan-db)' >> /app/logs/backup.log || echo `date`':Monthly backup failed(vachan)' >> /app/logs/backup.log; else echo `date`':Skipping backup as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.prune-vachan-monthly-backup.schedule: "0 0 0 1 * *" # Retains only latest 12 of the monthly dumps -# ofelia.job-local.prune-vachan-monthly-backup.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then ls -tr /var/backup-copies/vachan_db_backup_monthly* | head -n -12 | xargs rm -f -- && echo `date`':Monthly Prune successful(vachan-db)' >> /app/logs/backup.log || echo `date`':Monthly Prune failed(vachan)' >> /app/logs/backup.log; else echo `date`':Skipping prune as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.copy-vachan-backup-yearly.schedule: "0 0 3 1 JAN *" # Copies latest dump on first day of every year -# ofelia.job-local.copy-vachan-backup-yearly.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then cp /var/backups/vachan/vachan_db_backup_latest.sql /var/backup-copies/vachan_db_backup_yearly_`date +%Y-%m-%d_%H_%M_%S`.sql && echo `date`':Yearly backup successful(vachan-db)' >> /app/logs/backup.log || echo `date`':Yearly backup failed(vachan)' >> /app/logs/backup.log; else echo `date`':Skipping backup as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# # Kratos DB Backup Jobs -# ofelia.job-local.copy-kratos-backup-daily.schedule: "0 0 4 * * *" # Copies latest dump from Kratos DB container every day at 04:00 am -# ofelia.job-local.copy-kratos-backup-daily.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then cp /var/backups/kratos/kratos_db_backup_latest.sql /var/backup-copies/kratos_db_backup_daily_`date +%Y-%m-%d_%H_%M_%S`.sql && echo `date`':Daily backup successful(kratos)' >> /app/logs/backup.log || echo `date`':Daily backup failed(kratos)' >> /app/logs/backup.log; else echo `date`':Skipping backup as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.prune-kratos-daily-backup.schedule: "0 0 1 * * *" # Retains only latest 7 of the daily backups -# ofelia.job-local.prune-kratos-daily-backup.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then ls -tr /var/backup-copies/kratos_db_backup_daily* | head -n -7 | xargs rm -f -- && echo `date`':Daily Prune successful(kratos)' >> /app/logs/backup.log || echo `date`':Daily Prune failed(kratos)' >> /app/logs/backup.log; else echo `date`':Skipping prune as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.copy-kratos-backup-weekly.schedule: "0 0 4 ? * SUN" # Copies latest dump on every Sunday at 04:00 am -# ofelia.job-local.copy-kratos-backup-weekly.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then cp /var/backups/kratos/kratos_db_backup_latest.sql /var/backup-copies/kratos_db_backup_weekly_`date +%Y-%m-%d_%H_%M_%S`.sql && echo `date`':Weekly backup successful(kratos)' >> /app/logs/backup.log || echo `date`':Weekly backup failed(kratos)' >> /app/logs/backup.log; else echo `date`':Skipping backup as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.prune-kratos-weekly-backup.schedule: "0 1 0 ? * SUN" # Retains only latest 4 of the weekly backups -# ofelia.job-local.prune-kratos-weekly-backup.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then ls -tr /var/backup-copies/kratos_db_backup_weekly* | head -n -4 | xargs rm -f -- && echo `date`':Weekly Prune successful(kratos)' >> /app/logs/backup.log || echo `date`':Weekly Prune failed(kratos)' >> /app/logs/backup.log; else echo `date`':Skipping prune as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.copy-kratos-backup-monthly.schedule: "0 0 4 1 * *" # Copies latest dump on first day of every month -# ofelia.job-local.copy-kratos-backup-monthly.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then cp /var/backups/kratos/kratos_db_backup_latest.sql /var/backup-copies/kratos_db_backup_monthly_`date +%Y-%m-%d_%H_%M_%S`.sql && echo `date`':Monthly backup successful(kratos)' >> /app/logs/backup.log || echo `date`':Monthly backup failed(kratos)' >> /app/logs/backup.log; else echo `date`':Skipping backup as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.prune-kratos-monthly-backup.schedule: "0 0 1 1 * *" # Retains only latest 12 of the monthly dumps -# ofelia.job-local.prune-kratos-monthly-backup.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then ls -tr /var/backup-copies/kratos_db_backup_monthly* | head -n -12 | xargs rm -f -- && echo `date`':Monthly Prune successful(kratos)' >> /app/logs/backup.log || echo `date`':Monthly Prune failed(kratos)' >> /app/logs/backup.log; else echo `date`':Skipping prune as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" -# ofelia.job-local.copy-kratos-backup-yearly.schedule: "0 0 3 1 JAN *" # Copies latest dump on first day of every year -# ofelia.job-local.copy-kratos-backup-yearly.command: sh -c "if [ -d /mnt/vachanapi_backup ]; then cp /var/backups/kratos/kratos_db_backup_latest.sql /var/backup-copies/kratos_db_backup_yearly_`date +%Y-%m-%d_%H_%M_%S`.sql && echo `date`':Yearly backup successful(kratos)' >> /app/logs/backup.log || echo `date`':Yearly backup failed(kratos)' >> /app/logs/backup.log; else echo `date`':Skipping backup as vachanapi_backup directory not found' >> /app/logs/backup.log; fi" - -# networks: -# - VE-network + #redis caching DB redis: diff --git a/docker/nginx/prod/app.conf.template b/docker/nginx/prod/app.conf.template index 279b64a1..0f7ad78f 100644 --- a/docker/nginx/prod/app.conf.template +++ b/docker/nginx/prod/app.conf.template @@ -33,8 +33,8 @@ server { proxy_connect_timeout 300; proxy_send_timeout 300; - ssl_certificate /etc/nginx/ssl/live/${VACHAN_DOMAIN}/fullchain.pem; - ssl_certificate_key /etc/nginx/ssl/live/${VACHAN_DOMAIN}/privkey.pem; + ssl_certificate /etc/nginx/ssl/fullchain.pem; + ssl_certificate_key /etc/nginx/ssl/privkey.pem; location /v2/ai/ { From bdc0e263205077f7edd6a03ebe577b63bb014b41 Mon Sep 17 00:00:00 2001 From: AthulyaMS Date: Fri, 2 Aug 2024 14:31:23 +0530 Subject: [PATCH 10/11] Release on cms and access and changes in staging docker compose --- docker/docker-compose-staging.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/docker-compose-staging.yml b/docker/docker-compose-staging.yml index e2b465fe..9927ed1a 100644 --- a/docker/docker-compose-staging.yml +++ b/docker/docker-compose-staging.yml @@ -298,6 +298,7 @@ services: networks: - VE-network + vachan-access: image: vachanengine/vachan-access:v2.0.12 environment: From 920354fc905ef195af345774bf4fff7c14f648d6 Mon Sep 17 00:00:00 2001 From: AthulyaMS Date: Fri, 2 Aug 2024 15:08:06 +0530 Subject: [PATCH 11/11] resolving conflicts --- docker/docker-compose-staging.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/docker-compose-staging.yml b/docker/docker-compose-staging.yml index 9927ed1a..0a23834d 100644 --- a/docker/docker-compose-staging.yml +++ b/docker/docker-compose-staging.yml @@ -15,7 +15,7 @@ services: volumes: - kratos-postgres-vol:/var/lib/postgresql/data - kratos-db-backup:/var/backups:rw - networks: + networks: - VE-network kratos-migrate: