-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup.yaml
More file actions
46 lines (44 loc) · 1.06 KB
/
backup.yaml
File metadata and controls
46 lines (44 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
init:
suffix: 20190716
backupFile: mydb_${suffix}.sql
dbname: mydb
dbbucket: sdatbackup
dbIP:
mysql: 127.0.0.1
pipeline:
take:
dump:
action: exec:run
systemPaths:
- /usr/local/mysql/bin
secrets:
mydb: mysql-mydb-root
commands:
- echo 'starting $dbname backup'
- mysqldump -uroot -p${mydb.password} -h${dbIP.mysql} $dbname > /tmp/$backupFile
- history -c
upload:
action: storage:copy
source:
URL: /tmp/$backupFile
dest:
credentials: gcp-myservice
URL: gs://${dbbucket}/data/
restore:
download:
action: storage:copy
source:
credentials: gcp-myservice
URL: gs://{dbbucket}/data/$backupFile
dest:
URL: /tmp/$backupFile
load:
action: exec:run
systemPaths:
- /usr/local/mysql/bin
secrets:
mydb: mysql-mydb-root
commands:
- echo 'starting $dbname restore'
- mysql -uroot -p ${mydb.password} -h${dbIP.mysql} $dbname < /tmp/$backupFile
- history -c