Browse Source

Merge branch 'master' into next

old-stable
harshadyeola 10 years ago
parent
commit
b5d6ddaf97
  1. 2
      .travis.yml
  2. 65
      bin/easyengine
  3. 39
      bin/install
  4. 73
      bin/update
  5. 2
      config/bash_completion.d/ee
  6. 45
      src/lib/ee_lib_ram.sh
  7. 2
      src/lib/ee_lib_variables.sh
  8. 6
      src/modules/debug/ee_mod_debug_mysql.sh
  9. 5
      src/modules/debug/ee_mod_debug_wp.sh
  10. 2
      src/modules/stack/install/ee_mod_install_php.sh
  11. 1
      src/modules/stack/install/ee_mod_setup_mysql.sh
  12. 5
      src/modules/stack/install/ee_mod_setup_php.sh
  13. 2
      src/modules/stack/install/mail/ee_mod_install_mailscaner.sh
  14. 13
      src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh
  15. 2
      src/modules/stack/install/mail/ee_mod_setup_sieve.sh
  16. 2
      src/modules/stack/remove/ee_mod_remove_php.sh
  17. 9
      src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh
  18. 18
      src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh
  19. 13
      src/vendor/ee_ven_install_utils.sh
  20. 22
      src/vendor/ee_ven_install_wpcli.sh
  21. 6
      src/vendor/ee_ven_setup_vimbadmin.sh

2
.travis.yml

@ -128,7 +128,7 @@ script:
- sudo bash ee stack install mail - sudo bash ee stack install mail
- sudo cat /var/log/easyengine/* - sudo bash -c 'cat /var/log/easyengine/*'
- sudo ls /var/www/ - sudo ls /var/www/

65
bin/easyengine

@ -45,6 +45,8 @@ elif [ "$EE_FIRST" = "info" ];then
elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
# EasyEngine install # EasyEngine install
if [ "$EE_SECOND" = "install" ]; then if [ "$EE_SECOND" = "install" ]; then
# Detect RAM of system and initialize the variables.
ee_lib_ram
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ] || [ "$EE_THIRD" = "postfix" ] || [ "$EE_THIRD" = "adminer" ] || [ "$EE_THIRD" = "phpmyadmin" ] || [ "$EE_THIRD" = "wpcli" ] || [ "$EE_THIRD" = "utils" ]; then if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ] || [ "$EE_THIRD" = "postfix" ] || [ "$EE_THIRD" = "adminer" ] || [ "$EE_THIRD" = "phpmyadmin" ] || [ "$EE_THIRD" = "wpcli" ] || [ "$EE_THIRD" = "utils" ]; then
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ]; then if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ]; then
# Setup NGINX/PHP repository # Setup NGINX/PHP repository
@ -146,14 +148,15 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null
if [ $? -eq 0 ];then if [ $? -eq 0 ];then
ee_lib_error "Found installed Dovecot Packages server, exit status=" 1 ee_lib_error "Found installed Dovecot Packages, exit status=" 1
fi fi
# Check hostname is FQDN or not, if not asks user to set hostname as FQDN
ee_lib_check_fqdn $(hostname -f)
# Install Dovecot # Install Dovecot
ee_mod_install_dovecot ee_mod_install_dovecot
# Install mail scanner packages
ee_mod_install_mailscan
# Install ViMbAdmin # Install ViMbAdmin
ee_ven_install_vimbadmin ee_ven_install_vimbadmin
@ -167,9 +170,6 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
# Configure Dovecot # Configure Dovecot
ee_mod_setup_dovecot ee_mod_setup_dovecot
# Setup Amavis
ee_mod_setup_mailscan
# Setup ViMbAdmin # Setup ViMbAdmin
ee_ven_setup_vimbadmin ee_ven_setup_vimbadmin
@ -179,6 +179,16 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
# Setup Sieve Rules # Setup Sieve Rules
ee_mod_setup_sieve ee_mod_setup_sieve
if [ "$EE_SETUP_MAILSCANNER" != "no" ]; then
# Install mail scanner packages
ee_mod_install_mailscaner
# Setup Amavis
ee_mod_setup_mailscaner
else
ee_lib_echo_fail "RAM is less then 512MB, EasyEngine skip installing Mail Scanner Packages"
fi
ee_lib_service nginx postfix dovecot amavis restart ee_lib_service nginx postfix dovecot amavis restart
ee_lib_git /etc/nginx /etc/postfix /etc/dovecot /etc/amavis "Initialize Git" ee_lib_git /etc/nginx /etc/postfix /etc/dovecot /etc/amavis "Initialize Git"
@ -188,6 +198,23 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
ee_lib_echo_escape "Security Salt:\t\t${ee_security_salt}\n" ee_lib_echo_escape "Security Salt:\t\t${ee_security_salt}\n"
ee_lib_echo "Successfully installed mail server packages" ee_lib_echo "Successfully installed mail server packages"
elif [ "$EE_THIRD" = "mailscanner" ]; then
dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null
if [ $? -ne 0 ];then
ee_lib_error "Failed to find Dovecot Packages, exit status = " 1
fi
# Install Mail Scanner
ee_mod_install_mailscaner
# Setup Mail Scanner
ee_mod_setup_mailscaner
ee_lib_service nginx postfix dovecot amavis restart
ee_lib_git /etc/nginx /etc/postfix /etc/dovecot /etc/amavis "Installed Mail Scanner"
ee_lib_echo "Successfully installed mail scanner packages"
fi fi
# EasyEngine remove/purge # EasyEngine remove/purge
@ -240,8 +267,8 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
# Remove Dovecot # Remove Dovecot
ee_mod_remove_dovecot ee_mod_remove_dovecot
# Remove Amavis # Remove Mail Scanner
ee_mod_remove_mailscan ee_mod_remove_mailscaner
# Remove ViMbAdmin # Remove ViMbAdmin
ee_ven_remove_vimbadmin ee_ven_remove_vimbadmin
@ -252,12 +279,34 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
# Execute: apt-get autoremove # Execute: apt-get autoremove
ee_lib_autoremove ee_lib_autoremove
# Restart Nginx
ee_lib_service nginx
ee_lib_git /etc/nginx "Removed Mail Server"
# Display success message # Display success message
if [ "$EE_SECOND" = "remove" ];then if [ "$EE_SECOND" = "remove" ];then
ee_lib_echo "Successfully removed mail server packages" ee_lib_echo "Successfully removed mail server packages"
elif [ "$EE_SECOND" = "purge" ];then elif [ "$EE_SECOND" = "purge" ];then
ee_lib_echo "Successfully purged mail server packages" ee_lib_echo "Successfully purged mail server packages"
fi fi
elif [ "$EE_THIRD" = "mailscanner" ]; then
# Remove Amavis
ee_mod_remove_mailscaner
# Execute: apt-get autoremove
ee_lib_autoremove
ee_lib_service nginx postfix dovecot restart
ee_lib_git /etc/postfix "Removed mailscanner"
# Display success message
if [ "$EE_SECOND" = "remove" ];then
ee_lib_echo "Successfully removed Mail Scanner packages"
elif [ "$EE_SECOND" = "purge" ];then
ee_lib_echo "Successfully purged Mail Scanner packages"
fi
fi fi
elif [ "$EE_SECOND" = "status" ]; then elif [ "$EE_SECOND" = "status" ]; then

39
bin/install

@ -82,38 +82,20 @@ function ee_lib_package_check()
done done
} }
# Check hostname is FQDN or not. If not set it
function ee_lib_check_fqdn()
{
case $1 in
*.*)
if [ "$EE_FQDN" != "" ];then
echo $EE_FQDN > /etc/hostname
if [ "$EE_LINUX_DISTRO" == "Debian" ];then
grep $EE_FQDN /etc/hosts &>> $EE_INSTALL_LOG
if [ $? -ne 0 ]; then
sed -i "1i\127.0.0.1 $EE_FQDN" /etc/hosts \
|| ee_lib_error "Unable setup hostname = " $?
fi
/etc/init.d/hostname.sh start &>> $EE_INSTALL_LOG
else
service hostname restart &>> $EE_INSTALL_LOG
fi
echo "hostname = $(hostname -f)" &>> $EE_INSTALL_LOG
fi
;;
*)
read -p "Enter hostname [FQDN]: " EE_FQDN
ee_lib_check_fqdn $EE_FQDN
;;
esac
}
# Pre checks to avoid later screw ups # Pre checks to avoid later screw ups
# Checking EasyEngine (ee) log directory # Checking EasyEngine (ee) log directory
if [ ! -d $EE_LOG_DIR ]; then if [ ! -d $EE_LOG_DIR ]; then
ee_lib_echo "Creating EasyEngine (ee) log directory, please wait..." ee_lib_echo "Creating EasyEngine (ee) log directory, please wait..."
mkdir -p $EE_LOG_DIR || ee_lib_error "Unable to create log directory $EE_LOG_DIR, exit status = " $? mkdir -p $EE_LOG_DIR || ee_lib_error "Unable to create log directory $EE_LOG_DIR, exit status = " $?
# Create EasyEngine log files
touch /var/log/easyengine/ee.log /var/log/easyengine/install.log /var/log/easyengine/update.log /var/log/easyengine/error.log \
|| ee_lib_error "Unable to create EasyEngine log files in $EE_LOG_DIR, exit status = " $?
# Keep EasyEngine log folder accessible to root only
chmod -R 700 /var/log/easyengine \
|| ee_lib_error "Unable to change permissions for EasyEngine log folder, exit status = " $?
fi fi
# Install required packages # Install required packages
@ -211,9 +193,6 @@ fi
cp -a /tmp/easyengine/docs/man/ee.8 /usr/share/man/man8/ &>> $EE_INSTALL_LOG \ cp -a /tmp/easyengine/docs/man/ee.8 /usr/share/man/man8/ &>> $EE_INSTALL_LOG \
|| ee_lib_error "Unable to copy EasyEngine (ee) man page, exit status = " $? || ee_lib_error "Unable to copy EasyEngine (ee) man page, exit status = " $?
# Make hostname as FQDN
ee_lib_check_fqdn $(hostname -f)
# Git config settings # Git config settings
GIT_USER_NAME=$(git config user.name) GIT_USER_NAME=$(git config user.name)
GIT_USER_EMAIL=$(git config user.email) GIT_USER_EMAIL=$(git config user.email)

73
bin/update

@ -363,8 +363,8 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
fi fi
# Update NGINX # Update NGINX
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then
nginx -v 2>&1 | grep 1.6.0 &>> $EE_UPDATE_LOG ls /etc/apt/sources.list.d/brianmercer-nginx* &>> $EE_UPDATE_LOG
if [ $? -ne 0 ]; then if [ $? -eq 0 ]; then
rm /etc/apt/sources.list.d/brianmercer-nginx* rm /etc/apt/sources.list.d/brianmercer-nginx*
# Add rtCamp nginx launchpad repository # Add rtCamp nginx launchpad repository
ee_lib_echo "Adding rtCamp NGINX launchpad repository, please wait..." ee_lib_echo "Adding rtCamp NGINX launchpad repository, please wait..."
@ -395,55 +395,44 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
done done
fi fi
# Make hostname as FQDN if [[ $EE_CURRENT_VERSION = 2.0.0 ]] || [[ $EE_CURRENT_VERSION = 2.0.1 ]]; then
ee_lib_check_fqdn $(hostname -f) sed -i 's/host =.*/grant-host = localhost/' /etc/easyengine/ee.conf
if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then # Add Vimbadmin rules
dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG if [ -f /etc/nginx/sites-available/22222 ];then
if [ $? -eq 0 ]; then ee_port=$(grep listen /etc/nginx/sites-available/22222 | awk '{ print $2 }')
cp -av /usr/share/easyengine/nginx/22222 /etc/nginx/sites-available/ &>> $EE_UPDATE_LOG
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then
sed -i "s/listen.*/listen $ee_port default_server ssl spdy;/" /etc/nginx/sites-available/22222 \
|| ee_lib_error "Unable to change EasyEngine admin port, exit status = " $?
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then
# Dotdeb nginx repository doesn't support spdy
sed -i "s/listen.*/listen $ee_port default_server ssl;/" /etc/nginx/sites-available/22222 \
|| ee_lib_error "Unable to change EasyEngine admin port, exit status = " $?
fi
fi
# WP-CLI change the installation method if [ -d /var/www/22222/htdocs/db/anemometer ];then
rm -rf /usr/share/easyengine/wp-cli /usr/share/wp-cli /usr/bin/wp /etc/bash_completion.d/wp-completion.bash # Download pt-query-advisor Fixed #189
wget -q http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/2.1/download/head:/ptquerydigest-20110624220137-or26tn4expb9ul2a-16/pt-query-digest -O /usr/bin/pt-query-advisor \
|| ee_lib_error "Unable to copy download pt-query-advisor, exit status = " $?
chmod 0755 /usr/bin/pt-query-advisor
# Install WP-CLI # Enable pt-query-advisor plugin in Anemometer
ee_ven_install_wpcli sed -i "s/# 'query_advisor'/ 'query_advisor'/" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \
|| ee_lib_error "Unable to to activate pt-query-advisor plugin, exit status = " $?
fi fi
# Update EasyEngine current version # Update EasyEngine current version
EE_CURRENT_VERSION="2.0.1" EE_CURRENT_VERSION="2.1.0"
fi fi
if [[ $EE_CURRENT_VERSION = 2.0.1 ]]; then # if [[ $EE_CURRENT_VERSION = 2.1.0 ]]; then
sed -i 's/host =.*/grant-host = localhost/' /etc/easyengine/ee.conf # fi
fi
fi fi
if [[ $EE_CURRENT_VERSION < 2.1.0 ]];then # Update WP-CLI
if [ -f /etc/nginx/sites-available/22222 ];then ee_ven_install_wpcli
ee_port=$(grep listen /etc/nginx/sites-available/22222 | awk '{ print $2 }')
cp -av /usr/share/easyengine/nginx/22222 /etc/nginx/sites-available/ &>> $EE_UPDATE_LOG
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then
sed -i "s/listen.*/listen $ee_port default_server ssl spdy;/" /etc/nginx/sites-available/22222 \
|| ee_lib_error "Unable to change EasyEngine admin port, exit status = " $?
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then
# Dotdeb nginx repository doesn't support spdy
sed -i "s/listen.*/listen $ee_port default_server ssl;/" /etc/nginx/sites-available/22222 \
|| ee_lib_error "Unable to change EasyEngine admin port, exit status = " $?
fi
fi
if [ -d /var/www/22222/htdocs/db/anemometer ];then
# Download pt-query-advisor Fixed #189
wget -q http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/2.1/download/head:/ptquerydigest-20110624220137-or26tn4expb9ul2a-16/pt-query-digest -O /usr/bin/pt-query-advisor \
|| ee_lib_error "Unable to copy download pt-query-advisor, exit status = " $?
chmod 0755 /usr/bin/pt-query-advisor
# Enable pt-query-advisor plugin in Anemometer
sed -i "s/# 'query_advisor'/ 'query_advisor'/" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \
|| ee_lib_error "Unable to to activate pt-query-advisor plugin, exit status = " $?
fi
# Update EasyEngine current version
EE_CURRENT_VERSION="2.1.0"
fi
# Restart service # Restart service
ee_lib_service nginx php5-fpm restart ee_lib_service nginx php5-fpm restart

2
config/bash_completion.d/ee

@ -25,7 +25,7 @@ function EE_AUTO()
;; ;;
install|remove|purge) install|remove|purge)
COMPREPLY=( $( compgen -W '$(echo mail all web; cd /usr/local/lib/easyengine/modules/stack/install; find -maxdepth 1 -type f | grep install | cut -d'_' -f4 | cut -d '.' -f1 2> /dev/null; cd /usr/local/lib/easyengine/vendor/; find -type f | grep install | cut -d'_' -f4 | cut -d '.' -f1 2> /dev/null | egrep -v "roundcube|vimbadmin" )' -- $CURRENT ) ) COMPREPLY=( $( compgen -W '$(echo mail all web mailscanner; cd /usr/local/lib/easyengine/modules/stack/install; find -maxdepth 1 -type f | grep install | cut -d'_' -f4 | cut -d '.' -f1 2> /dev/null; cd /usr/local/lib/easyengine/vendor/; find -type f | grep install | cut -d'_' -f4 | cut -d '.' -f1 2> /dev/null | egrep -v "roundcube|vimbadmin" )' -- $CURRENT ) )
return 0 return 0
;; ;;

45
src/lib/ee_lib_ram.sh

@ -0,0 +1,45 @@
# EasyEngine RAM based settings
function ee_lib_ram()
{
# Detect RAM of System
readonly EE_TOTAL_RAM=$(free -m | grep -i Mem | awk '{ print $2 }')
# RAM < 512MB
if [ $EE_TOTAL_RAM -le 512 ]; then
EE_OPCACHE_SIZE="64"
EE_MEMCACHE_SIZE="64"
EE_PHP_MAX_CHILDREN="10"
EE_SETUP_MAILSCANNER="no"
# RAM > 512MB and RAM < 1024MB
elif [ $EE_TOTAL_RAM -gt 512 ] && [ $EE_TOTAL_RAM -le 1024 ]; then
EE_OPCACHE_SIZE="128"
EE_MEMCACHE_SIZE="128"
EE_PHP_MAX_CHILDREN="10"
# RAM > 1024MB and RAM < 2048MB
elif [ $EE_TOTAL_RAM -gt 1024 ] && [ $EE_TOTAL_RAM -le 2048 ]; then
EE_OPCACHE_SIZE="256"
EE_MEMCACHE_SIZE="256"
EE_PHP_MAX_CHILDREN="20"
# RAM > 2048MB and RAM < 4096MB
elif [ $EE_TOTAL_RAM -gt 2048 ] && [ $EE_TOTAL_RAM -le 4096 ]; then
EE_OPCACHE_SIZE="512"
EE_MEMCACHE_SIZE="512"
EE_PHP_MAX_CHILDREN="40"
# RAM > 4096MB and RAM < 8192MB
elif [ $EE_TOTAL_RAM -gt 4096 ] && [ $EE_TOTAL_RAM -le 8192 ]; then
EE_OPCACHE_SIZE="512"
EE_MEMCACHE_SIZE="1024"
EE_PHP_MAX_CHILDREN="80"
# RAM > 8192MB and RAM < 16384MB
elif [ $EE_TOTAL_RAM -gt 8192 ] && [ $EE_TOTAL_RAM -le 16384 ]; then
EE_OPCACHE_SIZE="512"
EE_MEMCACHE_SIZE="2048"
EE_PHP_MAX_CHILDREN="100"
# RAM > 16384MB
elif [ $EE_TOTAL_RAM -gt 16384 ]; then
EE_OPCACHE_SIZE="512"
EE_MEMCACHE_SIZE="2048"
EE_PHP_MAX_CHILDREN="100"
fi
}

2
src/lib/ee_lib_variables.sh

@ -4,7 +4,7 @@
readonly EE_VERSION='2.1.0' readonly EE_VERSION='2.1.0'
# WP-CLI version # WP-CLI version
readonly EE_WP_CLI_VERSION='0.16.0' readonly EE_WP_CLI_VERSION='0.17.0'
# Adminer version # Adminer version
readonly EE_ADMINER_VERSION='4.1.0' readonly EE_ADMINER_VERSION='4.1.0'

6
src/modules/debug/ee_mod_debug_mysql.sh

@ -10,7 +10,7 @@ function ee_mod_debug_mysql()
mysql -e "set global slow_query_log = 'ON';" \ mysql -e "set global slow_query_log = 'ON';" \
|| ee_lib_error "Unable to setup slow_query_log, exit status = " $? || ee_lib_error "Unable to setup slow_query_log, exit status = " $?
mysql -e "set global slow_query_log_file = '/var/log/mysql/slow.log';" \ mysql -e "set global slow_query_log_file = '/var/log/mysql/mysql-slow.log';" \
|| ee_lib_error "Unable to setup slow_query_log_file, exit status = " $? || ee_lib_error "Unable to setup slow_query_log_file, exit status = " $?
mysql -e "set global long_query_time = 2;" \ mysql -e "set global long_query_time = 2;" \
@ -24,7 +24,7 @@ function ee_mod_debug_mysql()
fi fi
# Debug message # Debug message
EE_DEBUG_MSG="$EE_DEBUG_MSG /var/log/mysql/slow.log" EE_DEBUG_MSG="$EE_DEBUG_MSG /var/log/mysql/mysql-slow.log"
elif [ "$EE_DEBUG" = "--stop" ]; then elif [ "$EE_DEBUG" = "--stop" ]; then
mysql -e "show variables like 'slow_query_log';" | grep ON &>> $EE_COMMAND_LOG mysql -e "show variables like 'slow_query_log';" | grep ON &>> $EE_COMMAND_LOG
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@ -33,7 +33,7 @@ function ee_mod_debug_mysql()
mysql -e "set global slow_query_log = 'OFF';" \ mysql -e "set global slow_query_log = 'OFF';" \
|| ee_lib_error "Unable to setup slow_query_log, exit status = " $? || ee_lib_error "Unable to setup slow_query_log, exit status = " $?
mysql -e "set global slow_query_log_file = '/var/log/mysql/slow.log';" \ mysql -e "set global slow_query_log_file = '/var/log/mysql/mysql-slow.log';" \
|| ee_lib_error "Unable to setup slow_query_log_file, exit status = " $? || ee_lib_error "Unable to setup slow_query_log_file, exit status = " $?
mysql -e "set global long_query_time = 10;" \ mysql -e "set global long_query_time = 10;" \

5
src/modules/debug/ee_mod_debug_wp.sh

@ -21,6 +21,11 @@ function ee_mod_debug_wp()
cd /var/www/$EE_DOMAIN/htdocs/ && \ cd /var/www/$EE_DOMAIN/htdocs/ && \
wp plugin --allow-root install developer &>> $EE_COMMAND_LOG \ wp plugin --allow-root install developer &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to install developer plugin, exit status = " $? || ee_lib_error "Unable to install developer plugin, exit status = " $?
# Fix Developer plugin permissions
chown -R $EE_PHP_USER:$EE_PHP_USER /var/www/$EE_DOMAIN/htdocs/wp-content/plugins/developer \
|| ee_lib_error "Unable to change ownership for developer plugin, exit status = " $?
else else
# Display message # Display message
ee_lib_echo "WordPress debug log already enabled for $EE_DOMAIN" ee_lib_echo "WordPress debug log already enabled for $EE_DOMAIN"

2
src/modules/stack/install/ee_mod_install_php.sh

@ -5,5 +5,5 @@ function ee_mod_install_php()
ee_lib_echo "Installing PHP, please wait..." ee_lib_echo "Installing PHP, please wait..."
$EE_APT_GET install php5-common php5-mysqlnd php5-xmlrpc \ $EE_APT_GET install php5-common php5-mysqlnd php5-xmlrpc \
php5-curl php5-gd php5-cli php5-fpm php5-imap php5-mcrypt php5-xdebug \ php5-curl php5-gd php5-cli php5-fpm php5-imap php5-mcrypt php5-xdebug \
php5-memcache memcached || ee_lib_error "Unable to install PHP5, exit status = " $? php5-memcache memcached php5-geoip || ee_lib_error "Unable to install PHP5, exit status = " $?
} }

1
src/modules/stack/install/ee_mod_setup_mysql.sh

@ -8,6 +8,5 @@ function ee_mod_setup_mysql()
grep "_timeout" /etc/mysql/my.cnf &>> $EE_COMMAND_LOG grep "_timeout" /etc/mysql/my.cnf &>> $EE_COMMAND_LOG
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
sed -i "/#max_connections/a wait_timeout = 30 \ninteractive_timeout = 60" /etc/mysql/my.cnf sed -i "/#max_connections/a wait_timeout = 30 \ninteractive_timeout = 60" /etc/mysql/my.cnf
sed -i "/\[mysqldump\]/i slow_query_log_file = /var/log/mysql/slow.log" /etc/mysql/my.cnf
fi fi
} }

5
src/modules/stack/install/ee_mod_setup_php.sh

@ -61,5 +61,10 @@ function ee_mod_setup_php()
echo -e "php_admin_value[xdebug.profiler_output_dir] = /tmp/ \nphp_admin_value[xdebug.profiler_output_name] = cachegrind.out.%p-%H-%R \nphp_admin_flag[xdebug.profiler_enable_trigger] = on \nphp_admin_flag[xdebug.profiler_enable] = off" | tee -ai /etc/php5/fpm/pool.d/debug.conf &>> $EE_COMMAND_LOG \ echo -e "php_admin_value[xdebug.profiler_output_dir] = /tmp/ \nphp_admin_value[xdebug.profiler_output_name] = cachegrind.out.%p-%H-%R \nphp_admin_flag[xdebug.profiler_enable_trigger] = on \nphp_admin_flag[xdebug.profiler_enable] = off" | tee -ai /etc/php5/fpm/pool.d/debug.conf &>> $EE_COMMAND_LOG \
|| ee_lib_error "Unable to add xdebug settings for debug pool, exit status = " $? || ee_lib_error "Unable to add xdebug settings for debug pool, exit status = " $?
ee_lib_echo "Downloading GeoIP Database, please wait..."
mkdir -p /usr/share/GeoIP
wget -qO /usr/share/GeoIP/GeoLiteCity.dat.gz /usr/share/GeoIP/GeoIPCity.dat http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip /usr/share/GeoIP/GeoLiteCity.dat.gz
mv /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat
fi fi
} }

2
src/modules/stack/install/mail/ee_mod_install_mailscan.sh → src/modules/stack/install/mail/ee_mod_install_mailscaner.sh

@ -1,6 +1,6 @@
# Install Amavis package # Install Amavis package
function ee_mod_install_mailscan() function ee_mod_install_mailscaner()
{ {
# Install Amavis # Install Amavis
ee_lib_echo "Installing Amavis, SpamAssassin and ClamAV, please wait..." ee_lib_echo "Installing Amavis, SpamAssassin and ClamAV, please wait..."

13
src/modules/stack/install/mail/ee_mod_setup_mailscan.sh → src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh

@ -1,8 +1,8 @@
# Install mail scanner packages # Install mail scanner packages
function ee_mod_setup_mailscan() function ee_mod_setup_mailscaner()
{ {
# Confiure Amavis # Configure Amavis
ee_lib_echo "Setting up Amavis, please wait..." ee_lib_echo "Setting up Amavis, please wait..."
sed -i "s'#@'@'" /etc/amavis/conf.d/15-content_filter_mode && \ sed -i "s'#@'@'" /etc/amavis/conf.d/15-content_filter_mode && \
@ -25,6 +25,15 @@ function ee_mod_setup_mailscan()
|| ee_lib_error "Unable to setup Amavis, exit status = " $? || ee_lib_error "Unable to setup Amavis, exit status = " $?
cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf
# Grep ViMbAdmin host and Password from Postfix Configuration
ee_vimbadmin_host=$(grep hosts /etc/postfix/mysql/virtual_alias_maps.cf | awk '{ print $3 }')
ee_vimbadmin_password=$(grep password /etc/postfix/mysql/virtual_alias_maps.cf | awk '{ print $3 }')
# Changing hosts and password of ViMbAdmin database in Amavis configuration
sed -i "s/127.0.0.1/$ee_vimbadmin_host/" /etc/amavis/conf.d/50-user &&
sed -i "s/password/$ee_vimbadmin_password/" /etc/amavis/conf.d/50-user \
|| ee_lib_error "Unable to setup ViMbAdmin database details in Amavis configuration, exit status = " $?
# Configure ClamAv and Amavis to each other files # Configure ClamAv and Amavis to each other files
adduser clamav amavis &>> $EE_COMMAND_LOG adduser clamav amavis &>> $EE_COMMAND_LOG
adduser amavis clamav &>> $EE_COMMAND_LOG adduser amavis clamav &>> $EE_COMMAND_LOG

2
src/modules/stack/install/mail/ee_mod_setup_sieve.sh

@ -30,5 +30,7 @@ function ee_mod_setup_sieve()
# Configure Roundcube # Configure Roundcube
sed -i "s:\$config\['plugins'\] = array(:\$config\['plugins'\] = array(\n 'sieverules',:" /var/www/roundcubemail/htdocs/config/config.inc.php \ sed -i "s:\$config\['plugins'\] = array(:\$config\['plugins'\] = array(\n 'sieverules',:" /var/www/roundcubemail/htdocs/config/config.inc.php \
|| ee_lib_error "Unable to configure Sieve Roundcube plugin, exit status = " $? || ee_lib_error "Unable to configure Sieve Roundcube plugin, exit status = " $?
echo "\$config['sieverules_port'] = 4190;" >> /var/www/roundcubemail/htdocs/config/config.inc.php echo "\$config['sieverules_port'] = 4190;" >> /var/www/roundcubemail/htdocs/config/config.inc.php
} }

2
src/modules/stack/remove/ee_mod_remove_php.sh

@ -5,5 +5,5 @@ function ee_mod_remove_php()
ee_lib_echo "$EE_SECOND PHP5 package, please wait..." ee_lib_echo "$EE_SECOND PHP5 package, please wait..."
$EE_APT_GET $EE_SECOND php5-common php5-mysqlnd php5-xmlrpc \ $EE_APT_GET $EE_SECOND php5-common php5-mysqlnd php5-xmlrpc \
php5-curl php5-gd php5-cli php5-fpm php5-imap php5-mcrypt php5-xdebug \ php5-curl php5-gd php5-cli php5-fpm php5-imap php5-mcrypt php5-xdebug \
php5-memcache memcached || ee_lib_error "Unable to $EE_SECOND PHP5, exit status = " $? php5-memcache memcached php5-geoip || ee_lib_error "Unable to $EE_SECOND PHP5, exit status = " $?
} }

9
src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh

@ -1,9 +0,0 @@
# Remove MailScan package
function ee_mod_remove_mailscan()
{
ee_lib_echo "$EE_SECOND Amavis, SpamAssassin and ClamAV package, please wait..."
$EE_APT_GET $EE_SECOND amavisd-new spamassassin clamav clamav-daemon arj zoo nomarch lzop cabextract p7zip rpm unrar-free \
|| ee_lib_error "Unable to $EE_SECOND Amavis, SpamAssassin and ClamAV,, exit status = " $?
}

18
src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh

@ -0,0 +1,18 @@
# Remove MailScan package
function ee_mod_remove_mailscaner()
{
# Remove Amavis configuration from Postfix configuration
# Better approach is: postconf -X "content_filter", But available for Postfix 2.11 (latest)
sed -i '/content_filter/d' /etc/postfix/main.cf
sed -i '/content_filter/d' /etc/postfix/master.cf
sed -i '/receive_override_options/d' /etc/postfix/master.cf
sed -i '/smtp-amavis/,$d' /etc/postfix/master.cf
#Remove/Purge mailscan packages
ee_lib_echo "$EE_SECOND Amavis, SpamAssassin and ClamAV package, please wait..."
$EE_APT_GET $EE_SECOND amavisd-new spamassassin clamav clamav-daemon arj zoo nomarch lzop cabextract p7zip rpm unrar-free \
|| ee_lib_error "Unable to $EE_SECOND Amavis, SpamAssassin and ClamAV,, exit status = " $?
}

13
src/vendor/ee_ven_install_utils.sh

@ -70,7 +70,7 @@ function ee_ven_install_utils()
# phpinfo() # phpinfo()
echo -e "<?php \n\t phpinfo(); \n?>" &>> /var/www/22222/htdocs/php/info.php echo -e "<?php \n\t phpinfo(); \n?>" &>> /var/www/22222/htdocs/php/info.php
fi fi
dpkg -l | grep mysql-server &>> $EE_COMMAND_LOG mysqladmin ping &> /dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
# Setup Anemometer # Setup Anemometer
if [ ! -d /var/www/22222/htdocs/db/anemometer ]; then if [ ! -d /var/www/22222/htdocs/db/anemometer ]; then
@ -87,7 +87,12 @@ function ee_ven_install_utils()
|| ee_lib_error "Unable to import Anemometer database, exit status = " $? || ee_lib_error "Unable to import Anemometer database, exit status = " $?
ee_anemometer_pass=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) ee_anemometer_pass=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1)
mysql -e "grant all on slow_query_log.* to 'anemometer'@'localhost' IDENTIFIED BY '$ee_anemometer_pass';"
# Grant select privileges for anemometer
mysql -e "grant select on *.* to 'anemometer'@'$EE_MYSQL_GRANT_HOST'" ;
# Grant all privileges for slow_query_log database.
mysql -e "grant all on slow_query_log.* to 'anemometer'@'$EE_MYSQL_GRANT_HOST' IDENTIFIED BY '$ee_anemometer_pass';"
# Anemometer configuration # Anemometer configuration
cp /var/www/22222/htdocs/db/anemometer/conf/sample.config.inc.php /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \ cp /var/www/22222/htdocs/db/anemometer/conf/sample.config.inc.php /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \
@ -103,7 +108,7 @@ function ee_ven_install_utils()
echo -e " pt-query-digest --user=anemometer --password=$ee_anemometer_pass \\" >> /etc/logrotate.d/mysql-server echo -e " pt-query-digest --user=anemometer --password=$ee_anemometer_pass \\" >> /etc/logrotate.d/mysql-server
echo -e " --review D=slow_query_log,t=global_query_review \\" >> /etc/logrotate.d/mysql-server echo -e " --review D=slow_query_log,t=global_query_review \\" >> /etc/logrotate.d/mysql-server
echo -e " --history D=slow_query_log,t=global_query_review_history \\" >> /etc/logrotate.d/mysql-server echo -e " --history D=slow_query_log,t=global_query_review_history \\" >> /etc/logrotate.d/mysql-server
echo -e " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"\$HOSTNAME\\\"\" /var/log/mysql/slow.log >> /etc/logrotate.d/mysql-server echo -e " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"$EE_MYSQL_GRANT_HOST\\\"\" /var/log/mysql/mysql-slow.log >> /etc/logrotate.d/mysql-server
echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server
echo -e "}" >> /etc/logrotate.d/mysql-server echo -e "}" >> /etc/logrotate.d/mysql-server
else else
@ -111,7 +116,7 @@ function ee_ven_install_utils()
echo -e " pt-query-digest --user=anemometer --password=$ee_anemometer_pass \\" >> /etc/logrotate.d/mysql-server echo -e " pt-query-digest --user=anemometer --password=$ee_anemometer_pass \\" >> /etc/logrotate.d/mysql-server
echo -e " --review D=slow_query_log,t=global_query_review \\" >> /etc/logrotate.d/mysql-server echo -e " --review D=slow_query_log,t=global_query_review \\" >> /etc/logrotate.d/mysql-server
echo -e " --review-history D=slow_query_log,t=global_query_review_history \\" >> /etc/logrotate.d/mysql-server echo -e " --review-history D=slow_query_log,t=global_query_review_history \\" >> /etc/logrotate.d/mysql-server
echo -e " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"\$HOSTNAME\\\"\" /var/log/mysql/slow.log >> /etc/logrotate.d/mysql-server echo -e " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"$EE_MYSQL_GRANT_HOST\\\"\" /var/log/mysql/mysql-slow.log >> /etc/logrotate.d/mysql-server
echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server
echo -e "}" >> /etc/logrotate.d/mysql-server echo -e "}" >> /etc/logrotate.d/mysql-server
fi fi

22
src/vendor/ee_ven_install_wpcli.sh

@ -2,16 +2,20 @@
function ee_ven_install_wpcli() function ee_ven_install_wpcli()
{ {
if [ ! -f /usr/bin/wp ]; then dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_COMMAND_LOG
ee_lib_echo "Downloading WP-CLI, please wait..." if [ $? -eq 0 ]; then
wget -qO /usr/bin/wp https://github.com/wp-cli/wp-cli/releases/download/v${EE_WP_CLI_VERSION}/wp-cli.phar \ ee_wp_cli_current=$(wp --allow-root --info 2> /dev/null | grep 'WP-CLI' | grep version | awk '{print $3}')
|| ee_lib_error "Unable to download WP-CLI, exit status = " $? if [[ $ee_wp_cli_current < $EE_WP_CLI_VERSION ]]; then
ee_lib_echo "Downloading WP-CLI, please wait..."
wget -qO /usr/bin/wp https://github.com/wp-cli/wp-cli/releases/download/v${EE_WP_CLI_VERSION}/wp-cli.phar \
|| ee_lib_error "Unable to download WP-CLI, exit status = " $?
# Executable permission # Executable permission
chmod a+x /usr/bin/wp \ chmod a+x /usr/bin/wp \
|| ee_lib_error "Unable to set executable permission for wp-cli, exit status = " $? || ee_lib_error "Unable to set executable permission for wp-cli, exit status = " $?
# Download auto completion # Download auto completion
wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/v${EE_WP_CLI_VERSION}/utils/wp-completion.bash wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/v${EE_WP_CLI_VERSION}/utils/wp-completion.bash
fi
fi fi
} }

6
src/vendor/ee_ven_setup_vimbadmin.sh

@ -36,6 +36,7 @@ function ee_ven_setup_vimbadmin()
|| ee_lib_error "Unable to setup ViMbAdmin configuration file, exit status = " $? || ee_lib_error "Unable to setup ViMbAdmin configuration file, exit status = " $?
# Changing hosts and password of ViMbAdmin database in postfix configuration # Changing hosts and password of ViMbAdmin database in postfix configuration
# Note: As Amavis is optional, Amavis ViMbAdmin settings are present is ee_mod_setup_mailscaner function
sed -i "s/password = password/password = $ee_random/" /etc/postfix/mysql/virtual_alias_maps.cf && sed -i "s/password = password/password = $ee_random/" /etc/postfix/mysql/virtual_alias_maps.cf &&
sed -i "s/hosts = 127.0.0.1/hosts = $ee_vimbadmin_host/" /etc/postfix/mysql/virtual_alias_maps.cf \ sed -i "s/hosts = 127.0.0.1/hosts = $ee_vimbadmin_host/" /etc/postfix/mysql/virtual_alias_maps.cf \
|| ee_lib_error "Unable to setup ViMbAdmin database details in virtual_alias_maps.cf file, exit status = " $? || ee_lib_error "Unable to setup ViMbAdmin database details in virtual_alias_maps.cf file, exit status = " $?
@ -52,11 +53,6 @@ function ee_ven_setup_vimbadmin()
sed -i "s/hosts=localhost/hosts=$ee_vimbadmin_host/" /etc/dovecot/dovecot-sql.conf.ext \ sed -i "s/hosts=localhost/hosts=$ee_vimbadmin_host/" /etc/dovecot/dovecot-sql.conf.ext \
|| ee_lib_error "Unable to setup ViMbAdmin database details in dovecot-sql.conf.ext file, exit status = " $? || ee_lib_error "Unable to setup ViMbAdmin database details in dovecot-sql.conf.ext file, exit status = " $?
# Changing hosts and password of ViMbAdmin database in Amavis configuration
sed -i "s/127.0.0.1/$ee_vimbadmin_host/" /etc/amavis/conf.d/50-user &&
sed -i "s/password/$ee_random/" /etc/amavis/conf.d/50-user \
|| ee_lib_error "Unable to setup ViMbAdmin database details in 50-user file, exit status = " $?
# Copying HTACCESS # Copying HTACCESS
cp -av /var/www/22222/htdocs/vimbadmin/public/.htaccess.dist /var/www/22222/htdocs/vimbadmin/public/.htaccess &>> $EE_COMMAND_LOG cp -av /var/www/22222/htdocs/vimbadmin/public/.htaccess.dist /var/www/22222/htdocs/vimbadmin/public/.htaccess &>> $EE_COMMAND_LOG

Loading…
Cancel
Save