From ca19bd840d2076406bcf2c48074b92e1102781bf Mon Sep 17 00:00:00 2001 From: Sean Boran Date: Thu, 8 Jan 2015 07:17:02 +0100 Subject: [PATCH] rename MYSQL_DB to MYSQL_DATABASE- issue #2 --- README.md | 4 ++-- start.sh | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6ef73ca..f32283e 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Environment parameters, defaults are as follows, commented vales are not set by Optional mysql: # MYSQL_HOST is set, mysql will not be installed in the container - # MYSQL_DB MYSQL_USER DRUPAL_PASSWORD + # MYSQL_DATABASE MYSQL_USER MYSQL_PASSWORD Optional mysql+drupal # DRUPAL_NONE (if set, mysql/drupal will not be installed) @@ -89,7 +89,7 @@ Download drupal+website on the master branch from a git repo via ssh with keys. # External database: MYSQL_HOST If MYSQL_HOST is set, mysql will not be installed in the container. -In this case create the DB first on your server and set the environment variables MYSQL_DB MYSQL_USER DRUPAL_PASSWORD in addition to MYSQL_HOST. +In this case create the DB first on your server and set the environment variables MYSQL_DATABASE MYSQL_USER DRUPAL_PASSWORD in addition to MYSQL_HOST. # No website: DRUPAL_NONE diff --git a/start.sh b/start.sh index 412488e..9691feb 100644 --- a/start.sh +++ b/start.sh @@ -19,12 +19,12 @@ if [ ! -f $www/sites/default/settings.php -a ! -f /drupal-db-pw.txt ]; then if [[ ${MYSQL_HOST} ]]; then # A mysql server has been specified, do not activate locally - if [[ ${MYSQL_DB} ]] && [[ ${MYSQL_USER} ]]; then - echo "Using mysql server:$MYSQL_HOST db:$MYSQL_DB user:$MYSQL_USER (presuming DB already created)" + if [[ ${MYSQL_DATABASE} ]] && [[ ${MYSQL_USER} ]]; then + echo "Using mysql server:$MYSQL_HOST db:$MYSQL_DATABASE user:$MYSQL_USER (presuming DB already created)" echo "disabling local mysql: mv /etc/supervisord.d/mysql.conf /etc/supervisord.d/.mysql.conf" mv /etc/supervisord.d/mysql.conf /etc/supervisord.d/.mysql.conf else - echo "ERROR: Mysql spec incomplete: server:$MYSQL_HOST db:$MYSQL_DB user:$MYSQL_USER " + echo "ERROR: Mysql spec incomplete: server:$MYSQL_HOST db:$MYSQL_DATABASE user:$MYSQL_USER " exit; fi @@ -41,7 +41,7 @@ if [ ! -f $www/sites/default/settings.php -a ! -f /drupal-db-pw.txt ]; then sleep 5s MYSQL_HOST="localhost" MYSQL_USER="drupal" - MYSQL_DB="drupal" + MYSQL_DATABASE="drupal" # Generate random passwords MYSQL_ROOT_PASSWORD=`pwgen -c -n -1 12` MYSQL_PASSWORD=`pwgen -c -n -1 12` @@ -51,8 +51,8 @@ if [ ! -f $www/sites/default/settings.php -a ! -f /drupal-db-pw.txt ]; then echo $MYSQL_PASSWORD > /drupal-db-pw.txt echo $MYSQL_ROOT_PASSWORD > /mysql-root-pw.txt mysqladmin -u root password $MYSQL_ROOT_PASSWORD - #echo "CREATE DATABASE $MYSQL_DB; GRANT ALL PRIVILEGES ON ${MYSQL_DB}.* TO $MYSQL_USER@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD'; FLUSH PRIVILEGES;" - mysql -uroot -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE $MYSQL_DB; GRANT ALL PRIVILEGES ON ${MYSQL_DB}.* TO $MYSQL_USER@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD'; FLUSH PRIVILEGES;" + #echo "CREATE DATABASE $MYSQL_DATABASE; GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO $MYSQL_USER@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD'; FLUSH PRIVILEGES;" + mysql -uroot -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE $MYSQL_DATABASE; GRANT ALL PRIVILEGES ON ${MYSQL_DATABASE}.* TO $MYSQL_USER@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD'; FLUSH PRIVILEGES;" # allow mysql cli for root mv /root/.my.cnf.sample /root/.my.cnf sed -i "s/ADDED_BY_START.SH/$MYSQL_ROOT_PASSWORD/" /root/.my.cnf @@ -136,7 +136,7 @@ if [ ! -f $www/sites/default/settings.php -a ! -f /drupal-db-pw.txt ]; then echo "-- Installing Drupal with profile ${DRUPAL_INSTALL_PROFILE} site-name=${DRUPAL_SITE_NAME} " #drush site-install standard -y --account-name=admin --account-pass=admin --db-url="mysqli://drupal:${MYSQL_PASSWORD}@localhost:3306/drupal" #echo drush site-install ${DRUPAL_INSTALL_PROFILE} -y --account-name=${DRUPAL_ADMIN} --account-pass=HIDDEN --account-mail="${DRUPAL_ADMIN_EMAIL}" --site-name="${DRUPAL_SITE_NAME}" --site-mail="${DRUPAL_SITE_EMAIL}" --db-url="mysqli://drupal:HIDDEN@localhost:3306/drupal" - drush site-install ${DRUPAL_INSTALL_PROFILE} -y --account-name=${DRUPAL_ADMIN} --account-pass="${DRUPAL_ADMIN_PW}" --account-mail="${DRUPAL_ADMIN_EMAIL}" --site-name="${DRUPAL_SITE_NAME}" --site-mail="${DRUPAL_SITE_EMAIL}" --db-url="mysqli://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:3306/${MYSQL_DB}" + drush site-install ${DRUPAL_INSTALL_PROFILE} -y --account-name=${DRUPAL_ADMIN} --account-pass="${DRUPAL_ADMIN_PW}" --account-mail="${DRUPAL_ADMIN_EMAIL}" --site-name="${DRUPAL_SITE_NAME}" --site-mail="${DRUPAL_SITE_EMAIL}" --db-url="mysqli://${MYSQL_USER}:${MYSQL_PASSWORD}@${MYSQL_HOST}:3306/${MYSQL_DATABASE}" if [[ $? -ne 0 ]]; then echo "ERROR: drush site-install failed"; exit;