aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-03-16 17:44:26 +0000
committerGerrit Code Review <review@openstack.org>2017-03-16 17:44:26 +0000
commita271420ce74bcca70e5c585f915c6eb80edb935d (patch)
tree64df7ffd6b229cd00bd409c06153d720b2d29bbb
parent56930d685d1afb8cf854ac09774385fdaca335cd (diff)
parentcd88f4d8e928daf0676a4a9b6f36d93df7a6aa7c (diff)
Merge "Keep existing data when moving to containerized MariaDB"
-rw-r--r--docker/services/database/mysql.yaml25
1 files changed, 21 insertions, 4 deletions
diff --git a/docker/services/database/mysql.yaml b/docker/services/database/mysql.yaml
index 46b856e3..531c1ebd 100644
--- a/docker/services/database/mysql.yaml
+++ b/docker/services/database/mysql.yaml
@@ -82,17 +82,29 @@ outputs:
perm: '0644'
docker_config:
step_2:
- mysql_bootstrap:
+ mysql_data_ownership:
start_order: 0
detach: false
image: *mysql_image
net: host
+ user: root
+ # Kolla does only non-recursive chown
+ command: ['chown', '-R', 'mysql:', '/var/lib/mysql']
+ volumes:
+ - /var/lib/mysql:/var/lib/mysql
+ mysql_bootstrap:
+ start_order: 1
+ detach: false
+ image: *mysql_image
+ net: host
+ # Kolla bootstraps aren't idempotent, explicitly checking if bootstrap was done
+ command: ['bash', '-c', 'test -e /var/lib/mysql/mysql || kolla_start']
volumes: &mysql_volumes
- /var/lib/kolla/config_files/mysql.json:/var/lib/kolla/config_files/config.json
- /var/lib/config-data/mysql/:/var/lib/kolla/config_files/src:ro
- /etc/localtime:/etc/localtime:ro
- /etc/hosts:/etc/hosts:ro
- - mariadb:/var/lib/mysql/
+ - /var/lib/mysql:/var/lib/mysql
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
- KOLLA_BOOTSTRAP=True
@@ -110,7 +122,7 @@ outputs:
- {get_param: MysqlRootPassword}
- {get_param: [DefaultPasswords, mysql_root_password]}
mysql:
- start_order: 1
+ start_order: 2
image: *mysql_image
restart: always
net: host
@@ -128,8 +140,13 @@ outputs:
- '/'
- [ {get_param: DockerNamespace}, {get_param: DockerMysqlImage} ]
volumes:
- - "mariadb:/var/lib/mysql/:ro"
+ - "/var/lib/mysql:/var/lib/mysql/:ro"
- "/var/lib/config-data/mysql/root:/root:ro" #provides .my.cnf
+ host_prep_tasks:
+ - name: create /var/lib/mysql
+ file:
+ path: /var/lib/mysql
+ state: directory
upgrade_tasks:
- name: Stop and disable mysql service
tags: step2