Browse Source

Merge "Add upgrade definition"

Jenkins 2 years ago
parent
commit
831a1b7f57
3 changed files with 73 additions and 0 deletions
  1. 7
    0
      docker/designate-upgrade/Dockerfile.j2
  2. 10
    0
      service/files/backup.sh.j2
  3. 56
    0
      service/upgrade/default.yaml

+ 7
- 0
docker/designate-upgrade/Dockerfile.j2 View File

@@ -0,0 +1,7 @@
1
+FROM {{ image_spec("designate-base") }}
2
+MAINTAINER {{ maintainer }}
3
+
4
+RUN apt-get install -y --no-install-recommends \
5
+        mysql-client \
6
+    && apt-get clean
7
+

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

@@ -0,0 +1,10 @@
1
+#!/bin/bash -ex
2
+set -o pipefail
3
+BACKUP_FILE_API="/var/ccp/backup/designate/backup-$(date "+%Y%m%d%H%M%S")-api.sql"
4
+mysqldump {% 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}"
7
+BACKUP_FILE_POOL="/var/ccp/backup/designate/backup-$(date "+%Y%m%d%H%M%S")-pool.sql"
8
+mysqldump {% 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}"

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

@@ -0,0 +1,56 @@
1
+upgrade:
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
46
+files:
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"

Loading…
Cancel
Save