From 1a80a7f0e67117c2ddbd425cea353de82ea473f8 Mon Sep 17 00:00:00 2001 From: Emmanuel Nyachoke Date: Mon, 1 Jul 2024 15:56:58 +0300 Subject: [PATCH] KH-512: Add reports redirect and back up docker compose files (#362) * KH-512: Add reports redirect and back up docker compose files * Address review * Copy files in single execution step * Add commend tor reports redirect * Update base/scripts/docker-compose-reports-redirect.yml Co-authored-by: Romain Buisson * Update base/scripts/docker-compose-reports-redirect.yml Co-authored-by: Romain Buisson --------- Co-authored-by: Romain Buisson --- base/pom.xml | 27 +++++++++- base/scripts/backup.docker-compose.yml | 52 +++++++++++++++++++ .../docker-compose-reports-redirect.yml | 11 ++++ 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 base/scripts/backup.docker-compose.yml create mode 100644 base/scripts/docker-compose-reports-redirect.yml diff --git a/base/pom.xml b/base/pom.xml index 5e91671c..ee7c98d1 100644 --- a/base/pom.xml +++ b/base/pom.xml @@ -151,7 +151,30 @@ - + + + Copy docker-compose-reports-redirect.yml + process-resources + + copy-resources + + + + ${project.build.directory}/${project.artifactId}-${project.version}/run/docker/ + + true + + + ${project.basedir}/scripts + + docker-compose-reports-redirect.yml + backup.docker-compose.yml + + true + + + + @@ -278,4 +301,4 @@ --> - + \ No newline at end of file diff --git a/base/scripts/backup.docker-compose.yml b/base/scripts/backup.docker-compose.yml new file mode 100644 index 00000000..a9225945 --- /dev/null +++ b/base/scripts/backup.docker-compose.yml @@ -0,0 +1,52 @@ +services: + create-backup-folder: + image: busybox:latest + command: ["sh", "-c", "mkdir -p /mnt/$$BACKUP_FOLDER"] + environment: + BACKUP_FOLDER: ${BACKUP_FOLDER} + volumes: + - "${BACKUP_PATH:-backup-path}:/mnt" + # + # MySQL backups + # + openmrs-db-backup: + image: mekomsolutions/mysql_backup:48d0823 + depends_on: + create-backup-folder: + condition: service_completed_successfully + environment: + DB_HOST: 172.17.0.1 + DB_NAME: openmrs + DB_USERNAME: ${OPENMRS_DB_USER} + DB_PASSWORD: ${OPENMRS_DB_PASSWORD} + BACKUP_PATH: "/opt/backup/${BACKUP_FOLDER}" + networks: + ozone: + aliases: + - openmrs-db-backup + volumes: + - "${BACKUP_PATH:-backup-path}:/opt/backup/" + # + # OpenMRS Initializer backups + # + openmrs-checksum-backup: + image: mekomsolutions/filestore_backup:48d0823 + depends_on: + create-backup-folder: + condition: service_completed_successfully + environment: + FILESTORE_PATH: /mnt/openmrs_config_checksum + BACKUP_PATH: "/opt/backup/${BACKUP_FOLDER}" + FILENAME: openmrs-checksum + volumes: + - "${BACKUP_PATH:-backup-path}:/opt/backup/" + - "${OPENMRS_CONFIG_CHECKSUMS_PATH:-openmrs-config-checksums}:/mnt/openmrs_config_checksum" + +volumes: + backup-path: ~ + odoo-filestore: ~ + odoo-checksums: ~ + openmrs-config-checksums: ~ + +networks: + ozone: \ No newline at end of file diff --git a/base/scripts/docker-compose-reports-redirect.yml b/base/scripts/docker-compose-reports-redirect.yml new file mode 100644 index 00000000..cc49143f --- /dev/null +++ b/base/scripts/docker-compose-reports-redirect.yml @@ -0,0 +1,11 @@ +# +# Needed to redirect /reports to a separate Superset instance accessible via AWS domain name +# +services: + frontend: + labels: + traefik.http.routers.reports.rule: "Host(`${O3_HOSTNAME}`) && PathPrefix(`/reports`)" + traefik.http.routers.reports.entrypoints: "websecure" + traefik.http.routers.reports.middlewares: reports-redirectregex + traefik.http.middlewares.reports-redirectregex.redirectregex.regex: https://${O3_HOSTNAME}/reports + traefik.http.middlewares.reports-redirectregex.redirectregex.replacement: https://${SUPERSET_HOSTNAME} \ No newline at end of file