Skip to content

Commit dc0d5eb

Browse files
author
shital.rtcamp
committed
Merge branch 'python' of https://github.com/rtCamp/easyengine into python
2 parents 31907b4 + e15bd87 commit dc0d5eb

File tree

20 files changed

+422
-163
lines changed

20 files changed

+422
-163
lines changed

README.md

Lines changed: 83 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,96 @@
1+
IMPORTANT
2+
============================================
13

2-
How To setup this version on your system??
4+
#### We are looking for [Python Developers] (https://rtcamp.com/careers/python-developer/) to join our team. We offer work from home, so you can join EasyEngine team anywhere! _[Why Python?] (https://rtcamp.com/blog/easyengine-3-roadmap/#whypython)_
5+
6+
---
7+
8+
[![Stories in Ready](https://badge.waffle.io/rtcamp/easyengine.png?label=ready&title=Ready)](https://waffle.io/rtcamp/easyengine)
9+
[![Stories in Progress](https://badge.waffle.io/rtcamp/easyengine.png?label=in%20progress&title=In%20Progress)](https://waffle.io/rtcamp/easyengine)
10+
11+
<img src="https://d3qt5vpr7p9rgn.cloudfront.net/wp-content/uploads/2013/08/easy-engine-logo-2-RS1.png" alt="EasyEngine Logo" align="right" />
12+
13+
[![Travis Build Status](https://travis-ci.org/rtCamp/easyengine.svg "Travis Build Status")] (https://travis-ci.org/rtCamp/easyengine)
14+
15+
EasyEngine (ee) is a linux shell-script collection, which makes it easy to manage your wordpress sites running on nginx web-server.
16+
17+
**EasyEngine currently supports:**
18+
19+
- Ubuntu 12.04 & 14.04
20+
- Debian 7
21+
22+
## Quick Start
23+
24+
```bash
25+
wget -qO ee rt.cx/ee && sudo bash ee # install easyengine
26+
sudo ee site create example.com --wp # Install required packages & setup WordPress on example.com
27+
```
28+
29+
## Update EasyEngine
30+
31+
32+
Update Procedure For EasyEngine
33+
34+
```bash
35+
wget -qO eeup http://rt.cx/eeup && sudo bash eeup
36+
```
37+
38+
## More Site Creation Commands
39+
40+
### Standard WordPress Sites
341

442
```bash
5-
sudo apt-get install python3-pip git
6-
sudo pip3 install virtualenv
7-
git clone -b python https://github.com/rtCamp/easyengine.git
8-
cd easyengine
9-
virtualenv ./env --system-site-packages
10-
source ./env/bin/activate
11-
sudo pip3 install -r requirements.txt
12-
sudo python3 setup.py develop
13-
ee --help
43+
ee site create example.com --wp # install wordpress without any page caching
44+
ee site create example.com --w3tc # install wordpress with w3-total-cache plugin
45+
ee site create example.com --wpsc # install wordpress with wp-super-cache plugin
46+
ee site create example.com --wpfc # install wordpress + nginx fastcgi_cache
1447
```
1548

16-
How to install this version on your system??
49+
### WordPress Multsite with subdirectory
50+
1751
```bash
18-
sudo apt-get update
19-
sudo apt-get -y install python3 python3-apt python3-setuptools python3-dev git
20-
git clone -b python https://github.com/rtCamp/easyengine.git
21-
cd easyengine
22-
sudo python3 setup.py install
23-
ee --help
52+
ee site create example.com --wpsubdir # install wpmu-subdirectory without any page caching
53+
ee site create example.com --wpsubdir --w3tc # install wpmu-subdirectory with w3-total-cache plugin
54+
ee site create example.com --wpsubdir --wpsc # install wpmu-subdirectory with wp-super-cache plugin
55+
ee site create example.com --wpsubdir --wpfc # install wpmu-subdirectory + nginx fastcgi_cache
2456
```
2557

58+
### WordPress Multsite with subdomain
59+
60+
```bash
61+
ee site create example.com --wpsubdomin # install wpmu-subdomain without any page caching
62+
ee site create example.com --wpsubdomain --w3tc # install wpmu-subdomain with w3-total-cache plugin
63+
ee site create example.com --wpsubdomain --wpsc # install wpmu-subdomain with wp-super-cache plugin
64+
ee site create example.com --wpsubdomain --wpfc # install wpmu-subdomain + nginx fastcgi_cache
65+
```
66+
67+
### Non-WordPress Sites
68+
```bash
69+
ee site create example.com --html # create example.com for static/html sites
70+
ee site create example.com --php # create example.com with php support
71+
ee site create example.com --mysql # create example.com with php & mysql support
72+
```
73+
74+
## Cheatsheet - Site creation
75+
76+
77+
| | Single Site | Multisite w/ Subdir | Multisite w/ Subdom |
78+
|--------------------|---------------|-----------------------|-----------------------|
79+
| **NO Cache** | --wp | --wpsubdir | --wpsubdomain |
80+
| **WP Super Cache** | --wpsc | --wpsubdir --wpsc | --wpsubdomain --wpsc |
81+
| **W3 Total Cache** | --w3tc | --wpsubdir --w3tc | --wpsubdomain --w3tc |
82+
| **Nginx cache** | --wpfc | --wpsubdir --wpfc | --wpsubdomain --wpfc |
83+
2684

27-
EasyEngine 3.x Developement version
85+
## Useful Links
86+
- [Documentation] (http://rtcamp.com/easyengine/docs/)
87+
- [FAQ] (http://rtcamp.com/easyengine/faq/)
88+
- [Conventions used] (http://rtcamp.com/wordpress-nginx/tutorials/conventions/)
2889

90+
## Donations
2991

30-
Thinking To Contribute???
92+
[![Donate](https://cloud.githubusercontent.com/assets/4115/5297691/c7b50292-7bd7-11e4-987b-2dc21069e756.png)] (https://rtcamp.com/donate/?project=easyengine)
3193

32-
refer docs to know more on EasyEngine Developement
94+
## License
3395

34-
follow instruction from step 3 in Creating cement app
35-
http://builtoncement.com/2.4/dev/boss_templates.html
96+
Same [GPL] (http://www.gnu.org/licenses/gpl-2.0.txt) that WordPress uses!

config/plugins.d/site.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66
### `ee.cli.plugins.example` or from the file path
77
### `/var/lib/ee/plugins/example.py`
88
enable_plugin = true
9-
db_path = sqlite:////var/lib/ee/ee.sqlite

ee/cli/plugins/debug.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class Meta:
5353

5454
@expose(hide=True)
5555
def debug_nginx(self):
56+
"""Start/Stop Nginx debug"""
5657
# start global debug
5758
if self.start and not self.app.pargs.site_name:
5859
try:
@@ -134,6 +135,7 @@ def debug_nginx(self):
134135

135136
@expose(hide=True)
136137
def debug_php(self):
138+
"""Start/Stop PHP debug"""
137139
# PHP global debug start
138140
if self.start:
139141
if not (EEShellExec.cmd_exec(self, "sed -n \"/upstream php"
@@ -173,6 +175,7 @@ def debug_php(self):
173175

174176
@expose(hide=True)
175177
def debug_fpm(self):
178+
"""Start/Stop PHP5-FPM debug"""
176179
# PHP5-FPM start global debug
177180
if self.start:
178181
if not EEShellExec.cmd_exec(self, "grep \"log_level = debug\" "
@@ -214,6 +217,7 @@ def debug_fpm(self):
214217

215218
@expose(hide=True)
216219
def debug_mysql(self):
220+
"""Start/Stop MySQL debug"""
217221
# MySQL start global debug
218222
if self.start:
219223
if not EEShellExec.cmd_exec(self, "mysql -e \"show variables like"
@@ -262,6 +266,7 @@ def debug_mysql(self):
262266

263267
@expose(hide=True)
264268
def debug_wp(self):
269+
"""Start/Stop WordPress debug"""
265270
if self.start and self.app.pargs.site_name:
266271
wp_config = ("{0}{1}/wp-config.php"
267272
.format(EEVariables.ee_webroot,
@@ -332,6 +337,7 @@ def debug_wp(self):
332337

333338
@expose(hide=True)
334339
def debug_rewrite(self):
340+
"""Start/Stop Nginx rewrite rules debug"""
335341
# Start Nginx rewrite debug globally
336342
if self.start and not self.app.pargs.site_name:
337343
if not EEShellExec.cmd_exec(self, "grep \"rewrite_log on;\" "
@@ -396,6 +402,7 @@ def debug_rewrite(self):
396402

397403
@expose(hide=True)
398404
def signal_handler(self, signal, frame):
405+
"""Handle Ctrl+c hevent for -i option of debug"""
399406
self.start = False
400407
if self.app.pargs.nginx:
401408
self.debug_nginx()
@@ -421,6 +428,7 @@ def signal_handler(self, signal, frame):
421428

422429
@expose(hide=True)
423430
def default(self):
431+
"""Default function of debug"""
424432
self.start = True
425433
self.interactive = False
426434
self.msg = []

ee/cli/plugins/import_slow_log.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Meta:
1919

2020
@expose(hide=True)
2121
def default(self):
22+
"""Default function for import slow log"""
2223
if os.path.isdir("{0}22222/htdocs/db/anemometer"
2324
.format(EEVariables.ee_webroot)):
2425
if os.path.isfile("/var/log/mysql/mysql-slow.log"):

ee/cli/plugins/info.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Meta:
3636

3737
@expose(hide=True)
3838
def info_nginx(self):
39+
"""Display Nginx information"""
3940
version = os.popen("nginx -v 2>&1 | cut -d':' -f2 | cut -d' ' -f2 | "
4041
"cut -d'/' -f2 | tr -d '\n'").read()
4142
allow = os.popen("grep ^allow /etc/nginx/common/acl.conf | "
@@ -65,6 +66,7 @@ def info_nginx(self):
6566

6667
@expose(hide=True)
6768
def info_php(self):
69+
"""Display PHP information"""
6870
version = os.popen("php -v | head -n1 | cut -d' ' -f2 |"
6971
" cut -d'+' -f1 | tr -d '\n'").read
7072
config = configparser.ConfigParser()
@@ -138,6 +140,7 @@ def info_php(self):
138140

139141
@expose(hide=True)
140142
def info_mysql(self):
143+
"""Display MySQL information"""
141144
version = os.popen("mysql -V | awk '{print($5)}' | cut -d ',' "
142145
"-f1 | tr -d '\n'").read()
143146
host = "localhost"
@@ -165,6 +168,7 @@ def info_mysql(self):
165168

166169
@expose(hide=True)
167170
def default(self):
171+
"""default function for info"""
168172
if (not self.app.pargs.nginx and not self.app.pargs.php
169173
and not self.app.pargs.mysql):
170174
self.app.pargs.nginx = True

ee/cli/plugins/site.py

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ def info(self):
7979
ee_db_pass = ''
8080
if os.path.isfile('/etc/nginx/sites-available/{0}'
8181
.format(ee_domain)):
82+
check_site = getSiteInfo(self, ee_domain)
83+
if check_site is None:
84+
Log.error(self, " Site {0} does not exist.".format(ee_domain))
85+
else:
86+
sitetype = check_site.site_type
87+
cachetype = check_site.cache_type
88+
8289
ee_site_webroot = EEVariables.ee_webroot + ee_domain
8390
access_log = (ee_site_webroot + '/logs/access.log')
8491
error_log = (ee_site_webroot + '/logs/error.log')
@@ -98,7 +105,10 @@ def info(self):
98105
data = dict(domain=ee_domain, webroot=ee_site_webroot,
99106
accesslog=access_log, errorlog=error_log,
100107
dbname=ee_db_name, dbuser=ee_db_user,
101-
dbpass=ee_db_pass)
108+
dbpass=ee_db_pass, type=sitetype + " " + cachetype +
109+
" ({0})".format("enabled"
110+
if check_site.is_enabled else
111+
"disabled"))
102112
self.app.render((data), 'siteinfo.mustache')
103113
else:
104114
Log.error(self, " site {0} does not exists".format(ee_domain))
@@ -578,9 +588,9 @@ def default(self):
578588
or self.app.pargs.wpfc or self.app.pargs.wpsc)):
579589

580590
if ((oldsitetype not in ['html', 'php', 'mysql', 'wp'])
581-
or (oldsitetype is 'wp' and oldcachetype is 'basic')):
582-
print(oldsitetype, oldcachetype)
583-
Log.error(self, " Cannot update {0}, {1} {2} to wp basic"
591+
or (oldsitetype == 'wp' and oldcachetype == 'basic')):
592+
593+
Log.error(self, "Cannot update {0} {1} {2} to wp basic"
584594
.format(ee_domain, oldsitetype, oldcachetype))
585595

586596
data = dict(site_name=ee_domain, www_domain=ee_www_domain,
@@ -597,8 +607,8 @@ def default(self):
597607
(self.app.pargs.wpfc or self.app.pargs.wpsc)):
598608

599609
if (oldsitetype not in ['html', 'php', 'mysql', 'wp']
600-
or (oldsitetype is 'wp' and oldcachetype is 'w3tc')):
601-
Log.error(self, " Cannot update {0}, {1} {2} to wp w3tc"
610+
or (oldsitetype == 'wp' and oldcachetype == 'w3tc')):
611+
Log.error(self, "Cannot update {0}, {1} {2} to wp w3tc"
602612
.format(ee_domain, oldsitetype, oldcachetype))
603613

604614
data = dict(site_name=ee_domain, www_domain=ee_www_domain,
@@ -616,7 +626,7 @@ def default(self):
616626
(self.app.pargs.wpsc or self.app.pargs.w3tc)):
617627

618628
if (oldsitetype not in ['html', 'php', 'mysql', 'wp']
619-
or (oldsitetype is 'wp' and oldcachetype is 'wpfc')):
629+
or (oldsitetype == 'wp' and oldcachetype == 'wpfc')):
620630
Log.error(self, "Cannot update {0}, {1} {2} to wp wpfc"
621631
.format(ee_domain, oldsitetype, oldcachetype))
622632

@@ -634,7 +644,7 @@ def default(self):
634644
(self.app.pargs.w3tc or self.app.pargs.wpfc)):
635645

636646
if (oldsitetype not in ['html', 'php', 'mysql', 'wp']
637-
or (oldsitetype is 'wp' and oldcachetype is 'wpsc')):
647+
or (oldsitetype == 'wp' and oldcachetype == 'wpsc')):
638648
Log.error(self, "Cannot update {0}, {1} {2} to wp wpsc"
639649
.format(ee_domain, oldsitetype, oldcachetype))
640650

@@ -657,7 +667,7 @@ def default(self):
657667

658668
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
659669
'wpsubdir']
660-
or (oldsitetype is 'wpsubdir' and oldcachetype is 'basic')):
670+
or (oldsitetype == 'wpsubdir' and oldcachetype == 'basic')):
661671
Log.error(self, " Cannot update {0}, {1} {2} "
662672
"to wpsubdir basic"
663673
.format(ee_domain, oldsitetype, oldcachetype))
@@ -677,7 +687,7 @@ def default(self):
677687

678688
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
679689
'wpsubdir']
680-
or (oldsitetype is 'wpsubdir' and oldcachetype is 'w3tc')):
690+
or (oldsitetype == 'wpsubdir' and oldcachetype == 'w3tc')):
681691
Log.error(self, " Cannot update {0} {1} {2}"
682692
"to wpsubdir w3tc"
683693
.format(ee_domain, oldsitetype, oldcachetype))
@@ -698,8 +708,8 @@ def default(self):
698708

699709
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
700710
'wpsubdir']
701-
or (oldsitetype is 'wpsubdir' and oldcachetype is 'wpfc')):
702-
Log.error(self, " Cannot update {0} {1} {2}"
711+
or (oldsitetype == 'wpsubdir' and oldcachetype == 'wpfc')):
712+
Log.error(self, "Cannot update {0} {1} {2}"
703713
" to wpsubdir wpfc"
704714
.format(ee_domain, oldsitetype, oldcachetype))
705715

@@ -718,7 +728,7 @@ def default(self):
718728

719729
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
720730
'wpsubdir']
721-
or (oldsitetype is 'wpsubdir' and oldcachetype is 'wpsc')):
731+
or (oldsitetype == 'wpsubdir' and oldcachetype == 'wpsc')):
722732
Log.error(self, " Cannot update {0} {1} {2}"
723733
" to wpsubdir wpsc"
724734
.format(ee_domain, oldsitetype, oldcachetype))
@@ -736,13 +746,16 @@ def default(self):
736746
if (self.app.pargs.wpsubdomain and not (self.app.pargs.html or
737747
self.app.pargs.php or self.app.pargs.mysql or
738748
self.app.pargs.wpsubdir or self.app.pargs.wp)):
749+
if (self.app.pargs.wpsubdomain and not (self.app.pargs.w3tc
750+
or self.app.pargs.wpfc or self.app.pargs.wpsc)):
751+
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
752+
'wpsubdomain']
753+
or (oldsitetype == 'wpsubdomain' and
754+
oldcachetype == 'basic')):
739755

740-
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
741-
'wpsubdomain']
742-
or (oldsitetype is 'wpsubdomain' and oldcachetype is 'basic')):
743-
Log.error(self, " Cannot update {0} {1} {2}"
744-
" to wpsubdomain basic"
745-
.format(ee_domain, oldsitetype, oldcachetype))
756+
Log.error(self, " Cannot update {0} {1} {2}"
757+
" to wpsubdomain basic"
758+
.format(ee_domain, oldsitetype, oldcachetype))
746759

747760
data = dict(site_name=ee_domain, www_domain=ee_www_domain,
748761
static=False, basic=True, wp=True, w3tc=False,
@@ -760,7 +773,8 @@ def default(self):
760773

761774
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
762775
'wpsubdomain'] or
763-
(oldsitetype is 'wpsubdomain' and oldcachetype is 'w3tc')):
776+
(oldsitetype == 'wpsubdomain' and oldcachetype == 'w3tc')):
777+
print(oldsitetype, oldcachetype)
764778
Log.error(self, " Cannot update {0}, {1} {2}"
765779
" to wpsubdomain w3tc"
766780
.format(ee_domain, oldsitetype, oldcachetype))
@@ -781,7 +795,8 @@ def default(self):
781795

782796
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
783797
'wpsubdomain'] or
784-
(oldsitetype is 'wpsubdomain' and oldcachetype is 'wpfc')):
798+
(oldsitetype == 'wpsubdomain' and oldcachetype == 'wpfc')):
799+
print(oldsitetype, oldcachetype)
785800
Log.error(self, " Cannot update {0}, {1} {2} "
786801
"to wpsubdomain wpfc"
787802
.format(ee_domain, oldsitetype, oldcachetype))
@@ -802,7 +817,8 @@ def default(self):
802817

803818
if (oldsitetype not in ['html', 'php', 'mysql', 'wp',
804819
'wpsubdomain'] or
805-
(oldsitetype is 'wpsubdomain' and oldcachetype is 'wpsc')):
820+
(oldsitetype == 'wpsubdomain' and oldcachetype == 'wpsc')):
821+
print(oldsitetype, oldcachetype)
806822
Log.error(self, " Cannot update {0}, {1} {2}"
807823
" to wpsubdomain wpsc"
808824
.format(ee_domain, oldsitetype, oldcachetype))

0 commit comments

Comments
 (0)