From 3487d8da14a82f8f01d0c58293c5f6597a9e4422 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Thu, 3 Sep 2015 09:12:38 +0000 Subject: Rename Galera to MariaDB Change-Id: I3134ba72e2ce4e85a17facbc3b5af4c1c3438d33 Closes-Bug: #1491740 --- docker/base/Dockerfile.j2 | 2 +- docker/galera/Dockerfile.j2 | 42 --------------------------------------- docker/galera/config-external.sh | 11 ---------- docker/galera/config-galera.sh | 36 --------------------------------- docker/galera/start.sh | 27 ------------------------- docker/mariadb/Dockerfile.j2 | 42 +++++++++++++++++++++++++++++++++++++++ docker/mariadb/config-external.sh | 11 ++++++++++ docker/mariadb/config-galera.sh | 36 +++++++++++++++++++++++++++++++++ docker/mariadb/start.sh | 27 +++++++++++++++++++++++++ 9 files changed, 117 insertions(+), 117 deletions(-) delete mode 100644 docker/galera/Dockerfile.j2 delete mode 100644 docker/galera/config-external.sh delete mode 100755 docker/galera/config-galera.sh delete mode 100755 docker/galera/start.sh create mode 100644 docker/mariadb/Dockerfile.j2 create mode 100644 docker/mariadb/config-external.sh create mode 100755 docker/mariadb/config-galera.sh create mode 100755 docker/mariadb/start.sh (limited to 'docker') diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index be54e9bee..cd41257f9 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -8,7 +8,7 @@ ENV KOLLA_INSTALL_TYPE {{ install_type }} {% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} -# Turns on galera repos throughout the build +# Turns on MariaDB repos throughout the build COPY mariadb.yum.repo /etc/yum.repos.d/MariaDB.repo RUN yum install -y http://www.percona.com/redir/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm \ diff --git a/docker/galera/Dockerfile.j2 b/docker/galera/Dockerfile.j2 deleted file mode 100644 index 38e66ee14..000000000 --- a/docker/galera/Dockerfile.j2 +++ /dev/null @@ -1,42 +0,0 @@ -FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-base:{{ tag }} -MAINTAINER Kolla Project (https://launchpad.net/kolla) - -{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} - -RUN yum install -y \ - MariaDB-Galera-server \ - MariaDB-client \ - rsync \ - galera \ - socat \ - hostname \ - percona-xtrabackup \ - pv \ - tar \ - expect \ - && rm -rf /var/lib/mysql/* - -{% elif base_distro in ['ubuntu', 'debian'] %} - -# At the end of this run statement we symlink two folders to match the folder -# structure of the RPM family for mysql configs. This allows us to not change -# the config-external.sh code -# TODO(SamYaple): Remove that symlink once config-external is updated -RUN apt-get install -y --no-install-recommends \ - mariadb-galera-server \ - percona-xtrabackup \ - socat \ - expect \ - && apt-get clean \ - && rm -rf /var/lib/mysql/* \ - && ln -s /etc/mysql/conf.d/ /etc/my.cnf.d - -{% endif %} - -COPY config-galera.sh /opt/kolla/config/ -COPY config-external.sh /opt/kolla/ -COPY start.sh / - -CMD ["/start.sh"] - -{{ include_footer }} diff --git a/docker/galera/config-external.sh b/docker/galera/config-external.sh deleted file mode 100644 index 43447a51c..000000000 --- a/docker/galera/config-external.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -SOURCE="/opt/kolla/mariadb/galera.cnf" -TARGET="/etc/my.cnf.d/galera.cnf" -OWNER="mysql" - -# Cluster configuration -if [[ -f "$SOURCE" ]]; then - cp $SOURCE $TARGET - chown ${OWNER}: $TARGET - chmod 0600 $TARGET -fi diff --git a/docker/galera/config-galera.sh b/docker/galera/config-galera.sh deleted file mode 100755 index cfdd7d9a2..000000000 --- a/docker/galera/config-galera.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -function bootstrap_db { - mysqld_safe --wsrep-new-cluster & - - # Waiting for deamon - sleep 10 - expect -c ' - set timeout 10 - spawn mysql_secure_installation - expect "Enter current password for root (enter for none):" - send "\r" - expect "Set root password?" - send "y\r" - expect "New password:" - send "'"${DB_ROOT_PASSWORD}"'\r" - expect "Re-enter new password:" - send "'"${DB_ROOT_PASSWORD}"'\r" - expect "Remove anonymous users?" - send "y\r" - expect "Disallow root login remotely?" - send "n\r" - expect "Remove test database and access to it?" - send "y\r" - expect "Reload privilege tables now?" - send "y\r" - expect eof' - - mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" - mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" - mysqladmin -p"${DB_ROOT_PASSWORD}" shutdown -} - -function populate_db { - mysql_install_db --user=mysql -} diff --git a/docker/galera/start.sh b/docker/galera/start.sh deleted file mode 100755 index 986cca733..000000000 --- a/docker/galera/start.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -o errexit - -CMD="/usr/bin/mysqld_safe" -ARGS="" - -# loading common functions -source /opt/kolla/kolla-common.sh - -# Execute config strategy -set_configs - -# loading functions -source /opt/kolla/config/config-galera.sh - -chown mysql: /var/lib/mysql - -# This catches all cases of the BOOTSTRAP variable being set, including empty -if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; then - ARGS="--wsrep-new-cluster" - touch /var/lib/mysql/cluster.exists - populate_db - bootstrap_db -fi - -exec $CMD $ARGS diff --git a/docker/mariadb/Dockerfile.j2 b/docker/mariadb/Dockerfile.j2 new file mode 100644 index 000000000..38e66ee14 --- /dev/null +++ b/docker/mariadb/Dockerfile.j2 @@ -0,0 +1,42 @@ +FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-base:{{ tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} + +RUN yum install -y \ + MariaDB-Galera-server \ + MariaDB-client \ + rsync \ + galera \ + socat \ + hostname \ + percona-xtrabackup \ + pv \ + tar \ + expect \ + && rm -rf /var/lib/mysql/* + +{% elif base_distro in ['ubuntu', 'debian'] %} + +# At the end of this run statement we symlink two folders to match the folder +# structure of the RPM family for mysql configs. This allows us to not change +# the config-external.sh code +# TODO(SamYaple): Remove that symlink once config-external is updated +RUN apt-get install -y --no-install-recommends \ + mariadb-galera-server \ + percona-xtrabackup \ + socat \ + expect \ + && apt-get clean \ + && rm -rf /var/lib/mysql/* \ + && ln -s /etc/mysql/conf.d/ /etc/my.cnf.d + +{% endif %} + +COPY config-galera.sh /opt/kolla/config/ +COPY config-external.sh /opt/kolla/ +COPY start.sh / + +CMD ["/start.sh"] + +{{ include_footer }} diff --git a/docker/mariadb/config-external.sh b/docker/mariadb/config-external.sh new file mode 100644 index 000000000..43447a51c --- /dev/null +++ b/docker/mariadb/config-external.sh @@ -0,0 +1,11 @@ +#!/bin/bash +SOURCE="/opt/kolla/mariadb/galera.cnf" +TARGET="/etc/my.cnf.d/galera.cnf" +OWNER="mysql" + +# Cluster configuration +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0600 $TARGET +fi diff --git a/docker/mariadb/config-galera.sh b/docker/mariadb/config-galera.sh new file mode 100755 index 000000000..cfdd7d9a2 --- /dev/null +++ b/docker/mariadb/config-galera.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +function bootstrap_db { + mysqld_safe --wsrep-new-cluster & + + # Waiting for deamon + sleep 10 + expect -c ' + set timeout 10 + spawn mysql_secure_installation + expect "Enter current password for root (enter for none):" + send "\r" + expect "Set root password?" + send "y\r" + expect "New password:" + send "'"${DB_ROOT_PASSWORD}"'\r" + expect "Re-enter new password:" + send "'"${DB_ROOT_PASSWORD}"'\r" + expect "Remove anonymous users?" + send "y\r" + expect "Disallow root login remotely?" + send "n\r" + expect "Remove test database and access to it?" + send "y\r" + expect "Reload privilege tables now?" + send "y\r" + expect eof' + + mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" + mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;" + mysqladmin -p"${DB_ROOT_PASSWORD}" shutdown +} + +function populate_db { + mysql_install_db --user=mysql +} diff --git a/docker/mariadb/start.sh b/docker/mariadb/start.sh new file mode 100755 index 000000000..986cca733 --- /dev/null +++ b/docker/mariadb/start.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -o errexit + +CMD="/usr/bin/mysqld_safe" +ARGS="" + +# loading common functions +source /opt/kolla/kolla-common.sh + +# Execute config strategy +set_configs + +# loading functions +source /opt/kolla/config/config-galera.sh + +chown mysql: /var/lib/mysql + +# This catches all cases of the BOOTSTRAP variable being set, including empty +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; then + ARGS="--wsrep-new-cluster" + touch /var/lib/mysql/cluster.exists + populate_db + bootstrap_db +fi + +exec $CMD $ARGS -- cgit v1.2.3