From 508cdf8d675ef13e9309df9835c6c3f9794b1cde Mon Sep 17 00:00:00 2001 From: Adnan Abdulhussein Date: Tue, 2 Jun 2015 14:16:08 -0700 Subject: [PATCH] Update mariadb with new installer option and password notice --- bitnami/mariadb/Dockerfile | 5 ++++- bitnami/mariadb/entrypoint.sh | 36 +++++++++++++++++++++++++++------ bitnami/mariadb/post-install.sh | 3 --- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/bitnami/mariadb/Dockerfile b/bitnami/mariadb/Dockerfile index 36c45e5b662d..1d9066ccfb11 100644 --- a/bitnami/mariadb/Dockerfile +++ b/bitnami/mariadb/Dockerfile @@ -11,7 +11,10 @@ COPY post-install.sh /tmp/post-install.sh # We need to specify a mysql password since the installer initializes the database, but it is # removed in the post install and re-initialized at runtime. RUN sh /tmp/install.sh\ - --base_password bitnami --mysql_password bitnami --mysql_allow_all_remote_connections 1 --disable-components common + --base_password bitnami --mysql_password bitnami --mysql_allow_all_remote_connections 1 --disable-components common --mysql_init_data_dir 0 + +# Temporary, should be removed from installer +RUN rm -rf /usr/local/bitnami/mysql/data ENV PATH /usr/local/bitnami/mysql/bin:$PATH EXPOSE 3306 diff --git a/bitnami/mariadb/entrypoint.sh b/bitnami/mariadb/entrypoint.sh index fb98a7548ec4..1f02758f0902 100755 --- a/bitnami/mariadb/entrypoint.sh +++ b/bitnami/mariadb/entrypoint.sh @@ -15,17 +15,16 @@ fi if [ "$1" = 'mysqld.bin' ]; then set -- "$@" --defaults-file=/usr/local/bitnami/mysql/my.cnf --log-error=/usr/local/bitnami/mysql/logs/mysqld.log --basedir=/usr/local/bitnami/mysql --datadir=/usr/local/bitnami/mysql/data --plugin-dir=/usr/local/bitnami/mysql/lib/plugin --user=mysql --socket=/usr/local/bitnami/mysql/tmp/mysql.sock "--lower-case-table-names=1" $EXTRA_OPTIONS + mkdir -p /usr/local/bitnami/mysql/tmp + chown -R mysql:mysql /usr/local/bitnami/mysql/tmp + if [ ! "$(ls -A /data)" ]; then if [ -z "$MYSQL_PASSWORD" ]; then MYSQL_PASSWORD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12) + RANDOM_PASSW=1 fi - echo "#########################################################################" - echo "# #" - echo "# Setting MySQL root password to '${MYSQL_PASSWORD}' #" - echo "# #" - echo "#########################################################################" - echo "" + echo "Initializing MySQL database..." echo "" @@ -41,6 +40,31 @@ if [ "$1" = 'mysqld.bin' ]; then fi set -- "$@" --init-file=/tmp/init_mysql.sql + + echo "#########################################################################" + echo "# #" + echo "# Credentials for mariadb: #" + echo "# username: root #" + echo "# password: $MYSQL_PASSWORD #" + echo "# #" + + if [ $RANDOM_PASSW ]; then + echo "# The password was generated automatically, if you want to use #" + echo "# your own password please set the MYSQL_PASSWORD environment #" + echo "# variable when running the container. #" + echo "# #" + fi + echo "#########################################################################" + echo "" + else + echo "#########################################################################" + echo "# #" + echo "# Credentials for mariadb: #" + echo "# The MYSQL_PASSWORD was set on first boot. #" + echo "# If you want to regenerate the password recreate this container. #" + echo "# #" + echo "#########################################################################" + echo "" fi chown -R mysql:mysql /usr/local/bitnami/mysql/logs diff --git a/bitnami/mariadb/post-install.sh b/bitnami/mariadb/post-install.sh index ecb2f595f34a..1e828d3d8bd8 100644 --- a/bitnami/mariadb/post-install.sh +++ b/bitnami/mariadb/post-install.sh @@ -3,9 +3,6 @@ INSTALL_DIR=$1 cd $INSTALL_DIR -# remove unneeded files -rm -rf data scripts/myscript.sh scripts/myscript-upgrade.sh - # set up logging to stdout mkdir logs ln -s /dev/stdout logs/mysqld.log