Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] Odoo Upgrader Template #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions templates/odoo-upgrade/0/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
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:
image: "laslabs/odoo-upgrade:${ODOO_VERSION}"
environment:
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"
{{- 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-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_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"
{{- 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:
{{- if ne .Values.TRAEFIK_DOMAIN "" }}
traefik.domain: "${TRAEFIK_DOMAIN}"
{{- end }}
{{- if ne .Values.TRAEFIK_HOST "" }}
traefik.frontend.rule: 'Host: ${TRAEFIK_HOST}'
{{- end }}
traefik.enable: 'true'
traefik.port: '8069'
traefik.frontend.passHostHeader: 'true'
io.rancher.container.pull_image: 'always'
scale: 1
start_on_create: false
health_check:
healthy_threshold: 2
response_timeout: 2000
port: 8069
unhealthy_threshold: 10
initializing_timeout: 99999999999999
interval: 5000
strategy: recreate
request_line: GET "/" "HTTP/1.0"

{{- if eq .Values.PSQL_SERVICE_NEW "" }}
postgresql:
image: postgres:9.6-alpine
environment:
PGDATA: /var/lib/postgresql/data/pgdata
POSTGRES_PASSWORD: "${PSQL_PASSWORD_NEW}"
POSTGRES_USER: "${PSQL_USER_NEW}"
volumes:
- odoo-db-data:/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 }}
122 changes: 122 additions & 0 deletions templates/odoo-upgrade/0/rancher-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
version: "2"

catalog:
name: Odoo Upgrader
version: "v0.1.0"
description: |
Upgrade Odoo major versions.
uuid: laslabs-odoo-upgrade-0
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"
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"

- 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_URI_OLD"
description: |
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

- variable: "ADMIN_PASSWORD_OLD"
description: |
Database administration password for the old Odoo system.
label: "Old Admin 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.
label: "New PostgreSQL User"
type: "string"

- variable: "PSQL_PASSWORD_NEW"
description: |
Password to use for the new PostgreSQL server.
label: "New 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