From a5eeac2b573fd8045139e1d212830d11fdaf55ff Mon Sep 17 00:00:00 2001 From: AthulyaMS Date: Fri, 2 Aug 2024 13:56:15 +0530 Subject: [PATCH] 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/ {