From 089fd38fd675983886abd1aecf1f8e0f59579921 Mon Sep 17 00:00:00 2001 From: Gaspard Jacobson <52928254+gjacobjn@users.noreply.github.com> Date: Fri, 19 Nov 2021 16:29:17 +0100 Subject: [PATCH 1/7] Update nginx.conf.sample --- docker/nginx/root/nginx.conf.sample | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docker/nginx/root/nginx.conf.sample b/docker/nginx/root/nginx.conf.sample index 1b7c4a0ae7..404cfdb4d2 100644 --- a/docker/nginx/root/nginx.conf.sample +++ b/docker/nginx/root/nginx.conf.sample @@ -45,4 +45,17 @@ server { include fastcgi_extended_params; fastcgi_pass backend; } + + location /simplesaml { + alias /var/alchemy/simplesamlphp/www; + location ~ \.php(/|$) { + include fastcgi_params; + fastcgi_pass backend; + fastcgi_split_path_info ^(.+?\.php)(/.+)$; + fastcgi_param SCRIPT_FILENAME $request_filename; + fastcgi_param PATH_INFO $fastcgi_path_info if_not_empty; + fastcgi_param HTTPS on; + proxy_set_header X-Forwarded-Port $server_port; + fastcgi_param PATH_INFO $fastcgi_path_info; + } } From 0e171e3e2301899bd9c2aa671b82ad4bfc38aa82 Mon Sep 17 00:00:00 2001 From: Moctar Date: Tue, 25 Jan 2022 12:28:36 +0100 Subject: [PATCH 2/7] PHRAS-3636 update .env and docker-compose-tools to add backup db --- .env | 43 +++++++++++++++++++++++++++++++++++++--- docker-compose.tools.yml | 21 +++++++++++++++++++- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/.env b/.env index 5cf2761cd2..7b75c804ec 100644 --- a/.env +++ b/.env @@ -49,6 +49,7 @@ # - "elk" : launch an elk stack, for dev only. # - "squid" : reverse proxy for dev only. # - "mailhog" : for catching all email emit by app for dev. +# - "db-backup" : launch and run a container to cron database backups and backup file's rotation. # # Profiles worker list: # - "assetsInjest" @@ -87,13 +88,13 @@ # # For production (require using your own databases services): # - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml:docker-compose.scheduler.yml -# - COMPOSE_PROFILES=app,workers +# - COMPOSE_PROFILES=app,workers,db-backup # # Example with all profiles: # - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml # - COMPOSE_PROFILES=app,db,elasticsearch,redis,rabbitmq,pma,mailhog,assetsInjest,createRecord,deleteRecord,editRecord, # exportMail,exposeUpload,exportFtp,mainQueue,populateIndex,pullAssets,recordsActions,subdefCreation, -# subtitle,validationReminder,webhook,writeMetadatas,scheduler,elk +# subtitle,validationReminder,webhook,writeMetadatas,scheduler,elk,db-backup # @@ -103,7 +104,7 @@ COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.too # Define which profiles you want to use in "docker-compose". # @run -COMPOSE_PROFILES=app,db,elasticsearch,rabbitmq,redis,worker,mailhog +COMPOSE_PROFILES=app,db,elasticsearch,rabbitmq,redis,worker,mailhog,db-backup @@ -271,7 +272,43 @@ MYSQL_QUERY_CACHE_SIZE=64M # @run MYSQL_KEY_BUFFER_SIZE=128M +# --- DB Backup settings --------------------------------------------------------------------------------------------- +# Path where the backuped files will be locally stored +# @run +DB_BACKUP_VOLUME_PATH=./datas + +# The database server host +# @run +DB_BACKUP_MYSQL_HOST=db + +# The database server user +# @run +DB_BACKUP_MYSQL_USER=root + +# The database server pass +# @run +DB_BACKUP_MYSQL_PASS=${MYSQL_ROOT_PASSWORD} + +# The backup file's rotation time in days +# @run +DB_BACKUP_MAX_BACKUPS=7 + +# If set, create a backup when the container starts +# @run +DB_BACKUP_INIT_BACKUP=0 + +# If set, restores latest backup. +# @run +DB_BACKUP_INIT_RESTORE_LATEST=0 + +# Every day at 03:00 +# @run +DB_BACKUP_CRON_TIME=0 3 * * * + +# Make it small +# @run +DB_BACKUP_GZIP_LEVEL=9 # --- Phraseanet general settings -------------------------------------------------------------------------------------- diff --git a/docker-compose.tools.yml b/docker-compose.tools.yml index b52d149c15..bb62e503c4 100644 --- a/docker-compose.tools.yml +++ b/docker-compose.tools.yml @@ -73,6 +73,25 @@ services: networks: - internal + db-backup: + image: fradelg/mysql-cron-backup + profiles: ["db-backup"] + depends_on: + - db + volumes: + - ${DB_BACKUP_VOLUME_PATH}/backup:/backup + networks: + - internal + environment: + - MYSQL_HOST=${DB_BACKUP_MYSQL_HOST} + - MYSQL_USER=${DB_BACKUP_MYSQL_USER} + - MYSQL_PASS=${MYSQL_ROOT_PASSWORD} + - MAX_BACKUPS=${DB_BACKUP_MAX_BACKUPS} + - INIT_BACKUP=${DB_BACKUP_INIT_BACKUP} + - INIT_RESTORE_LATEST=${DB_BACKUP_INIT_RESTORE_LATEST} + - CRON_TIME=${DB_BACKUP_CRON_TIME} + - GZIP_LEVEL=${DB_BACKUP_GZIP_LEVEL} + restart: unless-stopped #squid: # image: sameersbn/squid:3.5.27-2 @@ -85,4 +104,4 @@ services: # - ${PHRASEANET_LOGS_DIR}/squid:/var/log/squid # restart: always # networks: - # - internal \ No newline at end of file + # - internal From 4b4ccffef68a128752f547e8b599752b203e59c8 Mon Sep 17 00:00:00 2001 From: Moctar Date: Tue, 25 Jan 2022 12:37:11 +0100 Subject: [PATCH 3/7] fix nginx error when adding simplesaml config --- docker/nginx/root/nginx.conf.sample | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/nginx/root/nginx.conf.sample b/docker/nginx/root/nginx.conf.sample index 404cfdb4d2..ea1560e818 100644 --- a/docker/nginx/root/nginx.conf.sample +++ b/docker/nginx/root/nginx.conf.sample @@ -57,5 +57,6 @@ server { fastcgi_param HTTPS on; proxy_set_header X-Forwarded-Port $server_port; fastcgi_param PATH_INFO $fastcgi_path_info; + } } } From c984596ea423d7bb635e253be8ff87176af8fb82 Mon Sep 17 00:00:00 2001 From: Nicolas Maillat Date: Wed, 26 Jan 2022 23:08:47 +0100 Subject: [PATCH 4/7] tmp removing time --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 7b75c804ec..f61da63952 100644 --- a/.env +++ b/.env @@ -304,7 +304,7 @@ DB_BACKUP_INIT_RESTORE_LATEST=0 # Every day at 03:00 # @run -DB_BACKUP_CRON_TIME=0 3 * * * +DB_BACKUP_CRON_TIME= # Make it small # @run From 326b0a2f9af189df125a1d334482b75b3b7f17d8 Mon Sep 17 00:00:00 2001 From: Moctar Date: Fri, 28 Jan 2022 11:16:52 +0100 Subject: [PATCH 5/7] remove backup from prod profile --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 7b75c804ec..cdf0ff921c 100644 --- a/.env +++ b/.env @@ -88,7 +88,7 @@ # # For production (require using your own databases services): # - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml:docker-compose.scheduler.yml -# - COMPOSE_PROFILES=app,workers,db-backup +# - COMPOSE_PROFILES=app,workers # # Example with all profiles: # - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml From 2ae10f958260a39255fb62b833487477350f1652 Mon Sep 17 00:00:00 2001 From: Moctar Date: Fri, 28 Jan 2022 17:07:36 +0100 Subject: [PATCH 6/7] set default backup time value --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 4f14108f85..f3dbbc7a1a 100644 --- a/.env +++ b/.env @@ -304,7 +304,7 @@ DB_BACKUP_INIT_RESTORE_LATEST=0 # Every day at 03:00 # @run -DB_BACKUP_CRON_TIME= +DB_BACKUP_CRON_TIME=0 3 * * # Make it small # @run From cc96d93add124a50e0a211d67d7fdb5987cb1cf0 Mon Sep 17 00:00:00 2001 From: Nicolas Maillat Date: Mon, 31 Jan 2022 16:40:38 +0100 Subject: [PATCH 7/7] PHRAS-3618 adding bin/maintenance to .dockerignore [ci skip] --- .dockerignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.dockerignore b/.dockerignore index 87ac5d9034..0c8887c29d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,6 +18,7 @@ !/bin/console !/bin/developer !/bin/setup +!/bin/maintenance /cache /config/configuration.yml /config/configuration-compiled.php