Skip to content

Commit

Permalink
[ADD] Odoo Upgrader Template
Browse files Browse the repository at this point in the history
* Create a theoretical Odoo major version upgrade methodology for Rancher installations
  • Loading branch information
lasley committed Jan 10, 2018
1 parent 1ce8ebc commit 8afa5cf
Show file tree
Hide file tree
Showing 4 changed files with 278 additions and 0 deletions.
115 changes: 115 additions & 0 deletions templates/odoo-upgrade/0/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
version: '2'

volumes:
odoo-web-data:
driver: ${VOLUME_DRIVER}
odoo-private-addons:
driver: ${VOLUME_DRIVER}
{{- if eq .Values.PSQL_SERVICE_NEW "" }}
odoo-db-data:
driver: ${VOLUME_DRIVER}
{{- end }}

services:

odoo-upgrader-core:
image: laslabs/odoo-upgrade:9.0
environment:
- DB_SOURCE: "${PSQL_DATABASE_OLD}"
- DB_TARGET: "${PSQL_DATABASE_NEW}"
- PGDATABASE: "${PSQL_DATABASE_NEW}"
- PGUSER: "${PSQL_USER}"
- PGPASSWORD: "${PSQL_PASSWORD}"
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
- odoo-private-addons:/opt/odoo/custom/src/private
tty: true
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}"
environment:
- PGDATABASE: "${PSQL_DATABASE_NEW}"
- PGUSER: "${PSQL_USER}"
- PGPASSWORD: "${PSQL_PASSWORD}"
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
- odoo-private-addons:/opt/odoo/custom/src/private
tty: true
labels:
io.rancher.container.pull_image: 'always'
io.rancher.container.start_once: 'true'
scale: 1
start_on_create: true

traefik:
image: laslabs/odoo-traefik:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command:
- --web
labels:
traefik.enable: 'true'
traefik.domain: "${TRAEFIK_DOMAIN}"
traefik.frontend.rule: 'HostRegexp: {subdomain:[a-zA-Z0-9]+-[a-zA-Z0-9]+-[a-zA-Z0-9]+}.${TRAEFIK_DOMAIN};'
traefik.port: '80'
io.rancher.container.pull_image: always
traefik.frontend.passHostHeader: 'true'
traefik.frontend.priority: 1
scale: 1
start_on_create: true
health_check:
healthy_threshold: 2
response_timeout: 2000
port: 80
unhealthy_threshold: 10
initializing_timeout: 60000
interval: 5000
strategy: recreate
request_line: GET "/" "HTTP/1.0"

{{- 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}"
volumes:
- odoo-db-data-new:/var/lib/postgresql/data/
scale: 1
start_on_create: true
health_check:
healthy_threshold: 2
response_timeout: 2000
port: 5432
unhealthy_threshold: 20
initializing_timeout: 60000
interval: 5000
strategy: recreate
reinitializing_timeout: 60000
{{- end }}
144 changes: 144 additions & 0 deletions templates/odoo-upgrade/0/rancher-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
version: "2"

catalog:
name: Odoo Runbot
version: "v9.0.0.1.1"
description: |
Runbot is a Continuous Integration server for Odoo.
Meant to be proxied by Traefik.
uuid: laslabs-runbot-1
minimum_rancher_version: v1.0.0
questions:

- variable: "VOLUME_DRIVER"
description: "The volume driver to use for persistent storage."
label: "Volume Driver"
required: true
type: "enum"
default: "local"
options:
- local
- rancher-ebs
- rancher-efs
- rancher-nfs

- variable: "ODOO_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

- variable: "SCAFFOLD_IMAGE"
description: "Your scaffold image location."
label: "Image"
type: "string"
required: true

- variable: "SCAFFOLD_TAG"
description: "The tag for your new Odoo image."
label: "Tag"
type: "string"
required: true

- variable: "ODOO_SERVICE_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"
type: "string"
required: true
default: "/var/lib/odoo"

- variable: "PSQL_SERVICE_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"
type: "password"
required: true

- variable: "PSQL_DATABASE_OLD"
description: "Name of source database on the old PostgreSQL server."
label: "Source Database"
type: "string"
required: true

- variable: "PSQL_SERVICE_NEW"
description: |
Existing PostgreSQL database service to use for the upgraded database.
Leaving this empty will create a Postgres service in the stack.
label: "PostgreSQL New"
type: "service"

- 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"
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"
type: "password"

- variable: "PSQL_DATABASE_NEW"
description: "Name of target database on the new PostgreSQL server."
label: "Target Database"
type: "string"
required: true

- variable: "ODOO_ADMIN_PASSWORD"
description: "Password to Odoo database management interface."
label: "Odoo Admin Password"
type: "password"
required: true

- variable: "HOST_LABEL"
description: |
Host label and value that must be applied to a host in order to allow
updater services on them.
label: "Host Label"
type: "string"
required: true
default: "odoo_updater=true"

- variable: "TRAEFIK_DOMAIN"
description: "Base domain to define in Traefik."
label: "Traefik Domain"
type: "string"
required: true
default: rancher.internal

- variable: "TRAEFIK_HOST"
description: |
Additional domain name that should be advertised through Traefik.
Comma separate to include more than one.
label: "Traefik Host"
type: "string"
10 changes: 10 additions & 0 deletions templates/odoo-upgrade/catalogIcon-odoo-upgrade.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions templates/odoo-upgrade/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Odoo Upgrader
description: |
Upgrade Odoo major versions using OpenUpgrade.
This build is meant to be behind a Traefik proxy.
version: v0.1.0
category: Continuous Integration
maintainer: LasLabs Inc. <support@laslabs.com>
license: Apache 2.0
projectURL: https://github.com/LasLabs/rancher-catalog

0 comments on commit 8afa5cf

Please sign in to comment.