Skip to content

Commit d2affbe

Browse files
author
gau1991
committed
Merge branch 'mail'
Conflicts: CHANGELOG.txt
2 parents 12ef206 + 228bd8c commit d2affbe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+976
-68
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ script:
126126
- sudo bash ee debug
127127
- sudo bash ee debug --stop
128128

129+
- sudo bash ee stack install mail
130+
129131
- sudo cat /var/log/easyengine/*
130132

131133

CHANGELOG.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
v 2.1.0 - Sept 2, 2014
2+
- Added Mail Server Package installation #65
3+
- Fixed incorrect log file path during debug #299
4+
- Added support for pt-query-advisor #189
5+
- Fixed Firefox cross-domain fonts
6+
- Fixed ee site edit command on Nano editor
7+
8+
19
v 2.0.2 - Aug 13, 2014
210
- Remote MySQL Support
311

bin/easyengine

Lines changed: 91 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
9090

9191
# Display success message
9292
ee_lib_echo "$EE_THIRD successfully installed"
93-
elif [ "$EE_THIRD" = "" ]; then
93+
elif [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ]; then
9494
# Setup NGINX/PHP repository
9595
ee_mod_repo_nginx
9696
ee_mod_repo_php
@@ -125,9 +125,68 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
125125
ee_ven_install_utils
126126

127127
# Display success message
128-
ee_lib_echo "Successfully installed all packages"
129-
ee_lib_echo "Create your first WordPress site powered by NGINX using:"
130-
ee_lib_echo_info "ee site create example.com --wp"
128+
if [ "$EE_THIRD" != "all" ];then
129+
ee_lib_echo "Successfully installed web server packages"
130+
ee_lib_echo "Create your first WordPress site powered by NGINX using:"
131+
ee_lib_echo_info "ee site create example.com --wp"
132+
fi
133+
fi
134+
# EasyEngine mail server setup
135+
if [ "$EE_THIRD" = "mail" ] || [ "$EE_THIRD" = "all" ];then
136+
137+
# Check required Packages are installed or not
138+
dpkg --get-selections | grep -v deinstall | grep nginx > /dev/null \
139+
&& dpkg --get-selections | grep -v deinstall | grep php5-fpm > /dev/null \
140+
&& mysqladmin ping &> /dev/null \
141+
&& dpkg --get-selections | grep -v deinstall | grep postfix > /dev/null
142+
if [ $? -ne 0 ];then
143+
ee_lib_error "Failed to find NGINX PHP MySQL Postfix, exit status=" 1
144+
fi
145+
146+
dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null
147+
if [ $? -eq 0 ];then
148+
ee_lib_error "Found installed Dovecot Packages server, exit status=" 1
149+
fi
150+
151+
# Install Dovecot
152+
ee_mod_install_dovecot
153+
154+
# Install mail scanner packages
155+
ee_mod_install_mailscan
156+
157+
# Install ViMbAdmin
158+
ee_ven_install_vimbadmin
159+
160+
# Install Roundcube
161+
ee_ven_install_roundcube
162+
163+
# Configure PostFix
164+
ee_mod_setup_postfix
165+
166+
# Configure Dovecot
167+
ee_mod_setup_dovecot
168+
169+
# Setup Amavis
170+
ee_mod_setup_mailscan
171+
172+
# Setup ViMbAdmin
173+
ee_ven_setup_vimbadmin
174+
175+
# Setup Roundcube
176+
ee_ven_setup_roundcube
177+
178+
# Setup Sieve Rules
179+
ee_mod_setup_sieve
180+
181+
ee_lib_service nginx postfix dovecot amavis restart
182+
183+
ee_lib_git /etc/nginx /etc/postfix /etc/dovecot /etc/amavis "Initialize Git"
184+
185+
# Display message for mail server
186+
ee_lib_echo_escape "Configure ViMbAdmin:\thttps://$(hostname -f):22222/vimbadmin"
187+
ee_lib_echo_escape "Security Salt:\t\t${ee_security_salt}\n"
188+
189+
ee_lib_echo "Successfully installed mail server packages"
131190
fi
132191

133192
# EasyEngine remove/purge
@@ -153,7 +212,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
153212
elif [ "$EE_SECOND" = "purge" ];then
154213
ee_lib_echo "$EE_THIRD successfully purged"
155214
fi
156-
elif [ "$EE_THIRD" = "" ]; then
215+
elif [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ]; then
157216
# Remove/Purge NGINX/PHP/MySQL/Postfix package
158217
ee_mod_remove_nginx
159218
ee_mod_remove_php
@@ -171,11 +230,35 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then
171230

172231
# Display success message
173232
if [ "$EE_SECOND" = "remove" ];then
174-
ee_lib_echo "Successfully removed all packages"
233+
ee_lib_echo "Successfully removed web packages"
234+
elif [ "$EE_SECOND" = "purge" ];then
235+
ee_lib_echo "Successfully purged web packages"
236+
fi
237+
fi
238+
if [ "$EE_THIRD" = "all" ] || [ "$EE_THIRD" = "mail" ];then
239+
# Remove Dovecot
240+
ee_mod_remove_dovecot
241+
242+
# Remove Amavis
243+
ee_mod_remove_mailscan
244+
245+
# Remove ViMbAdmin
246+
ee_ven_remove_vimbadmin
247+
248+
# Remove Roundcube
249+
ee_ven_remove_roundcube
250+
251+
# Execute: apt-get autoremove
252+
ee_lib_autoremove
253+
254+
# Display success message
255+
if [ "$EE_SECOND" = "remove" ];then
256+
ee_lib_echo "Successfully removed mail server packages"
175257
elif [ "$EE_SECOND" = "purge" ];then
176-
ee_lib_echo "Successfully purged all packages"
258+
ee_lib_echo "Successfully purged mail server packages"
177259
fi
178260
fi
261+
179262
elif [ "$EE_SECOND" = "status" ]; then
180263
ee_mod_stack_status
181264
elif [ "$EE_SECOND" = "start" ] || [ "$EE_SECOND" = "stop" ] || [ "$EE_SECOND" = "reload" ] || [ "$EE_SECOND" = "restart" ]; then
@@ -201,7 +284,7 @@ elif [ "$EE_FIRST" = "site" ]; then
201284
|| ee_lib_error "Unable to display list of sites-available websites, exit status = " $?
202285
else
203286
ee_lib_echo "List of sites-enabled websites:"
204-
ls /etc/nginx/sites-available/ \
287+
ls /etc/nginx/sites-enabled/ \
205288
|| ee_lib_error "Unable to display list of sites-enabled websites, exit status = " $?
206289
fi
207290
elif [ "$EE_SECOND" = "info" ] || [ "$EE_SECOND" = "show" ]; then

bin/install

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ readonly EE_LOG_DIR=/var/log/easyengine
4242
readonly EE_INSTALL_LOG=/var/log/easyengine/install.log
4343
readonly EE_ERROR_LOG=/var/log/easyengine/error.log
4444
readonly EE_LINUX_DISTRO=$(lsb_release -i |awk '{print $3}')
45+
readonly EE_DEBIAN_VERSION=$(lsb_release -sc)
4546

4647
# Checking linux distro
4748
if [ "$EE_LINUX_DISTRO" != "Ubuntu" ] && [ "$EE_LINUX_DISTRO" != "Debian" ]; then
@@ -81,6 +82,27 @@ function ee_lib_package_check()
8182
done
8283
}
8384

85+
# Check hostname is FQDN or not. If not set it
86+
function ee_lib_check_fqdn()
87+
{
88+
case $1 in
89+
*.*)
90+
if [ "$EE_FQDN" != "" ];then
91+
echo $EE_FQDN > /etc/hostname
92+
if [ "$EE_DEBIAN_VERSION" == "squeeze" ];then
93+
/etc/init.d/hostname.sh start &>> $EE_INSTALL_LOG
94+
else
95+
service hostname restart &>> $EE_INSTALL_LOG
96+
fi
97+
hostname -f &>> $EE_INSTALL_LOG
98+
fi
99+
;;
100+
*)
101+
read -p "Enter hostname [FQDN]: " EE_FQDN
102+
ee_lib_check_fqdn $EE_FQDN
103+
;;
104+
esac
105+
}
84106

85107
# Pre checks to avoid later screw ups
86108
# Checking EasyEngine (ee) log directory
@@ -184,6 +206,8 @@ fi
184206
cp -a /tmp/easyengine/docs/man/ee.8 /usr/share/man/man8/ &>> $EE_INSTALL_LOG \
185207
|| ee_lib_error "Unable to copy EasyEngine (ee) man page, exit status = " $?
186208

209+
# Make hostname as FQDN
210+
ee_lib_check_fqdn $(hostname -f)
187211

188212
# Git config settings
189213
GIT_USER_NAME=$(git config user.name)

bin/update

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
285285
|| ee_lib_error "Unable to generate SSL certificate for port 22222, exit status = " $?
286286

287287
# Update PHP configuration
288-
dpkg -l | grep php5-fpm &>> $EE_UPDATE_LOG
288+
dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG
289289
if [ $? -eq 0 ]; then
290290
ee_lib_echo "Installing php5-xdebug package, please wait..."
291291
apt-get -y install php5-xdebug \
@@ -325,7 +325,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
325325
|| ee_lib_error "Unable to add xdebug settings for debug pool, exit status = " $?
326326
fi
327327

328-
dpkg -l | grep mysql-server &>> $EE_UPDATE_LOG
328+
dpkg --get-selections | grep -v deinstall | grep mysql-server &>> $EE_UPDATE_LOG
329329
if [ $? -eq 0 ]; then
330330
ee_lib_echo "Installing percona-toolkit package, please wait..."
331331
apt-get -y install percona-toolkit \
@@ -395,8 +395,11 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
395395
done
396396
fi
397397

398+
# Make hostname as FQDN
399+
ee_lib_check_fqdn $(hostname -f)
400+
398401
if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then
399-
dpkg -l | grep php5-fpm &>> $EE_UPDATE_LOG
402+
dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG
400403
if [ $? -eq 0 ]; then
401404

402405
# WP-CLI change the installation method
@@ -414,6 +417,34 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then
414417
fi
415418
fi
416419

420+
if [[ $EE_CURRENT_VERSION < 2.1.0 ]];then
421+
if [ -f /etc/nginx/sites-available/22222 ];then
422+
ee_port=$(grep listen /etc/nginx/sites-available/22222 | awk '{ print $2 }')
423+
cp -av /usr/share/easyengine/nginx/22222 /etc/nginx/sites-available/ &>> $EE_UPDATE_LOG
424+
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then
425+
sed -i "s/listen.*/listen $ee_port default_server ssl spdy;/" /etc/nginx/sites-available/22222 \
426+
|| ee_lib_error "Unable to change EasyEngine admin port, exit status = " $?
427+
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then
428+
# Dotdeb nginx repository doesn't support spdy
429+
sed -i "s/listen.*/listen $ee_port default_server ssl;/" /etc/nginx/sites-available/22222 \
430+
|| ee_lib_error "Unable to change EasyEngine admin port, exit status = " $?
431+
fi
432+
fi
433+
if [ -d /var/www/22222/htdocs/db/anemometer ];then
434+
# Download pt-query-advisor Fixed #189
435+
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 \
436+
|| ee_lib_error "Unable to copy download pt-query-advisor, exit status = " $?
437+
chmod 0755 /usr/bin/pt-query-advisor
438+
439+
# Enable pt-query-advisor plugin in Anemometer
440+
sed -i "s/# 'query_advisor'/ 'query_advisor'/" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \
441+
|| ee_lib_error "Unable to to activate pt-query-advisor plugin, exit status = " $?
442+
fi
443+
444+
# Update EasyEngine current version
445+
EE_CURRENT_VERSION="2.1.0"
446+
fi
447+
417448
# Restart service
418449
ee_lib_service nginx php5-fpm restart
419450

config/bash_completion.d/ee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function EE_AUTO()
2525
;;
2626

2727
install|remove|purge)
28-
COMPREPLY=( $( compgen -W '$( cd /usr/local/lib/easyengine/modules/stack/install; find -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)' -- $CURRENT ) )
28+
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 ) )
2929
return 0
3030
;;
3131

config/nginx/common/locations.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ location = /robots.txt {
1515

1616
# Cache static files
1717
location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ {
18+
add_header "Access-Control-Allow-Origin" "*";
1819
access_log off;
1920
log_not_found off;
2021
expires max;

docs/man/ee.8

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.SH SYNOPSIS
66
ee [ version | help | info | stack | site | debug | update ]
77
.TP
8-
ee stack [ install | remove | purge ] [ nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ]
8+
ee stack [ install | remove | purge ] [ --web | --mail | --all | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ]
99
.TP
1010
ee stack [ status | start | stop | reload | restart ]
1111
.TP
@@ -44,19 +44,19 @@ Display easyengine (ee) help.
4444
.TP
4545
.B stack
4646
.TP
47-
.B install [ nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ]
47+
.B install [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ]
4848
.br
4949
Install Nginx PHP5 MySQL Postfix stack Packages if not used with
5050
.br
5151
any options.Installs specific package if used with option.
5252
.TP
53-
.B remove [ nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ]
53+
.B remove [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ]
5454
.br
5555
Remove Nginx PHP5 MySQL Postfix stack Packages if not used with
5656
.br
5757
any options. Remove specific package if used with option.
5858
.TP
59-
.B purge [ nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ]
59+
.B purge [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ]
6060
.br
6161
Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any
6262
.br

src/lib/ee_lib_check_fqdn.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Check Server hostname is FQDN or not
2+
3+
function ee_lib_check_fqdn()
4+
{
5+
case $1 in
6+
*.*)
7+
if [ "$EE_FQDN" != "" ];then
8+
echo $EE_FQDN > /etc/hostname
9+
if [ "$EE_DEBIAN_VERSION" == "squeeze" ];then
10+
/etc/init.d/hostname.sh start &>> $EE_COMMAND_LOG
11+
else
12+
service hostname restart &>> $EE_COMMAND_LOG
13+
fi
14+
hostname -f &>> $EE_COMMAND_LOG
15+
fi
16+
;;
17+
*)
18+
read -p "Enter hostname [FQDN]: " EE_FQDN
19+
ee_lib_check_fqdn $EE_FQDN
20+
;;
21+
esac
22+
}

src/lib/ee_lib_error.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
function ee_lib_error()
44
{
5-
echo "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG
5+
echo -e "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG
66
exit $2
77
}

0 commit comments

Comments
 (0)