From 0af52f2e94ca7b0e09c9e5017582ce295f19b8f6 Mon Sep 17 00:00:00 2001 From: Quentin Duchemin <quentinduchemin@tuta.io> Date: Thu, 11 Jun 2020 19:58:07 +0200 Subject: [PATCH] [DBBackup] Add to Etherpad network, add weekpad, add Plume --- pica-db-backup/README.md | 14 ++----------- pica-db-backup/config/backup_config.json | 24 ++++++++++++++++++++++- pica-db-backup/docker-compose.yml | 12 ++++++++++-- pica-db-backup/secrets/db.secrets.example | 4 ++++ 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/pica-db-backup/README.md b/pica-db-backup/README.md index 15efac39..ef351466 100644 --- a/pica-db-backup/README.md +++ b/pica-db-backup/README.md @@ -6,17 +6,6 @@ Il est capable de gérer les bases de données `postgres`, `mysql` ou `mongo` po Il est flexible et se configure via un fichier JSON. -<!-- TOC depthFrom:1 depthTo:6 withLinks:1 updateOnSave:1 orderedList:0 --> - -- [Backup des bases de données des services](#backup-des-bases-de-donnes-des-services) - - [Configuration](#configuration) - - [Structure](#structure) - - [Gestion des secrets](#gestion-des-secrets) - - [Exemple](#exemple) - - [Lancement](#lancement) - -<!-- /TOC --> - ## Configuration Le fichier dans [`config/backup_config.json`](./config/backup_config.json) recensent les informations sur les différentes bases de données qui doivent être backupées. @@ -26,6 +15,8 @@ Il ne doit pas être modifié sur les machines sans être synchronisé avec le d Ce service est destiné à être lancé sur l'ensemble des machines : de cette manière peu importe que Mattermost tourne sous pica01 ou pica02, elle aura des backups. Si une base de données n'est pas accessible, elle est simplement ignorée, ce qui permet d'utiliser le même fichier de configuration pour l'ensemble des machines. +Attention : si la base de donnée tourne dans un réseau Docker isolé, comme [pica-etherpad](../pica-etherpad/docker-compose.yml), il faudra ajouter `db-backup` à ce réseau dans le [docker-compose.yml](./docker-compose.yml). + ### Structure - Nom du service : Contient une structure de données contenant les informations relatives au service telles qu'indiquées ci-dessous @@ -46,7 +37,6 @@ Afin de pouvoir versionner le fichier de configuration sans exposer les identifi La substitution est effectué automatiquement par l'outil. - ### Exemple Cet exemple montre trois possibilités : le backup d'une base MySQL, Postgresql et MongoDB. diff --git a/pica-db-backup/config/backup_config.json b/pica-db-backup/config/backup_config.json index 4c9328b1..b45c9396 100644 --- a/pica-db-backup/config/backup_config.json +++ b/pica-db-backup/config/backup_config.json @@ -20,7 +20,18 @@ "Folder": "etherpad", "Cron": "0 1 * * *", "Options": "--single-transaction", - "Init-Backup": "" + "Init-Backup": "1" + }, + "etherpad-week": { + "Host": "etherpad-week-db", + "Port": "5432", + "User": "ETHERPAD_WEEK_DB_USER", + "Password": "ETHERPAD_WEEK_DB_PASSWORD", + "Database": "--all-databases", + "Type": "postgres", + "Folder": "etherpad-week", + "Cron": "0 1 * * *", + "Init-Backup": "1" }, "wekan": { "Host": "wekan-db", @@ -30,5 +41,16 @@ "Folder": "wekan", "Cron": "0 */12 * * *", "Init-Backup": "1" + }, + "blog": { + "Host": "blog-db", + "Port": "5432", + "User": "BLOG_DB_USER", + "Password": "BLOG_DB_PASSWORD", + "Database": "plume", + "Type": "postgres", + "Folder": "plume", + "Cron": "0 1 * * *", + "Init-Backup": "1" } } diff --git a/pica-db-backup/docker-compose.yml b/pica-db-backup/docker-compose.yml index 0a7ff499..81339bce 100644 --- a/pica-db-backup/docker-compose.yml +++ b/pica-db-backup/docker-compose.yml @@ -1,6 +1,12 @@ version: "3.7" networks: + etherpad_standard: + name: "etherpad_main" + etherpad_week: + name: "etherpad_week" + plume: + name: plume docker_default: external: true name: "docker_default" @@ -12,9 +18,11 @@ services: volumes: - /DATA/BACKUP/:/backup/ - ./config:/config - # - /etc/localtime:/etc/localtime:ro env_file: - ./secrets/db.secrets networks: - docker_default - restart: always + - etherpad_main + - etherpad_week + - plume + restart: unless-stopped diff --git a/pica-db-backup/secrets/db.secrets.example b/pica-db-backup/secrets/db.secrets.example index 6551fd20..97448640 100644 --- a/pica-db-backup/secrets/db.secrets.example +++ b/pica-db-backup/secrets/db.secrets.example @@ -2,3 +2,7 @@ ETHERPAD_DB_USER= ETHERPAD_DB_PASSWORD= MATTERMOST_DB_USER= MATTERMOST_DB_PASSWORD= +BLOG_DB_USER= +BLOG_DB_PASSWORD= +ETHERPAD_WEEK_DB_USER= +ETHERPAD_WEEK_DB_PASSWORD -- GitLab