summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docker/sahara-upgrade/Dockerfile.j25
-rw-r--r--service/files/backup.sh.j26
-rw-r--r--service/upgrade/default.yaml39
3 files changed, 50 insertions, 0 deletions
diff --git a/docker/sahara-upgrade/Dockerfile.j2 b/docker/sahara-upgrade/Dockerfile.j2
new file mode 100644
index 0000000..fba90be
--- /dev/null
+++ b/docker/sahara-upgrade/Dockerfile.j2
@@ -0,0 +1,5 @@
1FROM {{ image_spec("sahara-base") }}
2MAINTAINER {{ maintainer }}
3
4RUN apt-get install -y --no-install-recommends mysql-client \
5 && apt-get clean
diff --git a/service/files/backup.sh.j2 b/service/files/backup.sh.j2
new file mode 100644
index 0000000..8b84245
--- /dev/null
+++ b/service/files/backup.sh.j2
@@ -0,0 +1,6 @@
1#!/bin/bash -ex
2set -o pipefail
3BACKUP_FILE="/var/ccp/backup/sahara/backup-$(date "+%Y%m%d%H%M%S").sql"
4mysqldump {% if db.tls.enabled %} --ssl-mode REQUIRED {% endif %} -h {{ address("database") }} \
5 -u {{ sahara.db.username }} -p{{ sahara.db.password }} \
6 --single-transaction {{ sahara.db.name }} > "${BACKUP_FILE}" \ No newline at end of file
diff --git a/service/upgrade/default.yaml b/service/upgrade/default.yaml
new file mode 100644
index 0000000..b396725
--- /dev/null
+++ b/service/upgrade/default.yaml
@@ -0,0 +1,39 @@
1upgrade:
2 name: upgrade-sahara
3 image: sahara-upgrade
4 steps:
5 - name: backup
6 command: /opt/ccp/bin/backup.sh
7 files:
8 - backup-sh
9 volumes:
10 - name: backup-dir
11 path: /var/ccp/backup/sahara
12 type: host
13 readOnly: false
14 topology_key: backup
15 - name: kill-services
16 type: kill-services
17 services:
18 - sahara-api
19 - sahara-engine
20 - name: db-sync
21 command: sahara-db-manage --config-file /etc/sahara/sahara.conf upgrade head
22 files:
23 - sahara-conf
24 - name: roll-api
25 type: rolling-upgrade
26 services:
27 - sahara-api
28 - name: roll-engine
29 type: rolling-upgrade
30 services:
31 - sahara-engine
32files:
33 sahara-conf:
34 path: /etc/sahara/sahara.conf
35 content: sahara.conf.j2
36 backup-sh:
37 path: /opt/ccp/bin/backup.sh
38 content: backup.sh.j2
39 perm: "500"