Skip to content

Commit 582c58a

Browse files
author
gau1991
committed
Merge branch 'master' into stable
2 parents bc16d05 + 48d1f97 commit 582c58a

File tree

14 files changed

+140
-87
lines changed

14 files changed

+140
-87
lines changed

CONTRIBUTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Contribute to EasyEngine (ee)
2+
3+
This guide details how to use issues and pull requests to improve EasyEngine (ee).
4+
5+
## How to report issue:
6+
7+
Github issue-tracker is used **only** for report bugs and feature request.
8+
9+
Please attach the output of following command when open a new issue/bug
10+
```bash
11+
lsb_release -a
12+
ee -v
13+
ee info
14+
wp --allow-root --info
15+
```
16+
17+
### EasyEngine chat:
18+
Developer & contributor discussion: https://gitter.im/rtCamp/easyengine
19+
20+
21+
### EasyEngine support request:
22+
For support-request please use - http://community.rtcamp.com/c/easyengine
23+
24+
25+
### Pull Requests:
26+
When submitting your code please follow this coding standerds - http://docs.rtcamp.com/easyengine/dev/python/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ EasyEngine (ee) is a python tool, which makes it easy to manage your wordpress s
2323
## Quick Start
2424

2525
```bash
26-
wget -q http://rt.cx/ee && sudo bash ee # install easyengine 3.0.0-beta
26+
wget -q http://rt.cx/ee && sudo bash ee # Install easyengine 3
2727
sudo ee site create example.com --wp # Install required packages & setup WordPress on example.com
2828
```
2929

3030
## Update EasyEngine
3131

3232

33-
Update Procedure For EasyEngine to version 3.0
33+
Update Procedure For EasyEngine to version 3.0.1
3434

3535
```bash
3636
wget -q http://rt.cx/ee && sudo bash ee

config/bash_completion.d/ee_auto.rc

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ _ee_complete()
2929
# IF YOU HAD ANOTHER CONTROLLER, YOU'D HANDLE THAT HERE
3030
"debug")
3131
COMPREPLY=( $(compgen \
32-
-W "--start --nginx --php --fpm --mysql -i --interactive --stop " \
32+
-W "$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null) --start --nginx --php --fpm --mysql -i --interactive --stop " \
3333
-- $cur) )
3434
;;
3535

@@ -66,11 +66,16 @@ _ee_complete()
6666
elif [ $COMP_CWORD -eq 3 ]; then
6767
case "$prev" in
6868
# HANDLE EVERYTHING AFTER THE THIRD LEVEL NAMESPACE
69-
"install" | "purge" | "remove" | "start" | "stop" | "reload")
69+
"install" | "purge" | "remove" )
7070
COMPREPLY=( $(compgen \
7171
-W "--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot" \
7272
-- $cur) )
7373
;;
74+
"start" | "stop" | "reload" | "restart" | "status")
75+
COMPREPLY=( $(compgen \
76+
-W "--nginx --php --mysql --postfix --memcache --dovecot" \
77+
-- $cur) )
78+
;;
7479

7580
"list")
7681
COMPREPLY=( $(compgen \
@@ -121,20 +126,25 @@ _ee_complete()
121126
COMPREPLY=( $(compgen \
122127
-W "--db --files --all" \
123128
-- $cur) )
124-
129+
;;
130+
*)
131+
;;
125132
esac
133+
126134
fi
127135

128136
case "$prev" in
129-
"--wpsubdir" | "--wpsubdomain")
137+
"--wp" | "--wpsubdir" | "--wpsubdomain")
130138
COMPREPLY=( $(compgen \
131139
-W "--w3tc --wpfc --wpsc" \
132140
-- $cur) )
133141
;;
134142

135143
"--web" | "--admin" | "--mail" | "--nginx" | "--php" | "--mysql" | "--postfix" | "--wpcli" | "--phpmyadmin" | "--adminer" | "--utils" | "--memcache" | "--dovecot")
136-
if [[ ${COMP_WORDS[1]} == "stack" ]]; then
144+
if [[ ${COMP_WORDS[2]} == "install" || ${COMP_WORDS[2]} == "purge" || ${COMP_WORDS[2]} == "remove" ]]; then
137145
retlist="--web --admin --mail --nginx --php --mysql --postfix --wpcli --phpmyadmin --adminer --utils --memcache --dovecot"
146+
elif [[ ${COMP_WORDS[2]} == "start" || ${COMP_WORDS[2]} == "reload" || ${COMP_WORDS[2]} == "restart" || ${COMP_WORDS[2]} == "stop" ]]; then
147+
retlist="--nginx --php --mysql --postfix --memcache --dovecot"
138148
elif [[ ${COMP_WORDS[1]} == "debug" ]]; then
139149
retlist="--start --nginx --php --fpm --mysql -i --interactive --stop"
140150
fi
@@ -144,14 +154,27 @@ _ee_complete()
144154
-- $cur) )
145155
;;
146156

147-
"--db" | "--files" | "--all")
157+
"--db" | "--files" )
148158
retlist="--db --files --all"
149159
ret="${retlist[@]/$prev}"
150160
COMPREPLY=( $(compgen \
151161
-W "$(echo $ret)" \
152162
-- $cur) )
153163
;;
154164

165+
"--all")
166+
if [ ${COMP_WORDS[1]} == "clean" ]; then
167+
retlist="--memcache --opcache --fastcgi"
168+
else
169+
retlist="--db --files"
170+
171+
fi
172+
ret="${retlist[@]/$prev}"
173+
COMPREPLY=( $(compgen \
174+
-W "$(echo $ret)" \
175+
-- $cur) )
176+
;;
177+
155178
"--memcache" | "--opcache" | "--fastcgi" | "--all")
156179
retlist="--memcache --opcache --fastcgi --all"
157180
ret="${retlist[@]/$prev}"

ee/cli/plugins/clean.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def default(self):
5050

5151
@expose(hide=True)
5252
def clean_memcache(self):
53-
"""This function Clears memcache"""
53+
"""This function Clears memcache """
5454
try:
5555
if(EEAptGet.is_installed(self, "memcached")):
5656
EEService.restart_service(self, "memcached")

ee/cli/plugins/secure.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ee.core.shellexec import EEShellExec
44
from ee.core.variables import EEVariables
55
from ee.core.logging import Log
6+
from ee.core.git import EEGit
67
import string
78
import random
89
import sys
@@ -55,8 +56,8 @@ def secure_auth(self):
5556
if username == "":
5657
self.app.pargs.user_input = EEVariables.ee_user
5758
if not self.app.pargs.user_pass:
58-
password = input("Provide HTTP authentication "
59-
"password [{0}] :".format(passwd))
59+
password = getpass.getpass("Provide HTTP authentication "
60+
"password [{0}] :".format(passwd))
6061
self.app.pargs.user_pass = password
6162
if password == "":
6263
self.app.pargs.user_pass = passwd
@@ -71,12 +72,8 @@ def secure_auth(self):
7172
.format(username=self.app.pargs.user_input,
7273
password=self.app.pargs.user_pass),
7374
log=False)
74-
Log.info(self, "Successfully changed HTTP authentication"
75-
" username to : {username}"
76-
.format(username=self.app.pargs.user_input), log=False)
77-
Log.info(self, "Successfully changed HTTP authentication"
78-
" password to : {password}"
79-
.format(password=self.app.pargs.user_pass), log=False)
75+
EEGit.add(self, ["/etc/nginx"],
76+
msg="Adding changed secure auth into Git")
8077

8178
@expose(hide=True)
8279
def secure_port(self):
@@ -104,6 +101,9 @@ def secure_port(self):
104101
"{port} default_server ssl;/\" "
105102
"/etc/nginx/sites-available/22222"
106103
.format(port=self.app.pargs.user_input))
104+
EEGit.add(self, ["/etc/nginx"],
105+
msg="Adding changed secure port into Git")
106+
107107
Log.info(self, "Successfully port changed {port}"
108108
.format(port=self.app.pargs.user_input))
109109

@@ -127,6 +127,9 @@ def secure_ip(self):
127127
"\"/deny/i allow {whitelist_adre}\;\""
128128
" /etc/nginx/common/acl.conf"
129129
.format(whitelist_adre=ip_addr))
130+
EEGit.add(self, ["/etc/nginx"],
131+
msg="Adding changed secure ip into Git")
132+
130133
Log.info(self, "Successfully added IP address in acl.conf file")
131134

132135

ee/cli/plugins/site_functions.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,23 @@ def setupdatabase(self, data):
112112
# create MySQL database
113113
Log.info(self, "Setting up database\t\t", end='')
114114
Log.debug(self, "Creating databse {0}".format(ee_db_name))
115-
EEMysql.execute(self, "create database {0}"
115+
EEMysql.execute(self, "create database `{0}`"
116116
.format(ee_db_name), errormsg="Cannot create database")
117117

118118
# Create MySQL User
119119
Log.debug(self, "Creating user {0}".format(ee_db_username))
120-
Log.debug(self, "create user {0}@{1} identified by ''"
120+
Log.debug(self, "create user `{0}`@`{1}` identified by ''"
121121
.format(ee_db_username, ee_mysql_grant_host))
122122
EEMysql.execute(self,
123-
"create user {0}@{1} identified by '{2}'"
123+
"create user `{0}`@`{1}` identified by '{2}'"
124124
.format(ee_db_username, ee_mysql_grant_host,
125125
ee_db_password),
126126
errormsg="Cannot setup database user", log=False)
127127

128128
# Grant permission
129129
Log.debug(self, "Setting up user privileges")
130130
EEMysql.execute(self,
131-
"grant all privileges on {0}.* to {1}@{2}"
131+
"grant all privileges on `{0}`.* to `{1}`@`{2}`"
132132
.format(ee_db_name, ee_db_username, ee_mysql_grant_host),
133133
errormsg="Cannot setup database user privileges")
134134
Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]")
@@ -423,9 +423,10 @@ def site_package_check(self, stype):
423423
Log.debug(self, "Setting packages variable for WP-CLI")
424424
if not EEShellExec.cmd_exec(self, "which wp"):
425425
packages = packages + [["https://github.com/wp-cli/wp-cli/"
426-
"releases/download/v0.17.1/"
427-
"wp-cli.phar", "/usr/bin/wp",
428-
"WP-CLI"]]
426+
"releases/download/v{0}/"
427+
"wp-cli-{0}.phar"
428+
.format(EEVariables.ee_wp_cli),
429+
"/usr/bin/wp", "WP-CLI"]]
429430
return(stack.install(apt_packages=apt_packages, packages=packages,
430431
disp_msg=False))
431432

ee/cli/plugins/stack.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def pre_pref(self, apt_packages):
9090
Log.debug(self, 'Adding key for {0}'
9191
.format(EEVariables.ee_mysql_repo))
9292
EERepo.add_key(self, '1C4CBDCDCD2EFD2A',
93-
keyserver="subkeys.pgp.net")
93+
keyserver="keyserver.ubuntu.com")
9494
chars = ''.join(random.sample(string.ascii_letters, 8))
9595
Log.debug(self, "Pre-seeding MySQL")
9696
EEShellExec.cmd_exec(self, "echo \"percona-server-server-5.6 "
@@ -155,8 +155,8 @@ def post_pref(self, apt_packages, packages):
155155
EEService.reload_service(self, 'postfix')
156156

157157
if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
158-
if ((not os.path.isfile('/etc/nginx/conf.d/ee-nginx.conf')) and
159-
os.path.isfile('/etc/nginx/nginx.conf')):
158+
if ((not EEShellExec.cmd_exec(self, "grep -Hr EasyEngine "
159+
"/etc/nginx")) and os.path.isfile('/etc/nginx/nginx.conf')):
160160
nc = NginxConfig()
161161
Log.debug(self, 'Loading file /etc/nginx/nginx.conf ')
162162
nc.loadf('/etc/nginx/nginx.conf')

ee/cli/plugins/stack_services.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ def start(self):
2424
if self.app.pargs.nginx:
2525
Log.debug(self, "nginx service start")
2626
services = services + ['nginx']
27-
elif self.app.pargs.php:
27+
if self.app.pargs.php:
2828
Log.debug(self, "php5-fpm service start")
2929
services = services + ['php5-fpm']
30-
elif self.app.pargs.mysql:
30+
if self.app.pargs.mysql:
3131
Log.debug(self, "mysql service start")
3232
services = services + ['mysql']
33-
elif self.app.pargs.postfix:
33+
if self.app.pargs.postfix:
3434
Log.debug(self, "postfix service start")
3535
services = services + ['postfix']
36-
elif self.app.pargs.memcache:
36+
if self.app.pargs.memcache:
3737
Log.debug(self, "memcached service start")
3838
services = services + ['memcached']
39-
elif self.app.pargs.dovecot:
39+
if self.app.pargs.dovecot:
4040
Log.debug(self, "dovecot service start")
4141
services = services + ['dovecot']
42-
else:
42+
if not services:
4343
Log.debug(self, "nginx,php5-fpm,mysql,postfix services start")
4444
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
4545
for service in services:
@@ -52,22 +52,22 @@ def stop(self):
5252
if self.app.pargs.nginx:
5353
Log.debug(self, "nginx service stop")
5454
services = services + ['nginx']
55-
elif self.app.pargs.php:
55+
if self.app.pargs.php:
5656
Log.debug(self, "php5-fpm service stop")
5757
services = services + ['php5-fpm']
58-
elif self.app.pargs.mysql:
58+
if self.app.pargs.mysql:
5959
Log.debug(self, "mysql service stop")
6060
services = services + ['mysql']
61-
elif self.app.pargs.postfix:
61+
if self.app.pargs.postfix:
6262
Log.debug(self, "postfix service stop")
6363
services = services + ['postfix']
64-
elif self.app.pargs.memcache:
64+
if self.app.pargs.memcache:
6565
Log.debug(self, "memcached service stop")
6666
services = services + ['memcached']
67-
elif self.app.pargs.dovecot:
67+
if self.app.pargs.dovecot:
6868
Log.debug(self, "dovecot service stop")
6969
services = services + ['dovecot']
70-
else:
70+
if not services:
7171
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
7272
Log.debug(self, "nginx,php5-fpm,mysql,postfix services stop")
7373
for service in services:
@@ -80,22 +80,22 @@ def restart(self):
8080
if self.app.pargs.nginx:
8181
Log.debug(self, "nginx service restart")
8282
services = services + ['nginx']
83-
elif self.app.pargs.php:
83+
if self.app.pargs.php:
8484
Log.debug(self, "php5-fpm service restart")
8585
services = services + ['php5-fpm']
86-
elif self.app.pargs.mysql:
86+
if self.app.pargs.mysql:
8787
Log.debug(self, "mysql service restart")
8888
services = services + ['mysql']
89-
elif self.app.pargs.postfix:
89+
if self.app.pargs.postfix:
9090
Log.debug(self, "postfix service restart")
9191
services = services + ['postfix']
92-
elif self.app.pargs.memcache:
92+
if self.app.pargs.memcache:
9393
Log.debug(self, "memcached service restart")
9494
services = services + ['memcached']
95-
elif self.app.pargs.dovecot:
95+
if self.app.pargs.dovecot:
9696
Log.debug(self, "dovecot service restart")
9797
services = services + ['dovecot']
98-
else:
98+
if not services:
9999
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
100100
for service in services:
101101
Log.debug(self, "nginx,php5-fpm,mysql,postfix services restart")
@@ -108,22 +108,22 @@ def status(self):
108108
if self.app.pargs.nginx:
109109
Log.debug(self, "nginx service status")
110110
services = services + ['nginx']
111-
elif self.app.pargs.php:
111+
if self.app.pargs.php:
112112
Log.debug(self, "php5-fpm service status")
113113
services = services + ['php5-fpm']
114-
elif self.app.pargs.mysql:
114+
if self.app.pargs.mysql:
115115
Log.debug(self, "mysql service status")
116116
services = services + ['mysql']
117-
elif self.app.pargs.postfix:
117+
if self.app.pargs.postfix:
118118
services = services + ['postfix']
119119
Log.debug(self, "postfix service status")
120-
elif self.app.pargs.memcache:
120+
if self.app.pargs.memcache:
121121
Log.debug(self, "memcached service status")
122122
services = services + ['memcached']
123-
elif self.app.pargs.dovecot:
123+
if self.app.pargs.dovecot:
124124
Log.debug(self, "dovecot service status")
125125
services = services + ['dovecot']
126-
else:
126+
if not services:
127127
Log.debug(self, "nginx,php5-fpm,mysql,postfix services status")
128128
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
129129
for service in services:
@@ -137,22 +137,22 @@ def reload(self):
137137
if self.app.pargs.nginx:
138138
Log.debug(self, "nginx service reload")
139139
services = services + ['nginx']
140-
elif self.app.pargs.php:
140+
if self.app.pargs.php:
141141
Log.debug(self, "php5-fpm service reload")
142142
services = services + ['php5-fpm']
143-
elif self.app.pargs.mysql:
143+
if self.app.pargs.mysql:
144144
Log.debug(self, "mysql service reload")
145145
services = services + ['mysql']
146-
elif self.app.pargs.postfix:
146+
if self.app.pargs.postfix:
147147
Log.debug(self, "postfix service reload")
148148
services = services + ['postfix']
149-
elif self.app.pargs.memcache:
149+
if self.app.pargs.memcache:
150150
Log.debug(self, "memcached service reload")
151151
services = services + ['memcached']
152-
elif self.app.pargs.dovecot:
152+
if self.app.pargs.dovecot:
153153
Log.debug(self, "dovecot service reload")
154154
services = services + ['dovecot']
155-
else:
155+
if not services:
156156
services = services + ['nginx', 'php5-fpm', 'mysql', 'postfix']
157157
for service in services:
158158
Log.debug(self, "nginx,php5-fpm,mysql,postfix services reload")

0 commit comments

Comments
 (0)