Skip to content

Commit

Permalink
Switch to external backup method
Browse files Browse the repository at this point in the history
  • Loading branch information
lasley committed Jan 11, 2018
1 parent f4a177e commit 099919d
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 91 deletions.
98 changes: 47 additions & 51 deletions templates/odoo-upgrade/0/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,48 +14,15 @@ volumes:
services:

odoo-upgrader-core:
image: laslabs/odoo-upgrade:9.0
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"
Expand All @@ -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-custom"
{{- if ne .Values.PSQL_SERVICE_NEW "" }}
external_links:
- "${PSQL_SERVICE_NEW}:db"
Expand All @@ -104,7 +101,7 @@ services:
traefik.frontend.passHostHeader: 'true'
io.rancher.container.pull_image: 'always'
scale: 1
start_on_create: true
#start_on_create: true
health_check:
healthy_threshold: 2
response_timeout: 2000
Expand All @@ -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:
Expand Down
58 changes: 18 additions & 40 deletions templates/odoo-upgrade/0/rancher-compose.yml
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -23,16 +22,17 @@ 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
example - to upgrade a v8 to v9, you would select `9.0`.
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."
Expand All @@ -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

Expand All @@ -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"
Expand Down

0 comments on commit 099919d

Please sign in to comment.