diff --git a/templates/restore-odootest.yaml.j2 b/templates/restore-odootest.yaml.j2 index 8733ce406976700f4ff3305125d7be17466ad6eb..cd5e5ebd87dd2df15d75bd68860e2de18aa1741b 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 36fc61428a904e5985139df122ad3c98ea311f5c..5eda9c81f5fc50118c1ecb5dc61f54fa1fbb8c8b 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 }}"