summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-03-14 12:46:44 +0000
committerGerrit Code Review <review@openstack.org>2017-03-14 12:46:44 +0000
commit831a1b7f5725f6ab8232a5f5817021e05add0e12 (patch)
tree377634d017034dddf85f0586656520fe89973a46
parent2cbb76ba3d730ce2fc438d238c0d8f060f76118b (diff)
parentc0e356e704e7e7843e3af800d4396c3bf0e9d951 (diff)
Merge "Add upgrade definition"
-rw-r--r--docker/designate-upgrade/Dockerfile.j27
-rw-r--r--service/files/backup.sh.j210
-rw-r--r--service/upgrade/default.yaml56
3 files changed, 73 insertions, 0 deletions
diff --git a/docker/designate-upgrade/Dockerfile.j2 b/docker/designate-upgrade/Dockerfile.j2
new file mode 100644
index 0000000..ce93e38
--- /dev/null
+++ b/docker/designate-upgrade/Dockerfile.j2
@@ -0,0 +1,7 @@
1FROM {{ image_spec("designate-base") }}
2MAINTAINER {{ maintainer }}
3
4RUN apt-get install -y --no-install-recommends \
5 mysql-client \
6 && apt-get clean
7
diff --git a/service/files/backup.sh.j2 b/service/files/backup.sh.j2
new file mode 100644
index 0000000..dc00a4d
--- /dev/null
+++ b/service/files/backup.sh.j2
@@ -0,0 +1,10 @@
1#!/bin/bash -ex
2set -o pipefail
3BACKUP_FILE_API="/var/ccp/backup/designate/backup-$(date "+%Y%m%d%H%M%S")-api.sql"
4mysqldump {% if db.tls.enabled %} --ssl-mode REQUIRED {% endif %} -h {{ address(service.database) }} \
5 -u {{ designate.db.username }} -p{{ designate.db.password }} \
6 --single-transaction {{ designate.db.name.main_database }} > "${BACKUP_FILE_API}"
7BACKUP_FILE_POOL="/var/ccp/backup/designate/backup-$(date "+%Y%m%d%H%M%S")-pool.sql"
8mysqldump {% if db.tls.enabled %} --ssl-mode REQUIRED {% endif %} -h {{ address(service.database) }} \
9 -u {{ designate.db.username }} -p{{ designate.db.password }} \
10 --single-transaction {{ designate.db.name.pool_manager }} > "${BACKUP_FILE_POOL}"
diff --git a/service/upgrade/default.yaml b/service/upgrade/default.yaml
new file mode 100644
index 0000000..447886d
--- /dev/null
+++ b/service/upgrade/default.yaml
@@ -0,0 +1,56 @@
1upgrade:
2 name: upgrade-designate
3 image: designate-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/designate
12 type: host
13 readOnly: false
14 topology_key: backup
15 - name: kill-services
16 type: kill-services
17 - name: designate-api-syncdb
18 files:
19 - designate-conf
20 type: single
21 command: designate-manage --config-file /etc/designate/designate.conf database sync
22 - name: start-designate-central
23 type: rolling-upgrade
24 services:
25 - designate-api
26 - designate-central
27 - name: designate-pool-update
28 files:
29 - pools
30 - designate-conf
31 type: single
32 command: designate-manage pool update --file /etc/designate/pools.yaml
33 - name: designate-pool-sync
34 dependencies:
35 - designate-pool-manager-db-create
36 files:
37 - designate-conf
38 type: single
39 command: designate-manage --config-file /etc/designate/designate.conf pool-manager-cache sync
40 - name: start-other-services
41 type: rolling-upgrade
42 services:
43 - designate-pool-manager
44 - designate-mdns
45 - designate-zone-manager
46files:
47 designate-conf:
48 path: /etc/designate/designate.conf
49 content: designate.conf.j2
50 pools:
51 path: /etc/designate/pools.yaml
52 content: pools.yaml.j2
53 backup-sh:
54 path: /opt/ccp/bin/backup.sh
55 content: backup.sh.j2
56 perm: "500"