Replace config-external with a JSON file for Galera

Change-Id: I82abc9a31571376679c4f463f5a6ae77a49ec2f6
Partially-Implements: blueprint replace-config-external
This commit is contained in:
rthallisey 2015-08-27 16:18:17 -04:00 committed by Ryan Hallisey
parent 3d7f9fd624
commit 7088e885f8
5 changed files with 28 additions and 10 deletions

View File

@ -66,7 +66,7 @@
insecure_registry: "{{ docker_insecure_registry }}" insecure_registry: "{{ docker_insecure_registry }}"
name: mariadb name: mariadb
image: "{{ mariadb_image_full }}" image: "{{ mariadb_image_full }}"
volumes: "{{ node_config_directory }}/mariadb/:/opt/kolla/mariadb/:ro" volumes: "{{ node_config_directory }}/mariadb/:/opt/kolla/config_files/:ro"
volumes_from: volumes_from:
- "mariadb_data" - "mariadb_data"
env: env:

View File

@ -7,3 +7,8 @@
config_template_dest: config_template_dest:
- "{{ node_templates_directory }}/mariadb/galera.cnf_minimal" - "{{ node_templates_directory }}/mariadb/galera.cnf_minimal"
config_dest: "{{ node_config_directory }}/mariadb/galera.cnf" config_dest: "{{ node_config_directory }}/mariadb/galera.cnf"
- name: Copying Mariadb JSON configuration file
template:
src: "roles/mariadb/templates/mariadb.json.j2"
dest: "{{ node_config_directory }}/mariadb/config.json"

View File

@ -13,7 +13,7 @@
insecure_registry: "{{ docker_insecure_registry }}" insecure_registry: "{{ docker_insecure_registry }}"
name: mariadb name: mariadb
image: "{{ mariadb_image_full }}" image: "{{ mariadb_image_full }}"
volumes: "{{ node_config_directory }}/mariadb/:/opt/kolla/mariadb/:ro" volumes: "{{ node_config_directory }}/mariadb/:/opt/kolla/config_files/:ro"
volumes_from: volumes_from:
- "mariadb_data" - "mariadb_data"
env: env:

View File

@ -0,0 +1,12 @@
{% set mysql_dir = 'mysql/conf.d' if kolla_base_distro in ['ubuntu', 'debian'] else 'my.cnf.d' %}
{
"command": "/usr/bin/mysqld_safe",
"config_files": [
{
"source": "/opt/kolla/config_files/galera.cnf",
"dest": "/etc/{{ mysql_dir }}/galera.cnf",
"owner": "mysql",
"perm": "0600"
}
]
}

View File

@ -2,16 +2,14 @@
set -o errexit set -o errexit
CMD="/usr/bin/mysqld_safe" # Loading common functions
ARGS=""
# loading common functions
source /opt/kolla/kolla-common.sh source /opt/kolla/kolla-common.sh
# Execute config strategy # Generate run command
set_configs python /opt/kolla/set_configs.py
CMD=$(cat /command_options)
# loading functions # Loading functions
source /opt/kolla/config/config-galera.sh source /opt/kolla/config/config-galera.sh
chown mysql: /var/lib/mysql chown mysql: /var/lib/mysql
@ -22,6 +20,9 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; t
touch /var/lib/mysql/cluster.exists touch /var/lib/mysql/cluster.exists
populate_db populate_db
bootstrap_db bootstrap_db
exec $CMD $ARGS
exit 0
fi fi
exec $CMD $ARGS echo "Running command: ${CMD}"
exec $CMD