From 4c204aeca20a773b95839ed98cbcb9816c55432c Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 9 Sep 2014 15:21:22 +0530 Subject: [PATCH 01/27] Fixes #306 --- bin/easyengine | 3 +++ bin/install | 29 ----------------------------- bin/update | 3 --- 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index a8d2a05e..00dd3ed6 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -148,6 +148,9 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_lib_error "Found installed Dovecot Packages server, exit status=" 1 fi + # Make hostname as FQDN + ee_lib_check_fqdn $(hostname -f) + # Install Dovecot ee_mod_install_dovecot diff --git a/bin/install b/bin/install index 24efda35..4e83a263 100644 --- a/bin/install +++ b/bin/install @@ -82,32 +82,6 @@ function ee_lib_package_check() 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 # Checking EasyEngine (ee) log directory @@ -211,9 +185,6 @@ fi 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 = " $? -# Make hostname as FQDN -ee_lib_check_fqdn $(hostname -f) - # Git config settings GIT_USER_NAME=$(git config user.name) GIT_USER_EMAIL=$(git config user.email) diff --git a/bin/update b/bin/update index 278eeb20..0dd1eccc 100644 --- a/bin/update +++ b/bin/update @@ -395,9 +395,6 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then done fi - # Make hostname as FQDN - ee_lib_check_fqdn $(hostname -f) - if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG if [ $? -eq 0 ]; then From e38f2549ddfba84697b189dd4ad225c1cd8c38c7 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 9 Sep 2014 16:02:06 +0530 Subject: [PATCH 02/27] Improved comments --- bin/easyengine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/easyengine b/bin/easyengine index 00dd3ed6..aac8dd6f 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -148,7 +148,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_lib_error "Found installed Dovecot Packages server, exit status=" 1 fi - # Make hostname as FQDN + # Check hostname is FQDN or not, if not asks user to set hostname as FQDN ee_lib_check_fqdn $(hostname -f) # Install Dovecot From d98564c76874450c026ee7168ac0152c066fc27d Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 11 Sep 2014 12:09:34 +0530 Subject: [PATCH 03/27] Fixed Anemometer not installing on some servers. Added Anemometer user permission --- src/vendor/ee_ven_install_utils.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vendor/ee_ven_install_utils.sh b/src/vendor/ee_ven_install_utils.sh index 502598d1..c962b3ed 100644 --- a/src/vendor/ee_ven_install_utils.sh +++ b/src/vendor/ee_ven_install_utils.sh @@ -70,7 +70,7 @@ function ee_ven_install_utils() # phpinfo() echo -e "" &>> /var/www/22222/htdocs/php/info.php fi - dpkg -l | grep mysql-server &>> $EE_COMMAND_LOG + mysqladmin ping &> /dev/null if [ $? -eq 0 ]; then # Setup Anemometer if [ ! -d /var/www/22222/htdocs/db/anemometer ]; then @@ -116,6 +116,9 @@ function ee_ven_install_utils() echo -e "}" >> /etc/logrotate.d/mysql-server fi + # Set anemometer privileges to databases + mysql -e "grant all privileges on *.* to 'anemometer'@'localhost'" ; + # 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 = " $? From 396d553f2e70adad9fdf7f51540ad3db3b6bb27c Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 11 Sep 2014 12:18:23 +0530 Subject: [PATCH 04/27] Improved code --- src/vendor/ee_ven_install_utils.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vendor/ee_ven_install_utils.sh b/src/vendor/ee_ven_install_utils.sh index c962b3ed..a5a9e536 100644 --- a/src/vendor/ee_ven_install_utils.sh +++ b/src/vendor/ee_ven_install_utils.sh @@ -87,7 +87,10 @@ function ee_ven_install_utils() || 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) - mysql -e "grant all on slow_query_log.* to 'anemometer'@'localhost' IDENTIFIED BY '$ee_anemometer_pass';" + mysql -e "grant all on slow_query_log.* to 'anemometer'@'$EE_MYSQL_GRANT_HOST' IDENTIFIED BY '$ee_anemometer_pass';" + + # Grant all privileges for anemometer + mysql -e "grant all privileges on *.* to 'anemometer'@'$EE_MYSQL_GRANT_HOST'" ; # Anemometer configuration cp /var/www/22222/htdocs/db/anemometer/conf/sample.config.inc.php /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \ @@ -116,9 +119,6 @@ function ee_ven_install_utils() echo -e "}" >> /etc/logrotate.d/mysql-server fi - # Set anemometer privileges to databases - mysql -e "grant all privileges on *.* to 'anemometer'@'localhost'" ; - # 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 = " $? From 69ad8d9553996f615b5e725e161b83a7dbc003a7 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 11 Sep 2014 12:34:26 +0530 Subject: [PATCH 05/27] Anemometer read only permission --- src/vendor/ee_ven_install_utils.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vendor/ee_ven_install_utils.sh b/src/vendor/ee_ven_install_utils.sh index a5a9e536..7e662be4 100644 --- a/src/vendor/ee_ven_install_utils.sh +++ b/src/vendor/ee_ven_install_utils.sh @@ -87,10 +87,12 @@ function ee_ven_install_utils() || 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) - mysql -e "grant all on slow_query_log.* to 'anemometer'@'$EE_MYSQL_GRANT_HOST' IDENTIFIED BY '$ee_anemometer_pass';" - # Grant all privileges for anemometer - mysql -e "grant all privileges on *.* to 'anemometer'@'$EE_MYSQL_GRANT_HOST'" ; + # 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 cp /var/www/22222/htdocs/db/anemometer/conf/sample.config.inc.php /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \ From cd7dbad760ff679283ecc48df281870c51311070 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 11 Sep 2014 14:40:17 +0530 Subject: [PATCH 06/27] Fixed Anemometer hostname issue --- src/vendor/ee_ven_install_utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vendor/ee_ven_install_utils.sh b/src/vendor/ee_ven_install_utils.sh index 7e662be4..c37e827b 100644 --- a/src/vendor/ee_ven_install_utils.sh +++ b/src/vendor/ee_ven_install_utils.sh @@ -108,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 " --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 " --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/slow.log >> /etc/logrotate.d/mysql-server echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server echo -e "}" >> /etc/logrotate.d/mysql-server else @@ -116,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 " --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 " --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/slow.log >> /etc/logrotate.d/mysql-server echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server echo -e "}" >> /etc/logrotate.d/mysql-server fi From 4131f19ce21ac8e8772ae8c0079cff0f9afedaa4 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 11 Sep 2014 17:38:52 +0530 Subject: [PATCH 07/27] Addedd mailscanner install/remove/purge functions --- bin/easyengine | 42 +++++++++++++++++-- ...ilscan.sh => ee_mod_install_mailscaner.sh} | 2 +- ...mailscan.sh => ee_mod_setup_mailscaner.sh} | 4 +- .../remove/mail/ee_mod_remove_mailscan.sh | 9 ---- .../remove/mail/ee_mod_remove_mailscaner.sh | 17 ++++++++ 5 files changed, 58 insertions(+), 16 deletions(-) rename src/modules/stack/install/mail/{ee_mod_install_mailscan.sh => ee_mod_install_mailscaner.sh} (90%) rename src/modules/stack/install/mail/{ee_mod_setup_mailscan.sh => ee_mod_setup_mailscaner.sh} (97%) delete mode 100644 src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh create mode 100644 src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh diff --git a/bin/easyengine b/bin/easyengine index aac8dd6f..6dc1805d 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -155,7 +155,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_mod_install_dovecot # Install mail scanner packages - ee_mod_install_mailscan + ee_mod_install_mailscaner # Install ViMbAdmin ee_ven_install_vimbadmin @@ -170,7 +170,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_mod_setup_dovecot # Setup Amavis - ee_mod_setup_mailscan + ee_mod_setup_mailscaner # Setup ViMbAdmin ee_ven_setup_vimbadmin @@ -190,6 +190,18 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_lib_echo_escape "Security Salt:\t\t${ee_security_salt}\n" ee_lib_echo "Successfully installed mail server packages" + elif [ "$EE_THIRD" = "mailscanner"]; then + + # 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 # EasyEngine remove/purge @@ -242,8 +254,8 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Remove Dovecot ee_mod_remove_dovecot - # Remove Amavis - ee_mod_remove_mailscan + # Remove Mail Scanner + ee_mod_remove_mailscaner # Remove ViMbAdmin ee_ven_remove_vimbadmin @@ -254,12 +266,34 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Execute: apt-get autoremove ee_lib_autoremove + # Restart Nginx + ee_lib_service nginx + + ee_lib_git /etc/nginx "Removed Mail Server" + # Display success message if [ "$EE_SECOND" = "remove" ];then ee_lib_echo "Successfully removed mail server packages" elif [ "$EE_SECOND" = "purge" ];then ee_lib_echo "Successfully purged mail server packages" 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 elif [ "$EE_SECOND" = "status" ]; then diff --git a/src/modules/stack/install/mail/ee_mod_install_mailscan.sh b/src/modules/stack/install/mail/ee_mod_install_mailscaner.sh similarity index 90% rename from src/modules/stack/install/mail/ee_mod_install_mailscan.sh rename to src/modules/stack/install/mail/ee_mod_install_mailscaner.sh index 18559f74..4c3c5b7b 100644 --- a/src/modules/stack/install/mail/ee_mod_install_mailscan.sh +++ b/src/modules/stack/install/mail/ee_mod_install_mailscaner.sh @@ -1,6 +1,6 @@ # Install Amavis package -function ee_mod_install_mailscan() +function ee_mod_install_mailscaner() { # Install Amavis ee_lib_echo "Installing Amavis, SpamAssassin and ClamAV, please wait..." diff --git a/src/modules/stack/install/mail/ee_mod_setup_mailscan.sh b/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh similarity index 97% rename from src/modules/stack/install/mail/ee_mod_setup_mailscan.sh rename to src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh index 8fe08a1f..59c17249 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_mailscan.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh @@ -1,8 +1,8 @@ # 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..." sed -i "s'#@'@'" /etc/amavis/conf.d/15-content_filter_mode && \ diff --git a/src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh b/src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh deleted file mode 100644 index d893959f..00000000 --- a/src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh +++ /dev/null @@ -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 = " $? - -} diff --git a/src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh b/src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh new file mode 100644 index 00000000..e26dd16e --- /dev/null +++ b/src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh @@ -0,0 +1,17 @@ +# Remove MailScan package + +function ee_mod_remove_mailscaner() +{ + + # Remove Amavis configuration from Postfix configuration + 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 = " $? + +} From 378a2c1fc8676d444adc457ff1034202d2e25804 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 11 Sep 2014 18:42:54 +0530 Subject: [PATCH 08/27] Fixed space issue --- bin/easyengine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/easyengine b/bin/easyengine index 6dc1805d..39411ac4 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -277,7 +277,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then elif [ "$EE_SECOND" = "purge" ];then ee_lib_echo "Successfully purged mail server packages" fi - elif [ "$EE_THIRD" = "mailscanner"]; then + elif [ "$EE_THIRD" = "mailscanner" ]; then # Remove Amavis ee_mod_remove_mailscaner From 8c5584bbed221438edc73e2ec4e6d069b260e801 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 11 Sep 2014 18:47:29 +0530 Subject: [PATCH 09/27] Improved comments --- src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh b/src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh index e26dd16e..17cef9ee 100644 --- a/src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh +++ b/src/modules/stack/remove/mail/ee_mod_remove_mailscaner.sh @@ -4,6 +4,7 @@ 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 From bfc9f40f4aaeaff4b78ac56e133b8b3b2232e93c Mon Sep 17 00:00:00 2001 From: gau1991 Date: Thu, 11 Sep 2014 18:54:13 +0530 Subject: [PATCH 10/27] Fixed typo --- bin/easyengine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/easyengine b/bin/easyengine index 39411ac4..fc023082 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -190,7 +190,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_lib_echo_escape "Security Salt:\t\t${ee_security_salt}\n" ee_lib_echo "Successfully installed mail server packages" - elif [ "$EE_THIRD" = "mailscanner"]; then + elif [ "$EE_THIRD" = "mailscanner" ]; then # Install Mail Scanner ee_mod_install_mailscaner From aa9a0442a63841986da4b9751e1c46b8688f031b Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 12 Sep 2014 11:28:05 +0530 Subject: [PATCH 11/27] Updated WP_CLI version --- src/lib/ee_lib_variables.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ee_lib_variables.sh b/src/lib/ee_lib_variables.sh index c5b2113e..67eca071 100644 --- a/src/lib/ee_lib_variables.sh +++ b/src/lib/ee_lib_variables.sh @@ -4,7 +4,7 @@ readonly EE_VERSION='2.1.0' # WP-CLI version -readonly EE_WP_CLI_VERSION='0.16.0' +readonly EE_WP_CLI_VERSION='0.17.0' # Adminer version readonly EE_ADMINER_VERSION='4.1.0' From 3f2c809bc0e7691c1d25f0bf57b69cb201a1abdb Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 12 Sep 2014 11:38:43 +0530 Subject: [PATCH 12/27] Added GEOIP Module --- src/modules/stack/install/ee_mod_install_php.sh | 2 +- src/modules/stack/install/ee_mod_setup_php.sh | 7 ++++++- src/modules/stack/remove/ee_mod_remove_php.sh | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/stack/install/ee_mod_install_php.sh b/src/modules/stack/install/ee_mod_install_php.sh index 57b36c96..db30fadd 100644 --- a/src/modules/stack/install/ee_mod_install_php.sh +++ b/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_APT_GET install php5-common php5-mysqlnd php5-xmlrpc \ 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 = " $? } diff --git a/src/modules/stack/install/ee_mod_setup_php.sh b/src/modules/stack/install/ee_mod_setup_php.sh index d86399e1..944ae0d4 100644 --- a/src/modules/stack/install/ee_mod_setup_php.sh +++ b/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 \ || ee_lib_error "Unable to add xdebug settings for debug pool, exit status = " $? - fi + 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 } diff --git a/src/modules/stack/remove/ee_mod_remove_php.sh b/src/modules/stack/remove/ee_mod_remove_php.sh index 528ea80b..2ade5bba 100644 --- a/src/modules/stack/remove/ee_mod_remove_php.sh +++ b/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_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-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 = " $? } From 9e1a33387a06fa749a6c02b6d45257c0c1c75ceb Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 12 Sep 2014 12:56:18 +0530 Subject: [PATCH 13/27] Defined RAM based matrix --- src/lib/ee_lib_ram.sh | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/lib/ee_lib_ram.sh diff --git a/src/lib/ee_lib_ram.sh b/src/lib/ee_lib_ram.sh new file mode 100644 index 00000000..276ad933 --- /dev/null +++ b/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 < 1024 + 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 > 512MB and RAM < 1024 + 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 > 512MB and RAM < 1024 + 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 > 512MB and RAM < 1024 + 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 > 512MB and RAM < 1024 + 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 > 512MB and RAM < 1024 + elif [ $EE_TOTAL_RAM -gt 16384 ]; then + EE_OPCACHE_SIZE="512" + EE_MEMCACHE_SIZE="2048" + EE_PHP_MAX_CHILDREN="100" + fi +} \ No newline at end of file From 1ef968763eff3b0461599088525ac7ebd6555940 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 12 Sep 2014 13:00:33 +0530 Subject: [PATCH 14/27] Improved comments --- src/lib/ee_lib_ram.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/ee_lib_ram.sh b/src/lib/ee_lib_ram.sh index 276ad933..3144140d 100644 --- a/src/lib/ee_lib_ram.sh +++ b/src/lib/ee_lib_ram.sh @@ -11,32 +11,32 @@ function ee_lib_ram() EE_MEMCACHE_SIZE="64" EE_PHP_MAX_CHILDREN="10" EE_SETUP_MAILSCANNER="no" - # RAM > 512MB and RAM < 1024 + # 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 > 512MB and RAM < 1024 + # 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 > 512MB and RAM < 1024 + # 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 > 512MB and RAM < 1024 + # 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 > 512MB and RAM < 1024 + # 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 > 512MB and RAM < 1024 + # RAM > 16384MB elif [ $EE_TOTAL_RAM -gt 16384 ]; then EE_OPCACHE_SIZE="512" EE_MEMCACHE_SIZE="2048" From c658fd1e6cce2320f5dd649054cfd6736739f9d3 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 12 Sep 2014 15:19:43 +0530 Subject: [PATCH 15/27] Fixed Amvis ViMbAdmin password issue, Fixed RAM based installation of Mail scanner --- bin/easyengine | 19 +++++++++++++------ .../install/mail/ee_mod_setup_mailscaner.sh | 9 +++++++++ src/vendor/ee_ven_setup_vimbadmin.sh | 6 +----- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index fc023082..d5a5458f 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -45,6 +45,8 @@ elif [ "$EE_FIRST" = "info" ];then elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # EasyEngine install 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" ]; then # Setup NGINX/PHP repository @@ -154,8 +156,6 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Install Dovecot ee_mod_install_dovecot - # Install mail scanner packages - ee_mod_install_mailscaner # Install ViMbAdmin ee_ven_install_vimbadmin @@ -169,9 +169,6 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Configure Dovecot ee_mod_setup_dovecot - # Setup Amavis - ee_mod_setup_mailscaner - # Setup ViMbAdmin ee_ven_setup_vimbadmin @@ -180,7 +177,17 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Setup Sieve Rules 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 "Found RAM less than 512MB, not installing Mail Scanner packages" + + fi ee_lib_service nginx postfix dovecot amavis restart ee_lib_git /etc/nginx /etc/postfix /etc/dovecot /etc/amavis "Initialize Git" diff --git a/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh b/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh index 59c17249..46a391df 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh @@ -25,6 +25,15 @@ function ee_mod_setup_mailscaner() || ee_lib_error "Unable to setup Amavis, exit status = " $? cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf + # Grep ViMbAdmin host and Password from Postfix Configuration + ee_vimbadmin_host=$(grep password /etc/postfix/mysql/virtual_alias_maps.cf | awk '{ print $3 }') + ee_vimbadmin_password=$(grep hosts /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 adduser clamav amavis &>> $EE_COMMAND_LOG adduser amavis clamav &>> $EE_COMMAND_LOG diff --git a/src/vendor/ee_ven_setup_vimbadmin.sh b/src/vendor/ee_ven_setup_vimbadmin.sh index 993b94fc..4ad1509d 100644 --- a/src/vendor/ee_ven_setup_vimbadmin.sh +++ b/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 = " $? # 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/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 = " $? @@ -52,11 +53,6 @@ function ee_ven_setup_vimbadmin() 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 = " $? - # 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 cp -av /var/www/22222/htdocs/vimbadmin/public/.htaccess.dist /var/www/22222/htdocs/vimbadmin/public/.htaccess &>> $EE_COMMAND_LOG From a14e4b4a423c38a4ce695ec2697e0cb4ee72f96e Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 12 Sep 2014 15:41:08 +0530 Subject: [PATCH 16/27] Fixed Typo --- src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh b/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh index 46a391df..2c5f0013 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_mailscaner.sh @@ -26,8 +26,8 @@ function ee_mod_setup_mailscaner() cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf # Grep ViMbAdmin host and Password from Postfix Configuration - ee_vimbadmin_host=$(grep password /etc/postfix/mysql/virtual_alias_maps.cf | awk '{ print $3 }') - ee_vimbadmin_password=$(grep hosts /etc/postfix/mysql/virtual_alias_maps.cf | awk '{ print $3 }') + 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 && From e781d1a56aa39c9d72bf1ada2077d134c5c9f12f Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 12 Sep 2014 16:10:00 +0530 Subject: [PATCH 17/27] Dovecot check added for Mail Scanner Packages --- bin/easyengine | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index d5a5458f..af58f01d 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -147,7 +147,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null 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 # Check hostname is FQDN or not, if not asks user to set hostname as FQDN @@ -186,7 +186,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_mod_setup_mailscaner else ee_lib_echo "Found RAM less than 512MB, not installing Mail Scanner packages" - + fi ee_lib_service nginx postfix dovecot amavis restart @@ -198,6 +198,11 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then 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 From f204dff3cb7abb6cf740df181eae40c8fbd8a48a Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 12 Sep 2014 17:56:58 +0530 Subject: [PATCH 18/27] Updated Message --- bin/easyengine | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/easyengine b/bin/easyengine index af58f01d..6ea58436 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -185,8 +185,8 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Setup Amavis ee_mod_setup_mailscaner else - ee_lib_echo "Found RAM less than 512MB, not installing Mail Scanner packages" - + ee_lib_echo_fail "RAM is less then 512MB, EasyEngine skip installing Mail Scanner Packages" + fi ee_lib_service nginx postfix dovecot amavis restart From 7652c3728eb7359e6ead77dade4da157c431095e Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 15 Sep 2014 16:41:16 +0530 Subject: [PATCH 19/27] Fixed Managsieve Plugin issue --- src/modules/stack/install/mail/ee_mod_setup_sieve.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/modules/stack/install/mail/ee_mod_setup_sieve.sh b/src/modules/stack/install/mail/ee_mod_setup_sieve.sh index 40cf3889..6c875b4f 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_sieve.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_sieve.sh @@ -28,7 +28,14 @@ function ee_mod_setup_sieve() || ee_lib_error "Unable to compile Sieve rules, exit status = " $? # 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 'managesieve',:" /var/www/roundcubemail/htdocs/config/config.inc.php \ || ee_lib_error "Unable to configure Sieve Roundcube plugin, exit status = " $? - echo "\$config['sieverules_port'] = 4190;" >> /var/www/roundcubemail/htdocs/config/config.inc.php + + # Configure ManageSieve Plugin + cp -v /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php.dist /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to configure ManageSieve Roundcube plugin, exit status = " $? + + sed -i "s:\$config\['managesieve_port'\] = null:\$config\['managesieve_port'\] = 4190:" /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php && \ + sed -i "s:/etc/dovecot/sieve/global:/var/lib/dovecot/sieve/default.sieve:" /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php \ + || ee_lib_error "Unable to configure ManageSieve Roundcube plugin, exit status = " $? } From 948f14d2aa153b7def1d557412950911aa857bb3 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 15 Sep 2014 17:13:38 +0530 Subject: [PATCH 20/27] Fixed Developer plugin permission issue --- src/modules/debug/ee_mod_debug_wp.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/debug/ee_mod_debug_wp.sh b/src/modules/debug/ee_mod_debug_wp.sh index 8c58ab91..1850b459 100644 --- a/src/modules/debug/ee_mod_debug_wp.sh +++ b/src/modules/debug/ee_mod_debug_wp.sh @@ -21,6 +21,11 @@ function ee_mod_debug_wp() cd /var/www/$EE_DOMAIN/htdocs/ && \ wp plugin --allow-root install developer &>> $EE_COMMAND_LOG \ || 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 # Display message ee_lib_echo "WordPress debug log already enabled for $EE_DOMAIN" From 38465cda87b0f3e4be61417206933d6bf317b116 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 15 Sep 2014 17:27:50 +0530 Subject: [PATCH 21/27] Autocompletion for mailscanner --- config/bash_completion.d/ee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/bash_completion.d/ee b/config/bash_completion.d/ee index 1efbbef1..aa2a1dd5 100644 --- a/config/bash_completion.d/ee +++ b/config/bash_completion.d/ee @@ -25,7 +25,7 @@ function EE_AUTO() ;; 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 ;; From 68ab93c3c642056d5eda148ebc6ee2d2548b0432 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Mon, 15 Sep 2014 19:06:49 +0530 Subject: [PATCH 22/27] Updated Update Script --- bin/update | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bin/update b/bin/update index 0dd1eccc..6616651f 100644 --- a/bin/update +++ b/bin/update @@ -441,6 +441,25 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then # Update EasyEngine current version EE_CURRENT_VERSION="2.1.0" fi + if [[ $EE_CURRENT_VERSION < 2.1.1 ]]; then + # Install WP-CLI + ee_ven_install_wpcli + + # Configure ManageSieve plugin + if [ -d /var/www/roundcubemail/htdocs ]; then + sed -i "/sieverules_port/d" /var/www/roundcubemail/htdocs/config/config.inc.php + sed -i "s/'sieverules'/'managesieve'/" /var/www/roundcubemail/htdocs/config/config.inc.php + + # Configure ManageSieve Plugin + cp -v /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php.dist /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to configure ManageSieve Roundcube plugin, exit status = " $? + + sed -i "s:\$config\['managesieve_port'\] = null:\$config\['managesieve_port'\] = 4190:" /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php && \ + sed -i "s:/etc/dovecot/sieve/global:/var/lib/dovecot/sieve/default.sieve:" /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php \ + || ee_lib_error "Unable to configure ManageSieve Roundcube plugin, exit status = " $? + + fi + fi # Restart service ee_lib_service nginx php5-fpm restart From 156dd79ad452152d21178a50501218e173bea27c Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 17 Sep 2014 12:04:07 +0530 Subject: [PATCH 23/27] Fixed Sieve Plugin issue --- bin/update | 15 --------------- .../stack/install/mail/ee_mod_setup_sieve.sh | 9 ++------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/bin/update b/bin/update index 6616651f..9da1d456 100644 --- a/bin/update +++ b/bin/update @@ -444,21 +444,6 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then if [[ $EE_CURRENT_VERSION < 2.1.1 ]]; then # Install WP-CLI ee_ven_install_wpcli - - # Configure ManageSieve plugin - if [ -d /var/www/roundcubemail/htdocs ]; then - sed -i "/sieverules_port/d" /var/www/roundcubemail/htdocs/config/config.inc.php - sed -i "s/'sieverules'/'managesieve'/" /var/www/roundcubemail/htdocs/config/config.inc.php - - # Configure ManageSieve Plugin - cp -v /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php.dist /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable to configure ManageSieve Roundcube plugin, exit status = " $? - - sed -i "s:\$config\['managesieve_port'\] = null:\$config\['managesieve_port'\] = 4190:" /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php && \ - sed -i "s:/etc/dovecot/sieve/global:/var/lib/dovecot/sieve/default.sieve:" /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php \ - || ee_lib_error "Unable to configure ManageSieve Roundcube plugin, exit status = " $? - - fi fi # Restart service diff --git a/src/modules/stack/install/mail/ee_mod_setup_sieve.sh b/src/modules/stack/install/mail/ee_mod_setup_sieve.sh index 6c875b4f..1e0b7dfb 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_sieve.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_sieve.sh @@ -28,14 +28,9 @@ function ee_mod_setup_sieve() || ee_lib_error "Unable to compile Sieve rules, exit status = " $? # Configure Roundcube - sed -i "s:\$config\['plugins'\] = array(:\$config\['plugins'\] = array(\n 'managesieve',:" /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 = " $? - # Configure ManageSieve Plugin - cp -v /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php.dist /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable to configure ManageSieve Roundcube plugin, exit status = " $? + echo "\$config['sieverules_port'] = 4190;" >> /var/www/roundcubemail/htdocs/config/config.inc.php - sed -i "s:\$config\['managesieve_port'\] = null:\$config\['managesieve_port'\] = 4190:" /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php && \ - sed -i "s:/etc/dovecot/sieve/global:/var/lib/dovecot/sieve/default.sieve:" /var/www/roundcubemail/htdocs/plugins/managesieve/config.inc.php \ - || ee_lib_error "Unable to configure ManageSieve Roundcube plugin, exit status = " $? } From 5cdfb4802cfea3541829f963ae0dd238104e1943 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 17 Sep 2014 13:06:15 +0530 Subject: [PATCH 24/27] Optimized Update script and WP-CLI setup --- bin/update | 76 +++++++++++++----------------- src/vendor/ee_ven_install_wpcli.sh | 22 +++++---- 2 files changed, 45 insertions(+), 53 deletions(-) diff --git a/bin/update b/bin/update index 9da1d456..ae78248b 100644 --- a/bin/update +++ b/bin/update @@ -363,8 +363,8 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then fi # Update NGINX if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then - nginx -v 2>&1 | grep 1.6.0 &>> $EE_UPDATE_LOG - if [ $? -ne 0 ]; then + ls /etc/apt/sources.list.d/brianmercer-nginx* &>> $EE_UPDATE_LOG + if [ $? -eq 0 ]; then rm /etc/apt/sources.list.d/brianmercer-nginx* # Add rtCamp nginx launchpad repository ee_lib_echo "Adding rtCamp NGINX launchpad repository, please wait..." @@ -395,57 +395,45 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then done fi - if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then - dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG - if [ $? -eq 0 ]; then - - # WP-CLI change the installation method - rm -rf /usr/share/easyengine/wp-cli /usr/share/wp-cli /usr/bin/wp /etc/bash_completion.d/wp-completion.bash + if [[ $EE_CURRENT_VERSION = 2.0.0 ]] || [[ $EE_CURRENT_VERSION = 2.0.1 ]]; then + sed -i 's/host =.*/grant-host = localhost/' /etc/easyengine/ee.conf - # Install WP-CLI - ee_ven_install_wpcli + # Add Vimbadmin rules + if [ -f /etc/nginx/sites-available/22222 ];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 - # 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 + 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 - if [[ $EE_CURRENT_VERSION < 2.1.0 ]];then - if [ -f /etc/nginx/sites-available/22222 ];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 = " $? + # 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 - 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 = " $? + + # Update EasyEngine current version + EE_CURRENT_VERSION="2.1.0" fi - # Update EasyEngine current version - EE_CURRENT_VERSION="2.1.0" - fi - if [[ $EE_CURRENT_VERSION < 2.1.1 ]]; then - # Install WP-CLI - ee_ven_install_wpcli + # if [[ $EE_CURRENT_VERSION = 2.1.0 ]]; then + # fi fi + # Update WP-CLI + ee_ven_install_wpcli + # Restart service ee_lib_service nginx php5-fpm restart diff --git a/src/vendor/ee_ven_install_wpcli.sh b/src/vendor/ee_ven_install_wpcli.sh index 0a1f5a07..e7dc1abe 100644 --- a/src/vendor/ee_ven_install_wpcli.sh +++ b/src/vendor/ee_ven_install_wpcli.sh @@ -2,16 +2,20 @@ function ee_ven_install_wpcli() { - if [ ! -f /usr/bin/wp ]; 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 = " $? + dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_COMMAND_LOG + if [ $? -eq 0 ]; then + ee_wp_cli_current=$(wp --allow-root --info 2> /dev/null | grep 'WP-CLI' | grep version | awk '{print $3}') + 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 - chmod a+x /usr/bin/wp \ - || ee_lib_error "Unable to set executable permission for wp-cli, exit status = " $? + # Executable permission + chmod a+x /usr/bin/wp \ + || ee_lib_error "Unable to set executable permission for wp-cli, exit status = " $? - # 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 + # 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 + fi fi } From 6ef80c69dd89b84d17ea8c2808ef1b24348c9627 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 17 Sep 2014 16:30:27 +0530 Subject: [PATCH 25/27] Fixed MySQL log file path --- src/modules/debug/ee_mod_debug_mysql.sh | 6 +++--- src/modules/stack/install/ee_mod_setup_mysql.sh | 1 - src/vendor/ee_ven_install_utils.sh | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/modules/debug/ee_mod_debug_mysql.sh b/src/modules/debug/ee_mod_debug_mysql.sh index ca828c48..156614a5 100644 --- a/src/modules/debug/ee_mod_debug_mysql.sh +++ b/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';" \ || 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 = " $? mysql -e "set global long_query_time = 2;" \ @@ -24,7 +24,7 @@ function ee_mod_debug_mysql() fi # 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 mysql -e "show variables like 'slow_query_log';" | grep ON &>> $EE_COMMAND_LOG if [ $? -eq 0 ]; then @@ -33,7 +33,7 @@ function ee_mod_debug_mysql() mysql -e "set global slow_query_log = 'OFF';" \ || 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 = " $? mysql -e "set global long_query_time = 10;" \ diff --git a/src/modules/stack/install/ee_mod_setup_mysql.sh b/src/modules/stack/install/ee_mod_setup_mysql.sh index 9804d02b..5644ecda 100644 --- a/src/modules/stack/install/ee_mod_setup_mysql.sh +++ b/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 if [ $? -ne 0 ]; then 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 } diff --git a/src/vendor/ee_ven_install_utils.sh b/src/vendor/ee_ven_install_utils.sh index c37e827b..b211c71f 100644 --- a/src/vendor/ee_ven_install_utils.sh +++ b/src/vendor/ee_ven_install_utils.sh @@ -108,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 " --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 " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"$EE_MYSQL_GRANT_HOST\\\"\" /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 "}" >> /etc/logrotate.d/mysql-server else @@ -116,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 " --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 " --no-report --limit=0% --filter=\" \\\$event->{Bytes} = length(\\\$event->{arg}) and \\\$event->{hostname}="\\\"$EE_MYSQL_GRANT_HOST\\\"\" /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 "}" >> /etc/logrotate.d/mysql-server fi From f2ac14728527f6547ef7c0b194d5e4a498524265 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 17 Sep 2014 16:39:20 +0530 Subject: [PATCH 26/27] Fixed EasyEngine log folder permissions --- bin/install | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/install b/bin/install index 4e83a263..81e8403c 100644 --- a/bin/install +++ b/bin/install @@ -82,12 +82,20 @@ function ee_lib_package_check() done } - # Pre checks to avoid later screw ups # Checking EasyEngine (ee) log directory if [ ! -d $EE_LOG_DIR ]; then 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 = " $? + + # 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 # Install required packages From f1aa233c3472213ccafe77b761d487c22aaab812 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Wed, 17 Sep 2014 17:12:38 +0530 Subject: [PATCH 27/27] Fixed Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f9c2e332..a2166047 100644 --- a/.travis.yml +++ b/.travis.yml @@ -128,7 +128,7 @@ script: - sudo bash ee stack install mail -- sudo cat /var/log/easyengine/* +- sudo bash -c 'cat /var/log/easyengine/*' - sudo ls /var/www/