Skip to content

Commit

Permalink
rename MYSQL_DB to MYSQL_DATABASE- issue #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Boran committed Jan 8, 2015
1 parent b46c5d1 commit ca19bd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
14 changes: 7 additions & 7 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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`
Expand All @@ -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
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ca19bd8

Please sign in to comment.