Browse Source

Merge "Add upgrade definition"

master
Jenkins 2 years ago
parent
commit
5fa714c4b1
3 changed files with 50 additions and 0 deletions
  1. 5
    0
      docker/sahara-upgrade/Dockerfile.j2
  2. 6
    0
      service/files/backup.sh.j2
  3. 39
    0
      service/upgrade/default.yaml

+ 5
- 0
docker/sahara-upgrade/Dockerfile.j2 View File

@@ -0,0 +1,5 @@
FROM {{ image_spec("sahara-base") }}
MAINTAINER {{ maintainer }}

RUN apt-get install -y --no-install-recommends mysql-client \
&& apt-get clean

+ 6
- 0
service/files/backup.sh.j2 View File

@@ -0,0 +1,6 @@
#!/bin/bash -ex
set -o pipefail
BACKUP_FILE="/var/ccp/backup/sahara/backup-$(date "+%Y%m%d%H%M%S").sql"
mysqldump {% if db.tls.enabled %} --ssl-mode REQUIRED {% endif %} -h {{ address("database") }} \
-u {{ sahara.db.username }} -p{{ sahara.db.password }} \
--single-transaction {{ sahara.db.name }} > "${BACKUP_FILE}"

+ 39
- 0
service/upgrade/default.yaml View File

@@ -0,0 +1,39 @@
upgrade:
name: upgrade-sahara
image: sahara-upgrade
steps:
- name: backup
command: /opt/ccp/bin/backup.sh
files:
- backup-sh
volumes:
- name: backup-dir
path: /var/ccp/backup/sahara
type: host
readOnly: false
topology_key: backup
- name: kill-services
type: kill-services
services:
- sahara-api
- sahara-engine
- name: db-sync
command: sahara-db-manage --config-file /etc/sahara/sahara.conf upgrade head
files:
- sahara-conf
- name: roll-api
type: rolling-upgrade
services:
- sahara-api
- name: roll-engine
type: rolling-upgrade
services:
- sahara-engine
files:
sahara-conf:
path: /etc/sahara/sahara.conf
content: sahara.conf.j2
backup-sh:
path: /opt/ccp/bin/backup.sh
content: backup.sh.j2
perm: "500"

Loading…
Cancel
Save