From 7b0f4f2b125fdd91625baa3fdb3b6d4f805a1638 Mon Sep 17 00:00:00 2001 From: Dave Lasley Date: Thu, 11 Jan 2018 10:42:33 -0800 Subject: [PATCH] Switch to external backup method --- templates/odoo-upgrade/0/docker-compose.yml | 100 +++++++++---------- templates/odoo-upgrade/0/rancher-compose.yml | 58 ++++------- 2 files changed, 66 insertions(+), 92 deletions(-) diff --git a/templates/odoo-upgrade/0/docker-compose.yml b/templates/odoo-upgrade/0/docker-compose.yml index 330796a..08e7b4a 100644 --- a/templates/odoo-upgrade/0/docker-compose.yml +++ b/templates/odoo-upgrade/0/docker-compose.yml @@ -13,49 +13,16 @@ volumes: services: - odoo-upgrader-core: - image: laslabs/odoo-upgrade:9.0 + odoo-upgrader: + image: "laslabs/odoo-upgrade:${ODOO_VERSION}" environment: - - DB_SOURCE: "${PSQL_DATABASE_OLD}" - - DB_TARGET: "${PSQL_DATABASE_NEW}" - - PGDATABASE: "${PSQL_DATABASE_NEW}" - - PGUSER: "${PSQL_USER}" - - PGPASSWORD: "${PSQL_PASSWORD}" - - ODOO_FILESTORE_NEW: "/var/lib/odoo_upgrader_files" - - ODOO_FILESTORE_OLD: "${ODOO_SERVICE_FILES}" - external_links: - - "${PSQL_SERVICE_OLD}:db_old" - {{- if ne .Values.PSQL_SERVICE_NEW "" }} - - "${PSQL_SERVICE_NEW}:db" - {{- end }} - {{- if eq .Values.PSQL_SERVICE_NEW "" }} - links: - - postgresql:db - {{- end }} - volumes: - - odoo-web-data:/var/lib/odoo_upgrader_files - - odoo-private-addons:/opt/odoo/custom/src/private - volumes_from: - - "${ODOO_SERVICE_OLD}" - labels: - io.rancher.container.pull_image: 'always' - io.rancher.container.start_once: 'true' - scale: 1 - start_on_create: true - - odoo-upgrader-custom: - image: "${SCAFFOLD_IMAGE}:${SCAFFOLD_TAG}" - command: | - odoo --workers 0 \ - --limit-time-cpu 0 \ - --limit-time-real 0 \ - --stop-after-init \ - --update all - environment: - - PGDATABASE: "${PSQL_DATABASE_NEW}" - - PGUSER: "${PSQL_USER}" - - PGPASSWORD: "${PSQL_PASSWORD}" - - WAIT_NOHOST: odoo-upgrader-core + DB_SOURCE: "${PSQL_DATABASE_OLD}" + DB_TARGET: "${PSQL_DATABASE_NEW}" + PGDATABASE: "${PSQL_DATABASE_NEW}" + PGUSER: "${PSQL_USER_NEW}" + PGPASSWORD: "${PSQL_PASSWORD_NEW}" + ODOO_URI_OLD: "${ODOO_URI_OLD}" + ADMIN_PASSWORD_OLD: "${ADMIN_PASSWORD_OLD}" {{- if ne .Values.PSQL_SERVICE_NEW "" }} external_links: - "${PSQL_SERVICE_NEW}:db" @@ -73,14 +40,44 @@ services: scale: 1 start_on_create: true +# odoo-upgrader-custom: +# image: "${SCAFFOLD_IMAGE}:${SCAFFOLD_TAG}" +# command: | +# odoo --workers 0 \ +# --limit-time-cpu 0 \ +# --limit-time-real 0 \ +# --stop-after-init \ +# --update all +# environment: +# PGDATABASE: "${PSQL_DATABASE_NEW}" +# PGUSER: "${PSQL_USER_NEW}" +# PGPASSWORD: "${PSQL_PASSWORD_NEW}" +# WAIT_NOHOST: "odoo-upgrader-core" +# {{- if ne .Values.PSQL_SERVICE_NEW "" }} +# external_links: +# - "${PSQL_SERVICE_NEW}:db" +# {{- end }} +# {{- if eq .Values.PSQL_SERVICE_NEW "" }} +# links: +# - postgresql:db +# {{- end }} +# volumes: +# - odoo-web-data:/var/lib/odoo +# - odoo-private-addons:/opt/odoo/custom/src/private +# labels: +# io.rancher.container.pull_image: 'always' +# io.rancher.container.start_once: 'true' +# scale: 1 +# start_on_create: true + odoo: image: "${SCAFFOLD_IMAGE}:${SCAFFOLD_TAG}" environment: - - PGDATABASE: "${PSQL_DATABASE_NEW}" - - PGUSER: "${PSQL_USER}" - - PGPASSWORD: "${PSQL_PASSWORD}" - - ADMIN_PASSWORD: "${ODOO_ADMIN_PASSWORD}" - - WAIT_NOHOST: odoo-upgrader-custom + PGDATABASE: "${PSQL_DATABASE_NEW}" + PGUSER: "${PSQL_USER_NEW}" + PGPASSWORD: "${PSQL_PASSWORD_NEW}" + ADMIN_PASSWORD: "${ODOO_ADMIN_PASSWORD}" + WAIT_NOHOST: "odoo-upgrader" {{- if ne .Values.PSQL_SERVICE_NEW "" }} external_links: - "${PSQL_SERVICE_NEW}:db" @@ -104,7 +101,7 @@ services: traefik.frontend.passHostHeader: 'true' io.rancher.container.pull_image: 'always' scale: 1 - start_on_create: true + start_on_create: false health_check: healthy_threshold: 2 response_timeout: 2000 @@ -118,13 +115,12 @@ services: {{- if eq .Values.PSQL_SERVICE_NEW "" }} postgresql: image: postgres:9.6-alpine - hostname: db environment: PGDATA: /var/lib/postgresql/data/pgdata - POSTGRES_PASSWORD: "${PSQL_PASSWORD}" - POSTGRES_USER: "${PSQL_USER}" + POSTGRES_PASSWORD: "${PSQL_PASSWORD_NEW}" + POSTGRES_USER: "${PSQL_USER_NEW}" volumes: - - odoo-db-data-new:/var/lib/postgresql/data/ + - odoo-db-data:/var/lib/postgresql/data/ scale: 1 start_on_create: true health_check: diff --git a/templates/odoo-upgrade/0/rancher-compose.yml b/templates/odoo-upgrade/0/rancher-compose.yml index 5c6c666..439963a 100644 --- a/templates/odoo-upgrade/0/rancher-compose.yml +++ b/templates/odoo-upgrade/0/rancher-compose.yml @@ -1,12 +1,11 @@ version: "2" catalog: - name: Odoo Runbot - version: "v9.0.0.1.1" + name: Odoo Upgrader + version: "v0.1.0" description: | - Runbot is a Continuous Integration server for Odoo. - Meant to be proxied by Traefik. - uuid: laslabs-runbot-1 + Upgrade Odoo major versions. + uuid: laslabs-odoo-upgrade-0 minimum_rancher_version: v1.0.0 questions: @@ -23,6 +22,7 @@ catalog: - rancher-nfs - variable: "ODOO_VERSION" + label: "Target Version" description: | Version of Odoo to upgrade to. This should be the major version immediately above the version installed in your database. For @@ -30,9 +30,9 @@ catalog: type: "enum" required: true options: - - 9.0 - - 10.0 - - 11.0 + - "9.0" + - "10.0" + - "11.0" - variable: "SCAFFOLD_IMAGE" description: "Your scaffold image location." @@ -46,38 +46,18 @@ catalog: type: "string" required: true - - variable: "ODOO_SERVICE_OLD" + - variable: "ODOO_URI_OLD" description: | - Existing Odoo service to copy file store from. - label: "Odoo Service" - type: "service" - required: true - - - variable: "ODOO_SERVICE_FILES" - description: | - Location of the Odoo files in the service container. - label: "Odoo Filesystem" + URI of an Odoo instance to obtain a backup from. + Note that this instance must be capable of providing a backup via the web UI. + label: "Old Odoo URI" type: "string" required: true - default: "/var/lib/odoo" - - variable: "PSQL_SERVICE_OLD" + - variable: "ADMIN_PASSWORD_OLD" description: | - Existing PostgreSQL database service to use that contains the old database. - label: "PostgreSQL Old" - type: "service" - required: true - - - variable: "PSQL_USER_OLD" - description: "Username to use for the old PostgreSQL server." - label: "Old PostgreSQL User" - default: "odoo" - type: "string" - required: true - - - variable: "PSQL_PASSWORD_OLD" - description: "Password to use for the old PostgreSQL server." - label: "Old PostgreSQL Password" + Database administration password for the old Odoo system. + label: "Old Admin Password" type: "password" required: true @@ -97,15 +77,13 @@ catalog: - variable: "PSQL_USER_NEW" description: | Username to use for the new PostgreSQL server. - Leave blank if the credentials match the old server. - label: "Old PostgreSQL User" + label: "New PostgreSQL User" type: "string" - variable: "PSQL_PASSWORD_NEW" description: | - Password to use for the old PostgreSQL server. - Leave blank if the credentials match the old server. - label: "Old PostgreSQL Password" + Password to use for the new PostgreSQL server. + label: "New PostgreSQL Password" type: "password" - variable: "PSQL_DATABASE_NEW"