diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 448047fb..caaacd8d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,6 @@ +v 2.0.2 - July 21, 2014 + - Remote MySQL Support + v 2.0.1 - July 21, 2014 - Fixed wp-cli installation #289 diff --git a/README.md b/README.md index b534c9a3..14a6d443 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Stories in Ready](https://badge.waffle.io/rtcamp/easyengine.png?label=ready&title=Ready)](https://waffle.io/rtcamp/easyengine) +[![Stories in Progress](https://badge.waffle.io/rtcamp/easyengine.png?label=in%20progress&title=In%20Progress)](https://waffle.io/rtcamp/easyengine) + EasyEngine Logo [![Travis Build Status](https://travis-ci.org/rtCamp/easyengine.svg "Travis Build Status")] (https://travis-ci.org/rtCamp/easyengine) diff --git a/bin/update b/bin/update index bb8accd5..d332bd74 100644 --- a/bin/update +++ b/bin/update @@ -143,7 +143,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then || ee_lib_error "Unable to copy EasyEngine (ee) man page, exit status = " $? - if [[ $EE_CURRENT_VERSION < 2.0.0 ]]; then + if [[ $EE_CURRENT_VERSION < 1.9.0 ]]; then # EasyEngine (ee) config file cp -av /etc/easyengine/ee.conf /etc/easyengine/ee.bak &>> $EE_UPDATE_LOG cp -av /tmp/easyengine/config/easyengine/ee.conf /etc/easyengine/ &>> $EE_UPDATE_LOG \ @@ -155,6 +155,9 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then for ee_include in $(find /usr/local/lib/easyengine/ -iname "*.sh"); do source $ee_include done + + # Avoid re-source and readonly errors + ee_source=1 # Lets modify the $EE_COMMAND_LOG value # So all the logs write in $EE_UPDATE_LOG @@ -382,12 +385,15 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then fi fi - if [[ $EE_CURRENT_VERSION < 2.0.1 ]]; then + if [[ $EE_CURRENT_VERSION > 1.9.0 ]]; then + # Lets re-used our functions # Include library - for ee_include in $(find /usr/local/lib/easyengine/ -iname "*.sh"); do - source $ee_include - done + if [ -z $ee_source ]; then + for ee_include in $(find /usr/local/lib/easyengine/ -iname "*.sh"); do + source $ee_include + done + fi if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then dpkg -l | grep php5-fpm &>> $EE_UPDATE_LOG @@ -399,6 +405,12 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then # Install WP-CLI ee_ven_install_wpcli fi + # Update EasyEngine current version + EE_CURRENT_VERSION="2.0.1" + fi + + if [[ $EE_CURRENT_VERSION = 2.0.1 ]]; then + sed -i 's/host =.*/grant-host = localhost/' /etc/easyengine/ee.conf fi fi diff --git a/config/bash_completion.d/ee b/config/bash_completion.d/ee index a31bbe71..72d723b6 100644 --- a/config/bash_completion.d/ee +++ b/config/bash_completion.d/ee @@ -87,7 +87,7 @@ function EE_AUTO() *) if [ "$PREVIOUS2" = "create" ]; then - COMPREPLY=( $( compgen -W "--html --php --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) + COMPREPLY=( $( compgen -W "--html --php --mysql --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) elif [ "$PREVIOUS2" = "delete" ]; then COMPREPLY=( $( compgen -W "--db --all --files --no-prompt" -- $CURRENT ) ) fi diff --git a/config/easyengine/ee.conf b/config/easyengine/ee.conf index 4b6e9204..d34a2e21 100644 --- a/config/easyengine/ee.conf +++ b/config/easyengine/ee.conf @@ -6,7 +6,7 @@ ip-address = [mysql] - host = localhost + grant-host = localhost db-name = false db-user = false diff --git a/src/lib/ee_lib_mysql_info.sh b/src/lib/ee_lib_mysql_info.sh index 93943df9..0108d6c2 100644 --- a/src/lib/ee_lib_mysql_info.sh +++ b/src/lib/ee_lib_mysql_info.sh @@ -12,8 +12,7 @@ function ee_lib_mysql_info() local ee_mysql_max_used_connections=$(mysql -e "show global status" | grep Max_used_connections | awk '{print($2)}') ee_lib_echo - ee_lib_echo "MySQL ($ee_mysql_version):" - ee_lib_echo_escape "user\t\t\t\t \033[37m$EE_MYSQL_USER" + ee_lib_echo "MySQL ($ee_mysql_version) on $EE_MYSQL_HOST:" ee_lib_echo_escape "port\t\t\t\t \033[37m$ee_mysql_port" ee_lib_echo_escape "wait_timeout\t\t\t \033[37m$ee_mysql_wait_timeout" ee_lib_echo_escape "interactive_timeout\t\t \033[37m$ee_mysql_interactive_timeout" diff --git a/src/lib/ee_lib_variables.sh b/src/lib/ee_lib_variables.sh index ed5cc394..cb2ee37a 100644 --- a/src/lib/ee_lib_variables.sh +++ b/src/lib/ee_lib_variables.sh @@ -1,7 +1,7 @@ # Define global variables # EasyEngine version -readonly EE_VERSION='2.0.1' +readonly EE_VERSION='2.0.2' # WP-CLI version readonly EE_WP_CLI_VERSION='0.16.0' @@ -39,17 +39,15 @@ else fi # Find out MySQL hostname -if [ -z $($EE_CONFIG_GET mysql.host) ]; then +if [ -z $(git config --file $HOME/.my.cnf client.host) ]; then readonly EE_MYSQL_HOST=localhost else - readonly EE_MYSQL_HOST=$($EE_CONFIG_GET mysql.host) + readonly EE_MYSQL_HOST=$(git config --file $HOME/.my.cnf client.host) fi -# Find out MySQL login -if [ -f ~/.my.cnf ];then - readonly EE_MYSQL_USER=$(cat ~/.my.cnf | grep user | cut -d'=' -f2) - readonly EE_MYSQL_PASS=$(cat ~/.my.cnf | grep pass | cut -d'=' -f2 | sed -e 's/^"//' -e 's/"$//') -elif [ -f /root/.my.cnf ];then - readonly EE_MYSQL_USER=$(cat /root/.my.cnf | grep user | cut -d'=' -f2) - readonly EE_MYSQL_PASS=$(cat /root/.my.cnf | grep pass | cut -d'=' -f2 | sed -e 's/^"//' -e 's/"$//') +# Find out MySQL client-host to setup grants +if [ -z $($EE_CONFIG_GET mysql.grant-host) ]; then + readonly EE_MYSQL_GRANT_HOST=localhost +else + readonly EE_MYSQL_GRANT_HOST=$($EE_CONFIG_GET mysql.grant-host) fi diff --git a/src/modules/site/create/ee_mod_setup_database.sh b/src/modules/site/create/ee_mod_setup_database.sh index 30d7d339..a8c53d2b 100644 --- a/src/modules/site/create/ee_mod_setup_database.sh +++ b/src/modules/site/create/ee_mod_setup_database.sh @@ -51,16 +51,16 @@ function ee_mod_setup_database() fi # Create MySQL database - echo -e "EE_DB_NAME = $EE_DB_NAME \nEE_DB_USER = $EE_DB_USER \nEE_DB_PASS = $EE_DB_PASS" &>> $EE_COMMAND_LOG + echo -e "EE_DB_NAME = $EE_DB_NAME \nEE_DB_USER = $EE_DB_USER \nEE_DB_PASS = $EE_DB_PASS \nEE_MYSQL_HOST = $EE_MYSQL_HOST \nEE_MYSQL_GRANT_HOST = $EE_MYSQL_GRANT_HOST" &>> $EE_COMMAND_LOG mysql -e "create database \`$EE_DB_NAME\`" \ || ee_lib_error "Unable to create $EE_DB_NAME database, exit status = " $? # Create MySQL User - mysql -e "create user '$EE_DB_USER'@'$EE_MYSQL_HOST' identified by '$EE_DB_PASS'" \ + mysql -e "create user '$EE_DB_USER'@'$EE_MYSQL_GRANT_HOST' identified by '$EE_DB_PASS'" \ || ee_lib_error "Unable to create $EE_DB_USER database user, exit status = " $? # Grant permission - mysql -e "grant all privileges on \`$EE_DB_NAME\`.* to '$EE_DB_USER'@'$EE_MYSQL_HOST'" \ + mysql -e "grant all privileges on \`$EE_DB_NAME\`.* to '$EE_DB_USER'@'$EE_MYSQL_GRANT_HOST'" \ || ee_lib_error "Unable to grant privileges for $EE_DB_USER database user, exit status = " $? mysql -e "flush privileges" }