Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 1c67efefa3ce765d6b43505f6a7aab2beaaa5be8
  • master par défaut protégée
  • v1.7.12 protégée
  • v1.7.11 protégée
  • v1.7.10 protégée
  • v1.7.9 protégée
  • v1.7.8 protégée
  • v1.7.7 protégée
  • v1.7.6 protégée
  • v1.7.5 protégée
  • v1.7.4 protégée
  • v1.7.3 protégée
  • v1.7.2 protégée
  • v1.7.1 protégée
  • v1.7.0 protégée
  • v1.6.7 protégée
  • v1.6.6 protégée
  • v1.6.5 protégée
  • v1.6.4 protégée
  • v1.6.3 protégée
  • v1.6.2 protégée
  • v1.6.1 protégée
22 résultats

restore-odootest.yaml.j2

Blame
  • restore-odootest.yaml.j2 2,91 Kio
    version: "2.1"
    services:
        restore_test:
            image: tecnativa/duplicity:postgres
            hostname: {{ inventory_hostname_short | lower | regex_replace('_','') }}-odoo
            networks:
                - {{ item.dir }}_default
                - public
            environment:
                PGDATABASE: "{{ item.db }}"
                SWIFT_USERNAME: "{{ swift_odoo_username }}"
                SWIFT_PASSWORD: "{{ swift_odoo_password }}"
                SWIFT_AUTHURL: "{{ swift_odoo_authurl }}"
                SWIFT_AUTHVERSION: {{ swift_odoo_authversion }}
                SWIFT_TENANTNAME: "{{ swift_odoo_tenantname }}"
                SWIFT_TENANTID: "{{ swift_odoo_tenantid }}"
                SWIFT_REGIONNAME: "{{ swift_odoo_regionname }}"
                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:
                - 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 }}"
                PGUSER: "{{ item.db_user }}"
                PGPASSWORD: "{{ item.db_pass }}"
                PASSPHRASE: "{{ hostvars[item.prod_inv_name].odoo_backup_pass | default(hostvars[item.prod_inv_name].odoo_prod.master_pass) }}"
            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/{{ hostvars[item.prod_inv_name].odoo_prod.db }} /mnt/backup/src/odoo/filestore/$$PGDATABASE && echo 'create database' && createdb -T template0 $$PGDATABASE && echo 'restore database' && pg_restore -d $$PGDATABASE $$SRC/{{ hostvars[item.prod_inv_name].odoo_prod.db }}.pgdump ; psql -a -f /tmp/post-restore.sql $$PGDATABASE"]
    {% endif %}
    
    networks:
        {{ item.dir }}_default:
            external: true
        public:
            driver_opts:
                encrypted: 1
    
    volumes:
        backups_odoo_backup_cache:
    {% if odoo_prod is defined %}
            external: true
    {% endif %}
        {{ item.dir }}_filestore:
            external: true