From e6e7832073debcae254d7d921a4c758edb94f042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20-=20Le=20Filament?= <remi@le-filament.com> Date: Thu, 4 Aug 2022 12:23:37 +0200 Subject: [PATCH] [FIX] missing volumes for restore when no prod --- templates/restore-odootest.yaml.j2 | 10 +++++----- templates/restore2-odootest.yaml.j2 | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/templates/restore-odootest.yaml.j2 b/templates/restore-odootest.yaml.j2 index 8733ce4..cd5e5eb 100644 --- a/templates/restore-odootest.yaml.j2 +++ b/templates/restore-odootest.yaml.j2 @@ -6,6 +6,11 @@ services: networks: - {{ item.dir }}_default - public + volumes: + - backups_odoo_backup_cache:/root/.cache/duplicity/:z + - {{ item.dir }}_filestore:/mnt/backup/src/odoo:z + - ./post_restore-{{ item.name }}.sql:/tmp/post-restore.sql:ro + - ./pre_restore-{{ item.name }}.sql:/tmp/pre-restore.sql:ro environment: PGDATABASE: "{{ item.db }}" SWIFT_USERNAME: "{{ swift_odoo_username }}" @@ -21,11 +26,6 @@ services: PGUSER: "{{ odoo_prod.db_user }}" PGPASSWORD: "{{ odoo_prod.db_pass }}" PASSPHRASE: "{{ odoo_backup_pass | default(odoo_prod.master_pass) }}" - volumes: - - backups_odoo_backup_cache:/root/.cache/duplicity/:z - - {{ item.dir }}_filestore:/mnt/backup/src/odoo:z - - ./post_restore-{{ item.name }}.sql:/tmp/post-restore.sql:ro - - ./pre_restore-{{ item.name }}.sql:/tmp/pre-restore.sql:ro command: [sh, -c, "psql -a -f /tmp/pre-restore.sql postgres ; echo 'remove existing dir' && rm -rf /mnt/backup/src/odoo/filestore/$$PGDATABASE && restore && echo 'move repo to final dest' && mv /mnt/backup/src/odoo/filestore/{{ odoo_prod.db }} /mnt/backup/src/odoo/filestore/$$PGDATABASE && echo 'create database' && createdb -T template0 $$PGDATABASE && echo 'restore database' && pg_restore -d $$PGDATABASE $$SRC/{{ odoo_prod.db }}.pgdump ; psql -a -f /tmp/post-restore.sql $$PGDATABASE"] {% else %} DST: "swift://odoo_{{ item.prod_inv_name|lower }}" diff --git a/templates/restore2-odootest.yaml.j2 b/templates/restore2-odootest.yaml.j2 index 36fc614..5eda9c8 100644 --- a/templates/restore2-odootest.yaml.j2 +++ b/templates/restore2-odootest.yaml.j2 @@ -6,6 +6,11 @@ services: networks: - {{ item.dir }}_default - public + volumes: + - backups_odoo_backup2_cache:/root/.cache/duplicity/:z + - {{ item.dir }}_filestore:/mnt/backup/src/odoo:z + - ./post_restore-{{ item.name }}.sql:/tmp/post-restore.sql:ro + - ./pre_restore-{{ item.name }}.sql:/tmp/pre-restore.sql:ro environment: PGDATABASE: "{{ item.db }}" SWIFT_USERNAME: "{{ swift_odoo2_username }}" @@ -21,11 +26,6 @@ services: PGUSER: "{{ odoo_prod.db_user }}" PGPASSWORD: "{{ odoo_prod.db_pass }}" PASSPHRASE: "{{ odoo_backup_pass | default(odoo_prod.master_pass) }}" - volumes: - - backups_odoo_backup2_cache:/root/.cache/duplicity/:z - - {{ item.dir }}_filestore:/mnt/backup/src/odoo:z - - ./post_restore-{{ item.name }}.sql:/tmp/post-restore.sql:ro - - ./pre_restore-{{ item.name }}.sql:/tmp/pre-restore.sql:ro command: [sh, -c, "psql -a -f /tmp/pre-restore.sql postgres ; echo 'remove existing dir' && rm -rf /mnt/backup/src/odoo/filestore/$$PGDATABASE && restore && echo 'move repo to final dest' && mv /mnt/backup/src/odoo/filestore/{{ odoo_prod.db }} /mnt/backup/src/odoo/filestore/$$PGDATABASE && echo 'create database' && createdb -T template0 $$PGDATABASE && echo 'restore database' && pg_restore -d $$PGDATABASE $$SRC/{{ odoo_prod.db }}.pgdump ; psql -a -f /tmp/post-restore.sql $$PGDATABASE"] {% else %} DST: "swift://odoo_{{ item.prod_inv_name|lower }}" -- GitLab