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 diff --git a/.env b/.env index 5cf2761cd2..f3dbbc7a1a 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" @@ -93,7 +94,7 @@ # - 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 diff --git a/docker/nginx/root/nginx.conf.sample b/docker/nginx/root/nginx.conf.sample index 1b7c4a0ae7..ea1560e818 100644 --- a/docker/nginx/root/nginx.conf.sample +++ b/docker/nginx/root/nginx.conf.sample @@ -45,4 +45,18 @@ 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; + } + } }