Skip to content
Extraits de code Groupes Projets
Valider 5f203993 rédigé par Rémi - Le Filament's avatar Rémi - Le Filament
Parcourir les fichiers

[IMP] add cache and update hostname

parent 26b4a756
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -2,7 +2,7 @@ version: "2.1"
services:
backup_odoo:
image: tecnativa/duplicity:postgres
hostname: backup-odoo
hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-odoo
environment:
DST: "swift://odoo_{{ inventory_hostname|lower }}"
PGDATABASE: "{{ odoo_prod.db }}"
......@@ -20,7 +20,9 @@ services:
JOB_300_WHAT: "backup --full-if-older-than 6D --allow-source-mismatch"
JOB_302_WHAT: "dup remove-all-but-n-full 5 --force $$DST $$@"
JOB_302_WHEN: "daily"
OPTIONS: "--allow-source-mismatch"
volumes:
- odoo_backup_cache:/root/.cache/duplicity/:z
- odoo_filestore:/mnt/backup/src/odoo:z
{% if metabase is defined and metabase %}
- odoo_metabase:/mnt/backup/src/metabase:z
......@@ -39,6 +41,7 @@ networks:
encrypted: 1
volumes:
odoo_backup_cache:
odoo_filestore:
external: true
{% if metabase is defined and metabase %}
......
......@@ -2,7 +2,7 @@ version: "2.1"
services:
backup_odoo:
image: tecnativa/duplicity:postgres
hostname: backup-odoo
hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-odoo
environment:
DST: "swift://odoo_{{ inventory_hostname|lower }}"
PGDATABASE: "{{ odoo_prod.db }}"
......@@ -20,7 +20,9 @@ services:
JOB_300_WHAT: "backup --full-if-older-than 6D --allow-source-mismatch"
JOB_302_WHAT: "dup remove-all-but-n-full 5 --force $$DST $$@"
JOB_302_WHEN: "daily"
OPTIONS: "--allow-source-mismatch"
volumes:
- odoo_backup2_cache:/root/.cache/duplicity/:z
- odoo_filestore:/mnt/backup/src/odoo:z
{% if metabase is defined and metabase %}
- odoo_metabase:/mnt/backup/src/metabase:z
......@@ -39,6 +41,7 @@ networks:
encrypted: 1
volumes:
odoo_backup2_cache:
odoo_filestore:
external: true
{% if metabase is defined and metabase %}
......
......@@ -2,7 +2,7 @@ version: "2.1"
services:
restore_test:
image: tecnativa/duplicity:postgres
hostname: backup-odoo
hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-odoo
volumes:
- {{ item.dir }}_filestore:/mnt/backup/src/odoo:z
- ./post_restore-{{ item.name }}.sql:/tmp/post-restore.sql:ro
......@@ -19,12 +19,14 @@ services:
SWIFT_TENANTNAME: "{{ swift_odoo_tenantname }}"
SWIFT_TENANTID: "{{ swift_odoo_tenantid }}"
SWIFT_REGIONNAME: "{{ swift_odoo_regionname }}"
OPTIONS: "--force"
OPTIONS: "--force --allow-source-mismatch"
{% if odoo_prod is defined %}
DST: "swift://odoo_{{ inventory_hostname|lower }}"
PGUSER: "{{ odoo_prod.db_user }}"
PGPASSWORD: "{{ odoo_prod.db_pass }}"
PASSPHRASE: "{{ odoo_backup_pass | default(odoo_prod.master_pass) }}"
volumes:
- odoo_backup_cache:/root/.cache/duplicity/:z
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 }}"
......@@ -42,5 +44,7 @@ networks:
encrypted: 1
volumes:
odoo_backup_cache:
external: true
{{ item.dir }}_filestore:
external: true
......@@ -2,7 +2,7 @@ version: "2.1"
services:
restore_test:
image: tecnativa/duplicity:postgres
hostname: backup-odoo
hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-odoo
volumes:
- {{ item.dir }}_filestore:/mnt/backup/src/odoo:z
- ./post_restore-{{ item.name }}.sql:/tmp/post-restore.sql:ro
......@@ -19,12 +19,14 @@ services:
SWIFT_TENANTNAME: "{{ swift_odoo2_tenantname }}"
SWIFT_TENANTID: "{{ swift_odoo2_tenantid }}"
SWIFT_REGIONNAME: "{{ swift_odoo2_regionname }}"
OPTIONS: "--force"
OPTIONS: "--force --allow-source-mismatch"
{% if odoo_prod is defined %}
DST: "swift://odoo_{{ inventory_hostname|lower }}"
PGUSER: "{{ odoo_prod.db_user }}"
PGPASSWORD: "{{ odoo_prod.db_pass }}"
PASSPHRASE: "{{ odoo_backup_pass | default(odoo_prod.master_pass) }}"
volumes:
- odoo_backup2_cache:/root/.cache/duplicity/:z
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 }}"
......@@ -42,5 +44,7 @@ networks:
encrypted: 1
volumes:
odoo_backup2_cache:
external: true
{{ item.dir }}_filestore:
external: true
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter