gau1991
10 years ago
201 changed files with 483 additions and 7070 deletions
@ -0,0 +1,65 @@ |
|||
# Byte-compiled / optimized / DLL files |
|||
__pycache__/ |
|||
*.py[cod] |
|||
|
|||
# C extensions |
|||
*.so |
|||
|
|||
# Distribution / packaging |
|||
.Python |
|||
env/ |
|||
build/ |
|||
develop-eggs/ |
|||
dist/ |
|||
downloads/ |
|||
eggs/ |
|||
lib/ |
|||
lib64/ |
|||
parts/ |
|||
sdist/ |
|||
var/ |
|||
*.egg-info/ |
|||
.installed.cfg |
|||
*.egg |
|||
|
|||
# PyInstaller |
|||
# Usually these files are written by a python script from a template |
|||
# before PyInstaller builds the exe, so as to inject date/other infos into it. |
|||
*.manifest |
|||
*.spec |
|||
|
|||
# Installer logs |
|||
pip-log.txt |
|||
pip-delete-this-directory.txt |
|||
|
|||
# Unit test / coverage reports |
|||
htmlcov/ |
|||
.tox/ |
|||
.coverage |
|||
.cache |
|||
nosetests.xml |
|||
coverage.xml |
|||
|
|||
# Translations |
|||
*.mo |
|||
*.pot |
|||
|
|||
# Django stuff: |
|||
*.log |
|||
|
|||
# Sphinx documentation |
|||
docs/_build/ |
|||
|
|||
# PyBuilder |
|||
target/ |
|||
|
|||
|
|||
# Vim .swp file |
|||
*.swp |
|||
|
|||
# Folder created for Nose testing |
|||
easyengine/bin/ |
|||
easyengine/coverage_report/ |
|||
easyengine/include/ |
|||
easyengine/local/ |
|||
easyengine/man/ |
@ -1,157 +0,0 @@ |
|||
v 2.2.1 - Oct 16,2014 |
|||
- Fixed update script issue for remote MySQL #323 |
|||
- Fixed remote MySQL delete user issue by @brennentsmith #324 |
|||
- Improved auto-completion |
|||
|
|||
v 2.2.0 - Oct 13, 2014 |
|||
- Percona Mysql 5.6 support on Fresh installation. #107 |
|||
- RAM Based Optimization for PHP5-FPM,OpCache and Memcache |
|||
- Introduced following new commands for |
|||
- ee site cd example.com # Change Directory to example.com Webroot |
|||
- ee site log example.com # Real time log monitoring for example.com access and error logs |
|||
- ee site update example.com <parameters> # update example.com cache and convert site |
|||
- ee clean # Clean cache NGINX FastCGI, Memcache, OPcache. |
|||
- Change WordPress user password easily ( ee site update example.com --password) #315 |
|||
- Added PHP5-GeoIP Support |
|||
- Auto Swap creation for low RAM servers. |
|||
- Fixed Better autocompletion feature. Fixed #311. |
|||
- Fixed phpMyAdmin (blowfish_secret) error #301 |
|||
- Simplified way to update EasyEngine. #307 |
|||
|
|||
v 2.1.0 - Sept 3, 2014 |
|||
- Added Mail Server Package installation #65 |
|||
- Fixed incorrect log file path during debug #299 |
|||
- Added support for pt-query-advisor #189 |
|||
- Fixed Firefox cross-domain fonts |
|||
- Fixed ee site edit command on Nano editor |
|||
|
|||
v 2.0.2 - Aug 13, 2014 |
|||
- Remote MySQL Support |
|||
|
|||
v 2.0.1 - July 21, 2014 |
|||
- Fixed wp-cli installation #289 |
|||
|
|||
v 2.0.0 - July 14, 2014 |
|||
- Completly rewritten code |
|||
- Updated wp-cli to 0.16.0 |
|||
- Introduced ee secure command |
|||
- Changed the way to update EasyEngine #179 |
|||
- Fixed security on 22222 port by @RenzoF #263 |
|||
- Fixed MySQL stopped in ee stack status #233 |
|||
- Added WordPress SEO Yoast plugin support in wpcommon.conf #165 |
|||
- Depricated ee system command with ee stack command |
|||
|
|||
|
|||
v 1.3.8 - May 26, 2014 |
|||
- Fixed phpMyAdmin download issue #251 |
|||
- Fixed swap issue #223 by @Swingline0 |
|||
- Delete website without prompt by @edwinvandeven #239 |
|||
|
|||
|
|||
v 1.3.7 - Apr 29, 2014 |
|||
- Fixed EasyEngine Update Problem |
|||
- Fixed Issue #206 |
|||
- Update nginx version 1.6.0 |
|||
- Update wp-cli version 0.14.1 |
|||
|
|||
|
|||
v 1.3.6 - Apr 24, 2014 |
|||
- Fixed Nginx Update Problem #201 |
|||
- Automate Testing Using Travis-ci |
|||
|
|||
|
|||
v 1.3.5 - Apr 22, 2014 |
|||
- Update nginx to the latest stable version (1.4.7) |
|||
|
|||
|
|||
v 1.3.4 - Apr 22, 2014 |
|||
- Supports Ubuntu 12.04, 12.10, 13.10 & 14.04 ( Fixed Issue #94 #195 ) |
|||
- Change FPM process management from dynamic to ondemand #184 |
|||
- Fixed Issue #188 |
|||
- Fixed Debian 6 wget command issue |
|||
|
|||
|
|||
v 1.3.3 - Apr 16, 2014 |
|||
- Fixed issue #186 |
|||
- Fixed issue #187 |
|||
|
|||
|
|||
v 1.3.2 - Apr 14, 2014 |
|||
- Fixed ee update |
|||
|
|||
|
|||
v 1.3.1 - Apr 14, 2014 |
|||
- Fixed Autocompletion Issue #185 |
|||
- ee info command display php5-fpm process manager details (dynamic/ondemand) |
|||
|
|||
|
|||
v 1.3.0 - Apr 11, 2014 |
|||
- Introduce `ee debug` command |
|||
- Introduce `ee system [status|stop|start|restart]` command |
|||
|
|||
- EasyEngine Admin Tools shifted on port `22222` with self signed SSL Certificate #124 |
|||
- Setup Separate PHP5-FPM Pool on Port 9001 for debugging purpose |
|||
- Polish `ee site edit` command #157 |
|||
- Fixed MySQL Username Character Limit #113 |
|||
- Nginx Settings #100 |
|||
|
|||
|
|||
v 1.2.2 - Mar 18, 2014 |
|||
- Check/Install bc command |
|||
- Fixed EasyEngine Update Issue #134 #148 |
|||
- Automatic set WordPress Permalink Structure by @UmeshSingla |
|||
- Fixed @WP-CLI version to 0.14.1 |
|||
- Correct Typo Mistake, Thanks to @sdenike on pull request #155 |
|||
- Introduce ee site edit command by @Mermouy on pull request #153 |
|||
- Auto Switch the site create options |
|||
- Better way to detect Linux Ditribution |
|||
|
|||
|
|||
v 1.2.1 - Mar 3, 2014 |
|||
- Fixed Debian Issue #136 |
|||
|
|||
|
|||
v 1.2 - Feb 20, 2014 |
|||
- Debian 6 and Debian 7 support added |
|||
|
|||
|
|||
v 1.1.5 - Feb 17, 2014 |
|||
- Fixed WordPress multisite issue (#127). |
|||
|
|||
|
|||
v 1.1.4 - Feb 14, 2014 |
|||
- Fixed wp-cli issue with --allow-root error. |
|||
|
|||
|
|||
v 1.1.3 - Jan 28, 2014 |
|||
- Added GPL License. Ref - https://rtcamp.com/easyengine-is-gpl/ |
|||
|
|||
|
|||
v 1.1.2 - Jan 28, 2014 |
|||
- Fix White-list IP Address |
|||
- Fix ee info command |
|||
- Fix site delete issue (#111) |
|||
|
|||
|
|||
v 1.1.1 - Jan 17, 2014 |
|||
- IP-detcect issue. (#108) |
|||
|
|||
|
|||
v 1.1 - Jan 16, 2014 |
|||
- Handling redirects from “non-www to www” and vice-versa. (#71) |
|||
- Automating mysql setup. Every site which needs a database gets a new mysql user and password automatically. mysql root is not used anymore for new sites. (#72) |
|||
- Automated postfix installation. (#72) |
|||
- Added “ee info” command (#69) |
|||
- Secured /ee locations (#60 and https://rtcamp.com/tutorials/nginx/ssl-pci-compliance-performance/) |
|||
- SSL Session cache for nginx (#56) |
|||
|
|||
|
|||
v 1.0.1 - Dec 17, 2013 |
|||
- Fix wp-cli issue |
|||
|
|||
|
|||
v 1.0.0 - Oct 1, 2013 |
|||
- First Release |
|||
- Support for Standard WordPress and multisite WordPress |
|||
- Support for Nginx Fastcgi-Cache, W3 Total Cache and WP Super Cache |
|||
- Support for PHP and HTML sites |
@ -1,26 +0,0 @@ |
|||
# Contribute to EasyEngine (ee) |
|||
|
|||
This guide details how to use issues and pull requests to improve EasyEngine (ee). |
|||
|
|||
## How to report issue: |
|||
|
|||
Github issue-tracker is used **only** for report bugs and feature request. |
|||
|
|||
Please attach the output of following command when open a new issue/bug |
|||
```bash |
|||
lsb_release -a |
|||
ee version |
|||
ee info |
|||
wp --allow-root --info |
|||
``` |
|||
|
|||
### EasyEngine chat: |
|||
Developer & contributor discussion: https://gitter.im/rtCamp/easyengine |
|||
|
|||
|
|||
### EasyEngine support request: |
|||
For support-request please use - https://rtcamp.com/easyengine/support/ |
|||
|
|||
|
|||
### Pull Requests: |
|||
When submitting your code please follow this coding standerds - https://google-styleguide.googlecode.com/svn/trunk/shell.xml |
@ -1,348 +0,0 @@ |
|||
Copyright 2013-2014 by RTCAMP SOLUTIONS PRIVATE LIMITED [https://rtcamp.com/] and Contributors [https://github.com/rtCamp/easyengine/graphs/contributors] |
|||
|
|||
|
|||
Wherever third party code has been used, credit has been given in the code's |
|||
comments. |
|||
|
|||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
|||
|
|||
|
|||
GNU GENERAL PUBLIC LICENSE |
|||
Version 2, June 1991 |
|||
|
|||
Copyright (C) 1989, 1991 Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
Everyone is permitted to copy and distribute verbatim copies |
|||
of this license document, but changing it is not allowed. |
|||
|
|||
Preamble |
|||
|
|||
The licenses for most software are designed to take away your |
|||
freedom to share and change it. By contrast, the GNU General Public |
|||
License is intended to guarantee your freedom to share and change free |
|||
software--to make sure the software is free for all its users. This |
|||
General Public License applies to most of the Free Software |
|||
Foundation's software and to any other program whose authors commit to |
|||
using it. (Some other Free Software Foundation software is covered by |
|||
the GNU Lesser General Public License instead.) You can apply it to |
|||
your programs, too. |
|||
|
|||
When we speak of free software, we are referring to freedom, not |
|||
price. Our General Public Licenses are designed to make sure that you |
|||
have the freedom to distribute copies of free software (and charge for |
|||
this service if you wish), that you receive source code or can get it |
|||
if you want it, that you can change the software or use pieces of it |
|||
in new free programs; and that you know you can do these things. |
|||
|
|||
To protect your rights, we need to make restrictions that forbid |
|||
anyone to deny you these rights or to ask you to surrender the rights. |
|||
These restrictions translate to certain responsibilities for you if you |
|||
distribute copies of the software, or if you modify it. |
|||
|
|||
For example, if you distribute copies of such a program, whether |
|||
gratis or for a fee, you must give the recipients all the rights that |
|||
you have. You must make sure that they, too, receive or can get the |
|||
source code. And you must show them these terms so they know their |
|||
rights. |
|||
|
|||
We protect your rights with two steps: (1) copyright the software, and |
|||
(2) offer you this license which gives you legal permission to copy, |
|||
distribute and/or modify the software. |
|||
|
|||
Also, for each author's protection and ours, we want to make certain |
|||
that everyone understands that there is no warranty for this free |
|||
software. If the software is modified by someone else and passed on, we |
|||
want its recipients to know that what they have is not the original, so |
|||
that any problems introduced by others will not reflect on the original |
|||
authors' reputations. |
|||
|
|||
Finally, any free program is threatened constantly by software |
|||
patents. We wish to avoid the danger that redistributors of a free |
|||
program will individually obtain patent licenses, in effect making the |
|||
program proprietary. To prevent this, we have made it clear that any |
|||
patent must be licensed for everyone's free use or not licensed at all. |
|||
|
|||
The precise terms and conditions for copying, distribution and |
|||
modification follow. |
|||
|
|||
GNU GENERAL PUBLIC LICENSE |
|||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
|||
|
|||
0. This License applies to any program or other work which contains |
|||
a notice placed by the copyright holder saying it may be distributed |
|||
under the terms of this General Public License. The "Program", below, |
|||
refers to any such program or work, and a "work based on the Program" |
|||
means either the Program or any derivative work under copyright law: |
|||
that is to say, a work containing the Program or a portion of it, |
|||
either verbatim or with modifications and/or translated into another |
|||
language. (Hereinafter, translation is included without limitation in |
|||
the term "modification".) Each licensee is addressed as "you". |
|||
|
|||
Activities other than copying, distribution and modification are not |
|||
covered by this License; they are outside its scope. The act of |
|||
running the Program is not restricted, and the output from the Program |
|||
is covered only if its contents constitute a work based on the |
|||
Program (independent of having been made by running the Program). |
|||
Whether that is true depends on what the Program does. |
|||
|
|||
1. You may copy and distribute verbatim copies of the Program's |
|||
source code as you receive it, in any medium, provided that you |
|||
conspicuously and appropriately publish on each copy an appropriate |
|||
copyright notice and disclaimer of warranty; keep intact all the |
|||
notices that refer to this License and to the absence of any warranty; |
|||
and give any other recipients of the Program a copy of this License |
|||
along with the Program. |
|||
|
|||
You may charge a fee for the physical act of transferring a copy, and |
|||
you may at your option offer warranty protection in exchange for a fee. |
|||
|
|||
2. You may modify your copy or copies of the Program or any portion |
|||
of it, thus forming a work based on the Program, and copy and |
|||
distribute such modifications or work under the terms of Section 1 |
|||
above, provided that you also meet all of these conditions: |
|||
|
|||
a) You must cause the modified files to carry prominent notices |
|||
stating that you changed the files and the date of any change. |
|||
|
|||
b) You must cause any work that you distribute or publish, that in |
|||
whole or in part contains or is derived from the Program or any |
|||
part thereof, to be licensed as a whole at no charge to all third |
|||
parties under the terms of this License. |
|||
|
|||
c) If the modified program normally reads commands interactively |
|||
when run, you must cause it, when started running for such |
|||
interactive use in the most ordinary way, to print or display an |
|||
announcement including an appropriate copyright notice and a |
|||
notice that there is no warranty (or else, saying that you provide |
|||
a warranty) and that users may redistribute the program under |
|||
these conditions, and telling the user how to view a copy of this |
|||
License. (Exception: if the Program itself is interactive but |
|||
does not normally print such an announcement, your work based on |
|||
the Program is not required to print an announcement.) |
|||
|
|||
These requirements apply to the modified work as a whole. If |
|||
identifiable sections of that work are not derived from the Program, |
|||
and can be reasonably considered independent and separate works in |
|||
themselves, then this License, and its terms, do not apply to those |
|||
sections when you distribute them as separate works. But when you |
|||
distribute the same sections as part of a whole which is a work based |
|||
on the Program, the distribution of the whole must be on the terms of |
|||
this License, whose permissions for other licensees extend to the |
|||
entire whole, and thus to each and every part regardless of who wrote it. |
|||
|
|||
Thus, it is not the intent of this section to claim rights or contest |
|||
your rights to work written entirely by you; rather, the intent is to |
|||
exercise the right to control the distribution of derivative or |
|||
collective works based on the Program. |
|||
|
|||
In addition, mere aggregation of another work not based on the Program |
|||
with the Program (or with a work based on the Program) on a volume of |
|||
a storage or distribution medium does not bring the other work under |
|||
the scope of this License. |
|||
|
|||
3. You may copy and distribute the Program (or a work based on it, |
|||
under Section 2) in object code or executable form under the terms of |
|||
Sections 1 and 2 above provided that you also do one of the following: |
|||
|
|||
a) Accompany it with the complete corresponding machine-readable |
|||
source code, which must be distributed under the terms of Sections |
|||
1 and 2 above on a medium customarily used for software interchange; or, |
|||
|
|||
b) Accompany it with a written offer, valid for at least three |
|||
years, to give any third party, for a charge no more than your |
|||
cost of physically performing source distribution, a complete |
|||
machine-readable copy of the corresponding source code, to be |
|||
distributed under the terms of Sections 1 and 2 above on a medium |
|||
customarily used for software interchange; or, |
|||
|
|||
c) Accompany it with the information you received as to the offer |
|||
to distribute corresponding source code. (This alternative is |
|||
allowed only for noncommercial distribution and only if you |
|||
received the program in object code or executable form with such |
|||
an offer, in accord with Subsection b above.) |
|||
|
|||
The source code for a work means the preferred form of the work for |
|||
making modifications to it. For an executable work, complete source |
|||
code means all the source code for all modules it contains, plus any |
|||
associated interface definition files, plus the scripts used to |
|||
control compilation and installation of the executable. However, as a |
|||
special exception, the source code distributed need not include |
|||
anything that is normally distributed (in either source or binary |
|||
form) with the major components (compiler, kernel, and so on) of the |
|||
operating system on which the executable runs, unless that component |
|||
itself accompanies the executable. |
|||
|
|||
If distribution of executable or object code is made by offering |
|||
access to copy from a designated place, then offering equivalent |
|||
access to copy the source code from the same place counts as |
|||
distribution of the source code, even though third parties are not |
|||
compelled to copy the source along with the object code. |
|||
|
|||
4. You may not copy, modify, sublicense, or distribute the Program |
|||
except as expressly provided under this License. Any attempt |
|||
otherwise to copy, modify, sublicense or distribute the Program is |
|||
void, and will automatically terminate your rights under this License. |
|||
However, parties who have received copies, or rights, from you under |
|||
this License will not have their licenses terminated so long as such |
|||
parties remain in full compliance. |
|||
|
|||
5. You are not required to accept this License, since you have not |
|||
signed it. However, nothing else grants you permission to modify or |
|||
distribute the Program or its derivative works. These actions are |
|||
prohibited by law if you do not accept this License. Therefore, by |
|||
modifying or distributing the Program (or any work based on the |
|||
Program), you indicate your acceptance of this License to do so, and |
|||
all its terms and conditions for copying, distributing or modifying |
|||
the Program or works based on it. |
|||
|
|||
6. Each time you redistribute the Program (or any work based on the |
|||
Program), the recipient automatically receives a license from the |
|||
original licensor to copy, distribute or modify the Program subject to |
|||
these terms and conditions. You may not impose any further |
|||
restrictions on the recipients' exercise of the rights granted herein. |
|||
You are not responsible for enforcing compliance by third parties to |
|||
this License. |
|||
|
|||
7. If, as a consequence of a court judgment or allegation of patent |
|||
infringement or for any other reason (not limited to patent issues), |
|||
conditions are imposed on you (whether by court order, agreement or |
|||
otherwise) that contradict the conditions of this License, they do not |
|||
excuse you from the conditions of this License. If you cannot |
|||
distribute so as to satisfy simultaneously your obligations under this |
|||
License and any other pertinent obligations, then as a consequence you |
|||
may not distribute the Program at all. For example, if a patent |
|||
license would not permit royalty-free redistribution of the Program by |
|||
all those who receive copies directly or indirectly through you, then |
|||
the only way you could satisfy both it and this License would be to |
|||
refrain entirely from distribution of the Program. |
|||
|
|||
If any portion of this section is held invalid or unenforceable under |
|||
any particular circumstance, the balance of the section is intended to |
|||
apply and the section as a whole is intended to apply in other |
|||
circumstances. |
|||
|
|||
It is not the purpose of this section to induce you to infringe any |
|||
patents or other property right claims or to contest validity of any |
|||
such claims; this section has the sole purpose of protecting the |
|||
integrity of the free software distribution system, which is |
|||
implemented by public license practices. Many people have made |
|||
generous contributions to the wide range of software distributed |
|||
through that system in reliance on consistent application of that |
|||
system; it is up to the author/donor to decide if he or she is willing |
|||
to distribute software through any other system and a licensee cannot |
|||
impose that choice. |
|||
|
|||
This section is intended to make thoroughly clear what is believed to |
|||
be a consequence of the rest of this License. |
|||
|
|||
8. If the distribution and/or use of the Program is restricted in |
|||
certain countries either by patents or by copyrighted interfaces, the |
|||
original copyright holder who places the Program under this License |
|||
may add an explicit geographical distribution limitation excluding |
|||
those countries, so that distribution is permitted only in or among |
|||
countries not thus excluded. In such case, this License incorporates |
|||
the limitation as if written in the body of this License. |
|||
|
|||
9. The Free Software Foundation may publish revised and/or new versions |
|||
of the General Public License from time to time. Such new versions will |
|||
be similar in spirit to the present version, but may differ in detail to |
|||
address new problems or concerns. |
|||
|
|||
Each version is given a distinguishing version number. If the Program |
|||
specifies a version number of this License which applies to it and "any |
|||
later version", you have the option of following the terms and conditions |
|||
either of that version or of any later version published by the Free |
|||
Software Foundation. If the Program does not specify a version number of |
|||
this License, you may choose any version ever published by the Free Software |
|||
Foundation. |
|||
|
|||
10. If you wish to incorporate parts of the Program into other free |
|||
programs whose distribution conditions are different, write to the author |
|||
to ask for permission. For software which is copyrighted by the Free |
|||
Software Foundation, write to the Free Software Foundation; we sometimes |
|||
make exceptions for this. Our decision will be guided by the two goals |
|||
of preserving the free status of all derivatives of our free software and |
|||
of promoting the sharing and reuse of software generally. |
|||
|
|||
NO WARRANTY |
|||
|
|||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
|||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
|||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
|||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
|||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
|||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
|||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
|||
REPAIR OR CORRECTION. |
|||
|
|||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
|||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
|||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
|||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
|||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
|||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
|||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
|||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
|||
POSSIBILITY OF SUCH DAMAGES. |
|||
|
|||
END OF TERMS AND CONDITIONS |
|||
|
|||
How to Apply These Terms to Your New Programs |
|||
|
|||
If you develop a new program, and you want it to be of the greatest |
|||
possible use to the public, the best way to achieve this is to make it |
|||
free software which everyone can redistribute and change under these terms. |
|||
|
|||
To do so, attach the following notices to the program. It is safest |
|||
to attach them to the start of each source file to most effectively |
|||
convey the exclusion of warranty; and each file should have at least |
|||
the "copyright" line and a pointer to where the full notice is found. |
|||
|
|||
<one line to give the program's name and a brief idea of what it does.> |
|||
Copyright (C) <year> <name of author> |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; either version 2 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along |
|||
with this program; if not, write to the Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
|
|||
Also add information on how to contact you by electronic and paper mail. |
|||
|
|||
If the program is interactive, make it output a short notice like this |
|||
when it starts in an interactive mode: |
|||
|
|||
Gnomovision version 69, Copyright (C) year name of author |
|||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
|||
This is free software, and you are welcome to redistribute it |
|||
under certain conditions; type `show c' for details. |
|||
|
|||
The hypothetical commands `show w' and `show c' should show the appropriate |
|||
parts of the General Public License. Of course, the commands you use may |
|||
be called something other than `show w' and `show c'; they could even be |
|||
mouse-clicks or menu items--whatever suits your program. |
|||
|
|||
You should also get your employer (if you work as a programmer) or your |
|||
school, if any, to sign a "copyright disclaimer" for the program, if |
|||
necessary. Here is a sample; alter the names: |
|||
|
|||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
|||
`Gnomovision' (which makes passes at compilers) written by James Hacker. |
|||
|
|||
<signature of Ty Coon>, 1 April 1989 |
|||
Ty Coon, President of Vice |
|||
|
|||
This General Public License does not permit incorporating your program into |
|||
proprietary programs. If your program is a subroutine library, you may |
|||
consider it more useful to permit linking proprietary applications with the |
|||
library. If this is what you want to do, use the GNU Lesser General |
|||
Public License instead of this License. |
@ -1,88 +1,11 @@ |
|||
[![Stories in Ready](https://badge.waffle.io/rtcamp/easyengine.png?label=ready&title=Ready)](https://waffle.io/rtcamp/easyengine) |
|||
[![Stories in Progress](https://badge.waffle.io/rtcamp/easyengine.png?label=in%20progress&title=In%20Progress)](https://waffle.io/rtcamp/easyengine) |
|||
|
|||
<img src="https://d3qt5vpr7p9rgn.cloudfront.net/wp-content/uploads/2013/08/easy-engine-logo-2-RS1.png" alt="EasyEngine Logo" align="right" /> |
|||
EasyEngine 3.x Developement version |
|||
|
|||
[![Travis Build Status](https://travis-ci.org/rtCamp/easyengine.svg "Travis Build Status")] (https://travis-ci.org/rtCamp/easyengine) |
|||
|
|||
EasyEngine (ee) is a linux shell-script collection, which makes it easy to manage your wordpress sites running on nginx web-server. |
|||
|
|||
**EasyEngine currently supports:** |
|||
Thinking To Contribute??? |
|||
|
|||
- Ubuntu 12.04 & 14.04 |
|||
- Debian 6 & 7 |
|||
refer docs to know more on EasyEngine Developement |
|||
|
|||
## Quick Start |
|||
|
|||
```bash |
|||
wget -qO ee rt.cx/ee && sudo bash ee # install easyengine |
|||
ee site create example.com --wp # Install required packages & setup WordPress on example.com |
|||
``` |
|||
|
|||
## Update EasyEngine |
|||
|
|||
|
|||
Update Procedure For EasyEngine |
|||
|
|||
```bash |
|||
wget -qO eeup http://rt.cx/eeup && sudo bash eeup |
|||
``` |
|||
|
|||
## More Site Creation Commands |
|||
|
|||
### Standard WordPress Sites |
|||
|
|||
```bash |
|||
ee site create example.com --wp # install wordpress without any page caching |
|||
ee site create example.com --w3tc # install wordpress with w3-total-cache plugin |
|||
ee site create example.com --wpsc # install wordpress with wp-super-cache plugin |
|||
ee site create example.com --wpfc # install wordpress + nginx fastcgi_cache |
|||
``` |
|||
|
|||
### WordPress Multsite with subdirectory |
|||
|
|||
```bash |
|||
ee site create example.com --wpsubdir # install wpmu-subdirectory without any page caching |
|||
ee site create example.com --wpsubdir --w3tc # install wpmu-subdirectory with w3-total-cache plugin |
|||
ee site create example.com --wpsubdir --wpsc # install wpmu-subdirectory with wp-super-cache plugin |
|||
ee site create example.com --wpsubdir --wpfc # install wpmu-subdirectory + nginx fastcgi_cache |
|||
``` |
|||
|
|||
### WordPress Multsite with subdomain |
|||
|
|||
```bash |
|||
ee site create example.com --wpsubdom # install wpmu-subdomain without any page caching |
|||
ee site create example.com --wpsubdom --w3tc # install wpmu-subdomain with w3-total-cache plugin |
|||
ee site create example.com --wpsubdom --wpsc # install wpmu-subdomain with wp-super-cache plugin |
|||
ee site create example.com --wpsubdom --wpfc # install wpmu-subdomain + nginx fastcgi_cache |
|||
``` |
|||
|
|||
### Non-WordPress Sites |
|||
```bash |
|||
ee site create example.com --html # create example.com for static/html sites |
|||
ee site create example.com --php # create example.com with php support |
|||
ee site create example.com --mysql # create example.com with php & mysql support |
|||
``` |
|||
|
|||
## Cheatsheet - Site creation |
|||
|
|||
|
|||
| | Single Site | Multisite w/ Subdir | Multisite w/ Subdom | |
|||
|--------------------|---------------|-----------------------|-----------------------| |
|||
| **NO Cache** | --wp | --wpsubdir | --wpsubdom | |
|||
| **WP Super Cache** | --wpsc | --wpsubdir --wpsc | --wpsubdom --wpsc | |
|||
| **W3 Total Cache** | --w3tc | --wpsubdir --w3tc | --wpsubdom --w3tc | |
|||
| **Nginx cache** | --wpfc | --wpsubdir --wpfc | --wpsubdom --wpfc | |
|||
|
|||
|
|||
## Useful Links |
|||
- [Documentation] (http://rtcamp.com/easyengine/docs/) |
|||
- [FAQ] (http://rtcamp.com/easyengine/faq/) |
|||
- [Conventions used] (http://rtcamp.com/wordpress-nginx/tutorials/conventions/) |
|||
|
|||
## Donations |
|||
- [Using PayPal] (https://rtcamp.com/donate/?project=easyengine) |
|||
|
|||
## License |
|||
|
|||
Same [GPL] (http://www.gnu.org/licenses/gpl-2.0.txt) that WordPress uses! |
|||
follow instruction from step 3 in Creating cement app |
|||
http://builtoncement.com/2.4/dev/boss_templates.html |
|||
|
@ -1,8 +0,0 @@ |
|||
Includes binaries of EasyEngine (ee). |
|||
|
|||
Actual Path : `/usr/local/sbin/` |
|||
|
|||
1. **easyengine** - Main script for all EasyEngine (ee) tasks. |
|||
1. **update** - Script to update EasyEngine (ee). |
|||
1. **install** - Script to install EasyEngine (ee). |
|||
|
@ -1,950 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
# Include library |
|||
for ee_include in $(find /usr/local/lib/easyengine/ -iname "*.sh"); do |
|||
source $ee_include |
|||
done |
|||
|
|||
# Main EasyEngine (ee) function to log all the outputs |
|||
EasyEngine() |
|||
{ |
|||
|
|||
# Arguments |
|||
EE_FIRST=$1 |
|||
EE_SECOND=$2 |
|||
EE_THIRD=$3 |
|||
EE_FOURTH=$4 |
|||
EE_FIFTH=$5 |
|||
|
|||
# Let's capture the EasyEngine arguments |
|||
ee_lib_echo "EasyEngine (ee) $EE_VERSION execution started [$(date)]" &>> $EE_COMMAND_LOG |
|||
ee_lib_echo "EasyEngine (ee) command: $0 $@" &>> $EE_COMMAND_LOG |
|||
|
|||
|
|||
# EasyEngine version |
|||
if [ "$EE_FIRST" = "version" ] || [ "$EE_FIRST" = "--version" ] || [ "$EE_FIRST" = "-v" ];then |
|||
# Display Easy Engine Version |
|||
echo "EasyEngine (ee) version: $EE_VERSION" |
|||
|
|||
# EasyEngine help |
|||
elif [ "$EE_FIRST" = "help" ] || [ "$EE_FIRST" = "--help" ] || [ "$EE_FIRST" = "-h" ]; then |
|||
# Display man page |
|||
man ee |
|||
|
|||
# Display information about NGINX|PHP|MySQL |
|||
elif [ "$EE_FIRST" = "info" ];then |
|||
if [ "$EE_SECOND" = "nginx" ] || [ "$EE_SECOND" = "php" ] || [ "$EE_SECOND" = "mysql" ]; then |
|||
ee_lib_${EE_SECOND}_info |
|||
else |
|||
ee_lib_nginx_info |
|||
ee_lib_php_info |
|||
ee_lib_mysql_info |
|||
fi |
|||
|
|||
# EasyEngine stack/system |
|||
elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then |
|||
# EasyEngine install |
|||
if [ "$EE_SECOND" = "install" ]; then |
|||
# EasyEngine RAM based settings |
|||
ee_lib_ram |
|||
# EasyEngine Swap creation |
|||
ee_lib_swap |
|||
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ] || [ "$EE_THIRD" = "postfix" ] || [ "$EE_THIRD" = "adminer" ] || [ "$EE_THIRD" = "phpmyadmin" ] || [ "$EE_THIRD" = "wpcli" ] || [ "$EE_THIRD" = "utils" ]; then |
|||
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ]; then |
|||
# Setup NGINX/PHP/Percona MySQL repository |
|||
ee_mod_repo_$EE_THIRD |
|||
|
|||
# Fix GnuPG key |
|||
ee_lib_gpg_key_fix |
|||
fi |
|||
|
|||
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ] || [ "$EE_THIRD" = "postfix" ]; then |
|||
# Execute: apt-get update |
|||
ee_lib_apt_get_update |
|||
|
|||
# Install NGINX/PHP/MySQL/Postfix package |
|||
ee_mod_install_$EE_THIRD |
|||
fi |
|||
|
|||
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ]; then |
|||
# Setup NGINX/PHP/MySQL |
|||
ee_mod_setup_$EE_THIRD |
|||
fi |
|||
|
|||
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ] || [ "$EE_THIRD" = "postfix" ]; then |
|||
# Restart php5-fpm |
|||
if [ "$EE_THIRD" = "php" ];then |
|||
ee_lib_service php5-fpm restart |
|||
|
|||
# Initialize Git |
|||
ee_lib_git /etc/php5/ "Initialize Git" |
|||
else |
|||
# Restart NGINX/MySQL/Postfix |
|||
ee_lib_service $EE_THIRD restart |
|||
|
|||
# Initialize Git |
|||
ee_lib_git /etc/$EE_THIRD/ "Initialize Git" |
|||
fi |
|||
fi |
|||
|
|||
if [ "$EE_THIRD" = "adminer" ] || [ "$EE_THIRD" = "phpmyadmin" ] || [ "$EE_THIRD" = "wpcli" ] || [ "$EE_THIRD" = "utils" ];then |
|||
# Install Adminer/phpMyAdmin/WP-CLI/Utils |
|||
ee_ven_install_$EE_THIRD |
|||
fi |
|||
|
|||
elif [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ] || [ "$EE_THIRD" = "admin" ] ; then |
|||
if [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ]; then |
|||
# Setup NGINX/PHP/Percona MySQL repository |
|||
ee_mod_repo_nginx |
|||
ee_mod_repo_php |
|||
ee_mod_repo_mysql |
|||
|
|||
# Fix GnuPG key |
|||
ee_lib_gpg_key_fix |
|||
|
|||
# Execute: apt-get update |
|||
ee_lib_apt_get_update |
|||
|
|||
# Install NGINX/PHP/MySQL/Postfix package |
|||
ee_mod_install_nginx |
|||
ee_mod_install_php |
|||
ee_mod_install_mysql |
|||
ee_mod_install_postfix |
|||
|
|||
# Setup NGINX/PHP/MySQL |
|||
ee_mod_setup_nginx |
|||
ee_mod_setup_php |
|||
ee_mod_setup_mysql |
|||
|
|||
# Restart NGINX/MySQL/Postfix |
|||
ee_lib_service nginx php5-fpm mysql restart |
|||
|
|||
# Initialize Git |
|||
ee_lib_git /etc/nginx/ /etc/php5/ /etc/mysql/ /etc/postfix "Initialize Git" |
|||
|
|||
# Install WP-CLI |
|||
ee_ven_install_wpcli |
|||
fi |
|||
# Install Adminer/phpMyAdmin/Utils |
|||
ee_ven_install_adminer |
|||
ee_ven_install_phpmyadmin |
|||
ee_ven_install_utils |
|||
fi |
|||
|
|||
# EasyEngine mail server setup |
|||
if [ "$EE_THIRD" = "mail" ] || [ "$EE_THIRD" = "all" ];then |
|||
|
|||
# Check required Packages are installed or not |
|||
dpkg --get-selections | grep -v deinstall | grep nginx > /dev/null \ |
|||
&& dpkg --get-selections | grep -v deinstall | grep php5-fpm > /dev/null \ |
|||
&& mysqladmin ping &>> $EE_COMMAND_LOG \ |
|||
&& dpkg --get-selections | grep -v deinstall | grep postfix > /dev/null |
|||
if [ $? -ne 0 ];then |
|||
ee_lib_error "Failed to find NGINX PHP MySQL Postfix, exit status=" 1 |
|||
fi |
|||
|
|||
dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null |
|||
if [ $? -eq 0 ];then |
|||
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 |
|||
ee_lib_check_fqdn $(hostname -f) |
|||
|
|||
# Install Dovecot |
|||
ee_mod_install_dovecot |
|||
|
|||
|
|||
# Install ViMbAdmin |
|||
ee_ven_install_vimbadmin |
|||
|
|||
# Install Roundcube |
|||
ee_ven_install_roundcube |
|||
|
|||
# Configure PostFix |
|||
ee_mod_setup_postfix |
|||
|
|||
# Configure Dovecot |
|||
ee_mod_setup_dovecot |
|||
|
|||
# Setup ViMbAdmin |
|||
ee_ven_setup_vimbadmin |
|||
|
|||
# Setup Roundcube |
|||
ee_ven_setup_roundcube |
|||
|
|||
# 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_fail "RAM is less then 512MB, EasyEngine skip 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" |
|||
|
|||
# Display message for mail server |
|||
ee_lib_echo_escape "Configure ViMbAdmin:\thttps://$(hostname -f):22222/vimbadmin" |
|||
ee_lib_echo_escape "Security Salt:\t\t${ee_security_salt}\n" |
|||
|
|||
elif [ "$EE_THIRD" = "mailscanner" ]; then |
|||
|
|||
dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null |
|||
if [ $? -ne 0 ];then |
|||
ee_lib_error "Failed to find Dovecot Packages, exit status = " 1 |
|||
fi |
|||
|
|||
# Install Mail Scanner |
|||
ee_mod_install_mailscaner |
|||
|
|||
# Setup Mail Scanner |
|||
ee_mod_setup_mailscaner |
|||
|
|||
ee_lib_service nginx postfix dovecot amavis restart |
|||
|
|||
ee_lib_git /etc/nginx /etc/postfix /etc/dovecot /etc/amavis "Installed Mail Scanner Packages" |
|||
fi |
|||
|
|||
# Display HTTP authentication details |
|||
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ]; then |
|||
if [ "$EE_DISPLAY" = "true" ]; then |
|||
ee_lib_echo_info "HTTP authentication username: $EE_HTTP_AUTH_USER" |
|||
ee_lib_echo_info "HTTP authentication password: $EE_HTTP_AUTH_PASS" |
|||
fi |
|||
fi |
|||
# Display success message |
|||
if [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ]; then |
|||
EE_THIRD="Web packages" |
|||
fi |
|||
ee_lib_echo "$EE_THIRD successfully installed" |
|||
|
|||
# EasyEngine remove/purge |
|||
elif [ "$EE_SECOND" = "remove" ] || [ "$EE_SECOND" = "purge" ]; then |
|||
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ] || [ "$EE_THIRD" = "postfix" ] || [ "$EE_THIRD" = "adminer" ] || [ "$EE_THIRD" = "phpmyadmin" ] || [ "$EE_THIRD" = "wpcli" ] || [ "$EE_THIRD" = "utils" ]; then |
|||
|
|||
# Remove/Purge NGINX/PHP/MySQL/Postfix package |
|||
if [ "$EE_THIRD" = "nginx" ] || [ "$EE_THIRD" = "php" ] || [ "$EE_THIRD" = "mysql" ] || [ "$EE_THIRD" = "postfix" ]; then |
|||
ee_mod_remove_$EE_THIRD |
|||
|
|||
# Execute: apt-get autoremove |
|||
ee_lib_autoremove |
|||
fi |
|||
|
|||
# Remove/Purge Adminer/phpMyAdmin/WP-CLI/Utils |
|||
if [ "$EE_THIRD" = "adminer" ] || [ "$EE_THIRD" = "phpmyadmin" ] || [ "$EE_THIRD" = "wpcli" ] || [ "$EE_THIRD" = "utils" ];then |
|||
ee_ven_remove_$EE_THIRD |
|||
fi |
|||
|
|||
|
|||
elif [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ] || [ "$EE_THIRD" = "admin" ] ; then |
|||
if [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ]; then |
|||
# Remove/Purge NGINX/PHP/MySQL/Postfix package |
|||
ee_mod_remove_nginx |
|||
ee_mod_remove_php |
|||
ee_mod_remove_mysql |
|||
ee_mod_remove_postfix |
|||
|
|||
# Remove/Purge WP-CLI |
|||
ee_ven_remove_wpcli |
|||
fi |
|||
# Remove/Purge Adminer/phpMyAdmin/Utils |
|||
ee_ven_remove_adminer |
|||
ee_ven_remove_phpmyadmin |
|||
ee_ven_remove_utils |
|||
|
|||
# Execute: apt-get autoremove |
|||
ee_lib_autoremove |
|||
fi |
|||
if [ "$EE_THIRD" = "all" ] || [ "$EE_THIRD" = "mail" ];then |
|||
# Remove Dovecot |
|||
ee_mod_remove_dovecot |
|||
|
|||
# Remove Mail Scanner |
|||
ee_mod_remove_mailscaner |
|||
|
|||
# Remove ViMbAdmin |
|||
ee_ven_remove_vimbadmin |
|||
|
|||
# Remove Roundcube |
|||
ee_ven_remove_roundcube |
|||
|
|||
# Execute: apt-get autoremove |
|||
ee_lib_autoremove |
|||
|
|||
# Restart Nginx |
|||
ee_lib_service nginx |
|||
|
|||
ee_lib_git /etc/nginx "Removed Mail Server" |
|||
|
|||
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" |
|||
fi |
|||
|
|||
# Display success message |
|||
if [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ]; then |
|||
EE_THIRD="Web packages" |
|||
fi |
|||
if [ "$EE_SECOND" = "remove" ];then |
|||
ee_lib_echo "$EE_THIRD successfully removed" |
|||
elif [ "$EE_SECOND" = "purge" ];then |
|||
ee_lib_echo "$EE_THIRD successfully purged" |
|||
fi |
|||
|
|||
elif [ "$EE_SECOND" = "status" ]; then |
|||
ee_mod_stack_status |
|||
elif [ "$EE_SECOND" = "start" ] || [ "$EE_SECOND" = "stop" ] || [ "$EE_SECOND" = "reload" ] || [ "$EE_SECOND" = "restart" ]; then |
|||
ee_lib_service nginx php5-fpm mysql postfix $EE_SECOND |
|||
else |
|||
ee_lib_echo "ee stack commands:" |
|||
ee_lib_echo_escape "\tinstall\tInstall NGINX, PHP5, MySQL, Postfix, Adminer, phpMyAdmin, WP-CLI , Utils, Mailscanner and Admin tools" |
|||
ee_lib_echo_escape "\tremove\tRemove NGINX, PHP5, MySQL, Postfix, Adminer, phpMyAdmin, WP-CLI, Utils, Mailscanner and Admin tools" |
|||
ee_lib_echo_escape "\tpurge\tPurge NGINX, PHP5, MySQL, Postfix, Adminer, phpMyAdmin, WP-CLI, Utils, Mailscanner and Admin tools" |
|||
ee_lib_echo_escape "\tstatus\tDisplay system status information" |
|||
ee_lib_echo_escape "\tstart\tStart NGINX, PHP5, MySQL and Postfix service" |
|||
ee_lib_echo_escape "\tstop\tStop NGINX, PHP5, MySQL and Postfix service" |
|||
ee_lib_echo_escape "\treload\tReload NGINX, PHP5, MySQL and Postfix service" |
|||
ee_lib_echo_escape "\trestart\tRestart NGINX, PHP5, MySQL and Postfix service" |
|||
fi |
|||
|
|||
|
|||
# EasyEngine site |
|||
elif [ "$EE_FIRST" = "site" ]; then |
|||
if [ "$EE_SECOND" = "list" ]; then |
|||
if [ "$EE_THIRD" = "available" ];then |
|||
ee_lib_echo "List of sites-available websites:" |
|||
ls /etc/nginx/sites-available/ \ |
|||
|| ee_lib_error "Unable to display list of sites-available websites, exit status = " $? |
|||
else |
|||
ee_lib_echo "List of sites-enabled websites:" |
|||
ls /etc/nginx/sites-enabled/ \ |
|||
|| ee_lib_error "Unable to display list of sites-enabled websites, exit status = " $? |
|||
fi |
|||
elif [ "$EE_SECOND" = "info" ] || [ "$EE_SECOND" = "show" ]; then |
|||
# Check the website name is empty or not |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
ee_lib_check_domain |
|||
|
|||
if [ "$EE_SECOND" = "info" ]; then |
|||
# Display information about website |
|||
ee_mod_site_info |
|||
elif [ "$EE_SECOND" = "show" ]; then |
|||
# Check the website exist |
|||
ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \ |
|||
|| ee_lib_error "The $EE_DOMAIN is not found in /etc/nginx/sites-available, exit status = " $? |
|||
|
|||
# Display NGINX configuration for $EE_DOMAIN |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Display NGINX configuration for $EE_DOMAIN" |
|||
cat /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to display NGINX configuration for $EE_DOMAIN, exit status = " $? |
|||
fi |
|||
fi |
|||
elif [ "$EE_SECOND" = "enable" ]; then |
|||
# Check the website name is empty or not |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
ee_lib_check_domain |
|||
|
|||
# Creating symbolic link |
|||
ee_lib_echo "Creating symbolic link for $EE_DOMAIN" |
|||
ee_lib_symbolic_link /etc/nginx/sites-available/$EE_DOMAIN /etc/nginx/sites-enabled/ |
|||
|
|||
# Execute: service nginx reload |
|||
ee_lib_service nginx reload |
|||
|
|||
# Git commit |
|||
ee_lib_git /etc/nginx/ "Enable website: $EE_DOMAIN" |
|||
elif [ "$EE_SECOND" = "disable" ]; then |
|||
# Check the website name is empty or not |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
ee_lib_check_domain |
|||
|
|||
# Remove symbolic link |
|||
ee_lib_echo "Removing symbolic link for $EE_DOMAIN" |
|||
rm /etc/nginx/sites-enabled/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to remove symbolic link for $EE_DOMAIN, exit status = " $? |
|||
|
|||
# Execute: service nginx reload |
|||
ee_lib_service nginx reload |
|||
|
|||
# Git commit |
|||
ee_lib_git /etc/nginx/ "Disable website: $EE_DOMAIN" |
|||
elif [ "$EE_SECOND" = "edit" ]; then |
|||
# Check the website name is empty or not |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
ee_lib_check_domain |
|||
|
|||
# Edit the NGINX configuration for $EE_DOMAIN |
|||
ee_mod_site_edit $EE_FOURTH |
|||
|
|||
if [ $(cd /etc/nginx; git status -s /etc/nginx/sites-available/$EE_DOMAIN | wc -l) -ne 0 ]; then |
|||
# Git commit |
|||
ee_lib_git /etc/nginx/ "Edit website: $EE_DOMAIN" |
|||
|
|||
# Execute: service nginx reload |
|||
ee_lib_service nginx reload |
|||
fi |
|||
elif [ "$EE_SECOND" = "create" ]; then |
|||
# Configure variables |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
EE_SITE_CREATE_OPTION=$EE_FOURTH |
|||
EE_SITE_CACHE_OPTION=$EE_FIFTH |
|||
|
|||
# Auto switch site options |
|||
ee_mod_site_option |
|||
|
|||
# Install required packages |
|||
ee_mod_site_packages |
|||
|
|||
# Lets create HTML|PHP|MySQL website |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--html" ] || [ "$EE_SITE_CREATE_OPTION" = "--php" ] || [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then |
|||
# Configure variable |
|||
EE_NGINX_CONF=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/basic.conf |
|||
echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG |
|||
|
|||
# Setup NGINX |
|||
ee_lib_check_domain |
|||
ee_mod_setup_domain |
|||
|
|||
# Setup MySQL database |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then |
|||
ee_mod_setup_database |
|||
|
|||
# Add Database Information On ee-config.php |
|||
echo -e "<?php \ndefine('DB_NAME', '$EE_DB_NAME'); \ndefine('DB_USER', '$EE_DB_USER'); \ndefine('DB_PASSWORD', '$EE_DB_PASS'); \ndefine('DB_HOST', '$EE_MYSQL_HOST');\n?>" \ |
|||
&>> /var/www/$EE_DOMAIN/ee-config.php |
|||
fi |
|||
|
|||
# Adjust permission |
|||
ee_lib_permissions |
|||
|
|||
# Git commit |
|||
ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" |
|||
|
|||
# Display Http Auth credentials |
|||
if [ "$EE_DISPLAY" = "false" ]; then |
|||
ee_lib_echo_info "HTTP authentication username: easyengine" |
|||
ee_lib_echo_info "HTTP authentication password: $(grep "HTTP authentication password:" $EE_COMMAND_LOG | tail -n1 | awk '{print $4}')" |
|||
fi |
|||
# Display Success Message |
|||
if [ "$EE_MIGRATE" != "True" ]; then |
|||
ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" |
|||
fi |
|||
elif [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
|
|||
# Configure variable |
|||
EE_NGINX_CONF=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/$(echo $EE_SITE_CACHE_OPTION | cut -c3-).conf |
|||
echo -e "EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK \nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_NETWORK_ACTIVATE = $EE_NETWORK_ACTIVATE \nEE_WP_SUBDOMAIN = $EE_WP_SUBDOMAIN \nEE_NGINX_CONF = $EE_NGINX_CONF" &>> $EE_COMMAND_LOG |
|||
|
|||
# Setup NGINX |
|||
ee_lib_check_domain |
|||
ee_mod_setup_domain |
|||
|
|||
# If we are migrating site then Wordpress installation is not required |
|||
if [ "$EE_MIGRATE" != "True" ]; then |
|||
# Setup WordPress |
|||
ee_mod_setup_wordpress |
|||
fi |
|||
|
|||
# Adjust permission |
|||
ee_lib_permissions |
|||
|
|||
# Git commit |
|||
ee_lib_git /etc/nginx/ "$EE_DOMAIN created with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" |
|||
|
|||
# Execute: service nginx reload |
|||
ee_lib_service nginx reload |
|||
|
|||
# Display Http Auth credentials |
|||
if [ "$EE_DISPLAY" = "false" ]; then |
|||
ee_lib_echo_info "HTTP authentication username: easyengine" |
|||
ee_lib_echo_info "HTTP authentication password: $(grep "HTTP authentication password:" $EE_COMMAND_LOG | tail -n1 | awk '{print $4}')" |
|||
fi |
|||
|
|||
if [ "$EE_MIGRATE" != "True" ]; then |
|||
# Display WordPress credential |
|||
echo |
|||
ee_lib_echo_info "WordPress Admin Username: $EE_WP_USER" |
|||
ee_lib_echo_info "WordPress Admin Password: $EE_WP_PASS" |
|||
echo |
|||
|
|||
# Display WordPress cache plugin settings |
|||
ee_mod_plugin_settings |
|||
|
|||
# Display Success Message |
|||
ee_lib_echo_info "Successfully created new website: http://$EE_WWW_DOMAIN" |
|||
fi |
|||
fi |
|||
fi |
|||
elif [ "$EE_SECOND" = "delete" ]; then |
|||
# Check the website name is empty or not |
|||
EE_DELETE_ARGS=$EE_FOURTH |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
ee_lib_check_domain |
|||
|
|||
# Check the $EE_DOMAIN exist or not |
|||
if [ ! -f /etc/nginx/sites-available/$EE_DOMAIN ]; then |
|||
ee_lib_error "$EE_DOMAIN does not exist, exit status = " $? |
|||
fi |
|||
|
|||
# Use default whenever possible |
|||
# ee site delete example.com |
|||
# ee site delete example.com --no-prompt |
|||
if [ "$EE_DELETE_ARGS" = "" ]; then |
|||
EE_DELETE_ARGS="--all" |
|||
elif [ "$EE_DELETE_ARGS" = "--no-prompt" ]; then |
|||
EE_DELETE_ARGS="--all" |
|||
EE_FIFTH="--no-prompt" |
|||
fi |
|||
|
|||
if [ "$EE_DELETE_ARGS" = "--db" ]; then |
|||
# Delete MySQL database |
|||
ee_mod_delete_database $EE_FIFTH |
|||
elif [ "$EE_DELETE_ARGS" = "--files" ]; then |
|||
# Delete webroot |
|||
ee_mod_delete_webroot $EE_FIFTH |
|||
elif [ "$EE_DELETE_ARGS" = "--all" ]; then |
|||
# Delete MySQL database |
|||
ee_mod_delete_database $EE_FIFTH |
|||
|
|||
# Delete webroot |
|||
ee_mod_delete_webroot $EE_FIFTH |
|||
|
|||
# Delete NGINX configuration file |
|||
ee_mod_delete_nginxconf $EE_FIFTH |
|||
|
|||
# Git commit |
|||
ee_lib_git /etc/nginx/ "Delete website: $EE_DOMAIN" |
|||
|
|||
# Execute: service nginx reload |
|||
ee_lib_service nginx reload |
|||
fi |
|||
elif [ "$EE_SECOND" = "update" ]; then |
|||
# Configure variables |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
EE_SITE_CREATE_OPTION=$EE_FOURTH |
|||
EE_SITE_CACHE_OPTION=$EE_FIFTH |
|||
|
|||
# Check the website name is empty or not |
|||
ee_lib_check_domain |
|||
|
|||
# Auto switch site options |
|||
ee_mod_site_option |
|||
|
|||
# Let's use variable name as per action |
|||
# EE_SITE_CREATE_OPTION=$EE_SITE_CREATE_OPTION |
|||
|
|||
# Check the website exist or not |
|||
ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \ |
|||
|| ee_lib_error "The $EE_DOMAIN does not exist, exit status = " $? |
|||
|
|||
# Find out information about current NGINX configuration |
|||
EE_SITE_CURRENT_TYPE=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION" | rev | cut -d' ' -f3,4,5,6,7 | rev | cut -d ' ' -f2,3,4,5) |
|||
|
|||
# Detect current website type and cache |
|||
if [ "$EE_SITE_CURRENT_TYPE" = "HTML" ]; then |
|||
EE_SITE_CURRENT_TYPE="--html" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "PHP" ]; then |
|||
EE_SITE_CURRENT_TYPE="--php" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "MYSQL" ]; then |
|||
EE_SITE_CURRENT_TYPE="--mysql" |
|||
# Single WordPress |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE BASIC" ]; then |
|||
EE_SITE_CURRENT_WP="--wp" |
|||
EE_SITE_CURRENT_CACHE="--basic" |
|||
EE_SITE_CURRENT_TYPE="--wp --basic" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE WP SUPER CACHE" ]; then |
|||
EE_SITE_CURRENT_WP="--wp" |
|||
EE_SITE_CURRENT_CACHE="--wpsc" |
|||
EE_SITE_CURRENT_TYPE="--wp --wpsc" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE W3 TOTAL CACHE" ]; then |
|||
EE_SITE_CURRENT_WP="--wp" |
|||
EE_SITE_CURRENT_CACHE="--w3tc" |
|||
EE_SITE_CURRENT_TYPE="--wp --w3tc" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FAST CGI" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSINGLE FASTCGI" ]; then |
|||
EE_SITE_CURRENT_WP="--wp" |
|||
EE_SITE_CURRENT_CACHE="--wpfc" |
|||
EE_SITE_CURRENT_TYPE="--wp --wpfc" |
|||
# WordPress subdirectory |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR BASIC" ]; then |
|||
EE_SITE_CURRENT_WP="--wpsubdir" |
|||
EE_SITE_CURRENT_CACHE="--basic" |
|||
EE_SITE_CURRENT_TYPE="--wpsubdir --basic" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR WP SUPER CACHE" ]; then |
|||
EE_SITE_CURRENT_WP="--wpsubdir" |
|||
EE_SITE_CURRENT_CACHE="--wpsc" |
|||
EE_SITE_CURRENT_TYPE="--wpsubdir --wpsc" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR W3 TOTAL CACHE" ]; then |
|||
EE_SITE_CURRENT_WP="--wpsubdir" |
|||
EE_SITE_CURRENT_CACHE="--w3tc" |
|||
EE_SITE_CURRENT_TYPE="--wpsubdir --w3tc" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR FAST CGI" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDIR FASTCGI" ]; then |
|||
EE_SITE_CURRENT_WP="--wpsubdir" |
|||
EE_SITE_CURRENT_CACHE="--wpfc" |
|||
EE_SITE_CURRENT_TYPE="--wpsubdir --wpfc" |
|||
# WordPress subdomain |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN BASIC" ]; then |
|||
EE_SITE_CURRENT_WP="--wpsubdomain" |
|||
EE_SITE_CURRENT_CACHE="--basic" |
|||
EE_SITE_CURRENT_TYPE="--wpsubdomain --basic" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN WP SUPER CACHE" ]; then |
|||
EE_SITE_CURRENT_WP="--wpsubdomain" |
|||
EE_SITE_CURRENT_CACHE="--wpsc" |
|||
EE_SITE_CURRENT_TYPE="--wpsubdomain --wpsc" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN W3 TOTAL CACHE" ]; then |
|||
EE_SITE_CURRENT_WP="--wpsubdomain" |
|||
EE_SITE_CURRENT_CACHE="--w3tc" |
|||
EE_SITE_CURRENT_TYPE="--wpsubdomain --w3tc" |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN FAST CGI" ] || [ "$EE_SITE_CURRENT_TYPE" = "WPSUBDOMAIN FASTCGI" ]; then |
|||
EE_SITE_CURRENT_WP="--wpsubdomain" |
|||
EE_SITE_CURRENT_CACHE="--wpfc" |
|||
EE_SITE_CURRENT_TYPE="--wpsubdomain --wpfc" |
|||
fi |
|||
|
|||
# Detect update website type and cache |
|||
# Single WordPress |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wp" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wp --basic" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wp --wpsc" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wp --w3tc" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wp --wpfc" |
|||
fi |
|||
# WordPress subdirectory |
|||
elif [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wpsubdir --basic" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wpsubdir --wpsc" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wpsubdir --w3tc" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wpsubdir --wpfc" |
|||
fi |
|||
# WordPress subdomain |
|||
elif [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wpsubdomain --basic" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wpsubdomain --wpsc" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wpsubdomain --w3tc" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
EE_SITE_UPDATE_TYPE="--wpsubdomain --wpfc" |
|||
fi |
|||
fi |
|||
|
|||
# Let's log site current option |
|||
ee_lib_echo_escape "EE_SITE_CURRENT_WP = $EE_SITE_CURRENT_WP \nEE_SITE_CURRENT_CACHE = $EE_SITE_CURRENT_CACHE \nEE_SITE_CURRENT_TYPE = $EE_SITE_CURRENT_TYPE \n\nEE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION \nEE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION \nEE_SITE_UPDATE_TYPE = $EE_SITE_UPDATE_TYPE" &>> $EE_COMMAND_LOG |
|||
|
|||
# Update WordPress user password |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--password" ]; then |
|||
ee_mod_site_update_password |
|||
# Lets update HTML|PHP website |
|||
elif [[ "$EE_SITE_CURRENT_TYPE" = "--html" && "$EE_SITE_CREATE_OPTION" != "--html" ]] || [[ "$EE_SITE_CURRENT_TYPE" = "--php" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" ]]; then |
|||
# Lets call update function |
|||
ee_mod_update_website |
|||
|
|||
elif [[ "$EE_SITE_CURRENT_TYPE" = "--mysql" && "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" ]]; then |
|||
# Lets call update function |
|||
ee_mod_update_website |
|||
|
|||
elif [[ "$EE_SITE_CURRENT_WP" = "--wp" ]] \ |
|||
&& [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then |
|||
# Lets call update function |
|||
ee_mod_update_website |
|||
|
|||
elif [[ "$EE_SITE_CURRENT_WP" = "--wpsubdir" ]] \ |
|||
&& [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdomain" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then |
|||
# Lets call update function |
|||
ee_mod_update_website |
|||
|
|||
elif [[ "$EE_SITE_CURRENT_WP" = "--wpsubdomain" ]] \ |
|||
&& [[ "$EE_SITE_CREATE_OPTION" != "--html" && "$EE_SITE_CREATE_OPTION" != "--php" && "$EE_SITE_CREATE_OPTION" != "--mysql" && "$EE_SITE_CREATE_OPTION" != "--wp" && "$EE_SITE_CREATE_OPTION" != "--wpsubdir" && "$EE_SITE_CURRENT_TYPE" != "$EE_SITE_UPDATE_TYPE" ]]; then |
|||
# Lets call update function |
|||
ee_mod_update_website |
|||
fi |
|||
|
|||
|
|||
if [ "$EE_UPDATE_WEBSITE" = "success" ]; then |
|||
# Adjust permission |
|||
ee_lib_permissions |
|||
|
|||
# Execute: service nginx reload |
|||
ee_lib_service nginx reload |
|||
|
|||
# Git commit |
|||
ee_lib_git /etc/nginx/ "After ee site update: $EE_DOMAIN updated with $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION options" |
|||
|
|||
# Display Success Message |
|||
ee_lib_echo_info "Successfully Updated Website: http://$EE_WWW_DOMAIN" |
|||
elif [[ "$EE_SECOND" = "update" && "$EE_SITE_CREATE_OPTION" = "--password" ]]; then |
|||
ee_lib_echo "This option is needed for updating WordPress website password" &> /dev/null |
|||
else |
|||
ee_lib_error "Invalid option, exit status = " $? |
|||
fi |
|||
|
|||
elif [ "$EE_SECOND" = "log" ]; then |
|||
# Display logs for websites |
|||
ee_mod_site_log ${@:3} |
|||
|
|||
# EasyEngine cd |
|||
elif [ "$EE_SECOND" = "cd" ]; then |
|||
# Check the website name is empty or not |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
ee_lib_check_domain |
|||
|
|||
# Check the website exist |
|||
ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null \ |
|||
|| ee_lib_error "The $EE_DOMAIN is not found in /etc/nginx/sites-available, exit status = " $? |
|||
|
|||
# Change Directory to $EE_DOMAIN webroot |
|||
if [ $? -eq 0 ]; then |
|||
ee_site_cd |
|||
fi |
|||
|
|||
elif [ "$EE_SECOND" = "migrate" ]; then |
|||
export EE_MIGRATE="True" |
|||
|
|||
# Log only single time |
|||
# ee site create example.com called ee stack install nginx |
|||
# So when ee stack install nginx run in sub-shell the value of EE_TEE_LOG=/dev/null |
|||
# So in log file all logs written single time only, to do so set EE_LOG=false |
|||
export EE_LOG=false |
|||
|
|||
# Configure variables |
|||
EE_DOMAIN_CHECK=$EE_THIRD |
|||
ee_lib_check_domain |
|||
|
|||
[ "$EE_FOURTH" = "--html" ] || [ "$EE_FOURTH" = "--php" ] || [ "$EE_FOURTH" = "--mysql" ] || [ "$EE_FOURTH" = "--wp" ] || [ "$EE_FOURTH" = "--wpsubdir" ] || [ "$EE_FOURTH" = "--wpsubdomain" ] \ |
|||
|| [ "$EE_FOURTH" = "--basic" ] || [ "$EE_FOURTH" = "--w3tc" ] || [ "$EE_FOURTH" = "--wpsc" ] || [ "$EE_FOURTH" = "--wpfc" ] && EE_SITE_CACHE_OPTION=$EE_FOURTH && EE_SITE_CREATE_OPTION=$EE_FOURTH && echo EE_SITE_CREATE_OPTION = $EE_SITE_CREATE_OPTION &>> $EE_COMMAND_LOG |
|||
[ "$EE_FIFTH" = "--basic" ] || [ "$EE_FIFTH" = "--w3tc" ] || [ "$EE_FIFTH" = "--wpsc" ] || [ "$EE_FIFTH" = "--wpfc" ] && EE_SITE_CACHE_OPTION=$EE_FIFTH && echo EE_SITE_CACHE_OPTION = $EE_SITE_CACHE_OPTION &>> $EE_COMMAND_LOG |
|||
|
|||
# Auto arrange migrate arguments |
|||
for ee_migrate_args in $@; do |
|||
[ "${ee_migrate_args%=*}" = "--remote-host" ] && EE_REMOTE_SERVER=${ee_migrate_args##*=} && echo EE_REMOTE_SERVER = $EE_REMOTE_SERVER &>> $EE_COMMAND_LOG |
|||
[ "${ee_migrate_args%=*}" = "--remote-user" ] && EE_REMOTE_USER=${ee_migrate_args##*=} && echo EE_REMOTE_USER = $EE_REMOTE_USER &>> $EE_COMMAND_LOG |
|||
[ "${ee_migrate_args%=*}" = "--remote-password" ] && EE_REMOTE_PASSWORD=${ee_migrate_args##*=} && echo EE_REMOTE_PASSWORD = $EE_REMOTE_PASSWORD &>> $EE_COMMAND_LOG |
|||
[ "${ee_migrate_args%=*}" = "--remote-method" ] && EE_REMOTE_METHOD=${ee_migrate_args##*=} && echo EE_REMOTE_METHOD = $EE_REMOTE_METHOD &>> $EE_COMMAND_LOG |
|||
[ "${ee_migrate_args%=*}" = "--remote-path" ] && EE_REMOTE_PATH=${ee_migrate_args##*=} && echo EE_REMOTE_PATH = $EE_REMOTE_PATH &>> $EE_COMMAND_LOG |
|||
[ "${ee_migrate_args%=*}" = "--mysql-path" ] && EE_MYSQL_PATH=${ee_migrate_args##*=} && echo EE_MYSQL_PATH = $EE_MYSQL_PATH &>> $EE_COMMAND_LOG |
|||
[ "${ee_migrate_args%=*}" = "--remote-exclude" ] && EE_REMOTE_EXCLUDE=${ee_migrate_args##*=} && echo EE_REMOTE_EXCLUDE = $EE_REMOTE_EXCLUDE &>> $EE_COMMAND_LOG |
|||
done |
|||
|
|||
# Compulsary arguments for migration |
|||
if [ "$EE_REMOTE_SERVER" = "" ]; then |
|||
ee_lib_error "Missing arguments --remote-host, exit status = " 1 |
|||
elif [ "$EE_REMOTE_USER" = "" ]; then |
|||
ee_lib_error "Missing arguments --remote-user, exit status = " 1 |
|||
elif [ "$EE_REMOTE_METHOD" != "ssh" ] && [ "$EE_REMOTE_METHOD" != "sftp" ] && [ "$EE_REMOTE_METHOD" != "ftp" ]; then |
|||
ee_lib_error "EasyEngine migration supports only ssh, sftp and ftp methods, exit status = " 1 |
|||
elif [ "$EE_REMOTE_PATH" == "" ]; then |
|||
EE_REMOTE_PATH="/var/www/$EE_DOMAIN/htdocs" && echo EE_REMOTE_PATH = $EE_REMOTE_PATH &>> $EE_COMMAND_LOG |
|||
fi |
|||
|
|||
# Auto switch site options |
|||
ee_mod_site_option |
|||
|
|||
# Migrate Data |
|||
ee_mod_migrate_data |
|||
|
|||
# Create site |
|||
ee site create $EE_DOMAIN $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION \ |
|||
|| ee_lib_error "Unable to create site, exit status = " $? |
|||
|
|||
# Setup migration |
|||
ee_mod_migrate_setup |
|||
|
|||
# Display WordPress cache plugin settings |
|||
ee_mod_plugin_settings |
|||
|
|||
# Successfully message |
|||
ee_lib_echo_info "Successfully migrated site $EE_DOMAIN" |
|||
|
|||
else |
|||
ee_lib_echo "ee site commands:" |
|||
ee_lib_echo_escape "\tcd\tSwitch to website root directory" |
|||
ee_lib_echo_escape "\tlist\tList NGINX enabled website" |
|||
ee_lib_echo_escape "\tinfo\tDisplay information about given website" |
|||
ee_lib_echo_escape "\tshow\tDisplay NGINX configuration for given website" |
|||
ee_lib_echo_escape "\tenable\tEnable website" |
|||
ee_lib_echo_escape "\tdisable\tDisable website" |
|||
ee_lib_echo_escape "\tedit\tEdit NGINX configuration for given website" |
|||
ee_lib_echo_escape "\tcreate\tCreate new HTML, PHP, MySQL or WordPress website" |
|||
ee_lib_echo_escape "\tdelete\tDelete existing website" |
|||
ee_lib_echo_escape "\tlog\tMonitor access and error logs for single or multiple websites" |
|||
ee_lib_echo_escape "\tupdate\tupdate current website" |
|||
fi |
|||
|
|||
# EasyEngine debug |
|||
elif [ "$EE_FIRST" = "debug" ]; then |
|||
# Default action |
|||
EE_DEBUG="--start" |
|||
|
|||
# Auto arrange debug arguments |
|||
for ee_debug_args in $@; do |
|||
[ "$ee_debug_args" = "-i" ] && EE_DEBUG_INTERACTIVE=$ee_debug_args && echo EE_DEBUG_INTERACTIVE = $EE_DEBUG_INTERACTIVE &>> $EE_COMMAND_LOG |
|||
[ "$ee_debug_args" = "--stop" ] && EE_DEBUG=$ee_debug_args && echo EE_DEBUG = $EE_DEBUG &>> $EE_COMMAND_LOG |
|||
[ "$ee_debug_args" = "--nginx" ] && EE_DEBUG_NGINX=$ee_debug_args && echo EE_DEBUG_NGINX = $EE_DEBUG_NGINX &>> $EE_COMMAND_LOG |
|||
[ "$ee_debug_args" = "--rewrite" ] && EE_DEBUG_REWRITE=$ee_debug_args && echo EE_DEBUG_REWRITE = $EE_DEBUG_REWRITE &>> $EE_COMMAND_LOG |
|||
[ "$ee_debug_args" = "--php" ] && EE_DEBUG_PHP=$ee_debug_args && echo EE_DEBUG_PHP = $EE_DEBUG_PHP &>> $EE_COMMAND_LOG |
|||
[ "$ee_debug_args" = "--fpm" ] && EE_DEBUG_FPM=$ee_debug_args && echo EE_DEBUG_FPM = $EE_DEBUG_FPM &>> $EE_COMMAND_LOG |
|||
[ "$ee_debug_args" = "--mysql" ] && EE_DEBUG_MYSQL=$ee_debug_args && echo EE_DEBUG_MYSQL = $EE_DEBUG_MYSQL &>> $EE_COMMAND_LOG |
|||
[ "$ee_debug_args" = "--wp" ] && EE_DEBUG_WP=$ee_debug_args && echo EE_DEBUG_WP = $EE_DEBUG_WP &>> $EE_COMMAND_LOG |
|||
[ "${ee_debug_args%=*}" = "--import-slow-log-interval" ] && EE_DEBUG_IMPORT_SLOW_LOG=$ee_debug_args && echo EE_DEBUG_IMPORT_SLOW_LOG = $EE_DEBUG_IMPORT_SLOW_LOG &>> $EE_COMMAND_LOG |
|||
if [ "$ee_debug_args" != "debug" ] && [ "$ee_debug_args" != "-i" ] && [ "$ee_debug_args" != "--start" ] && [ "$ee_debug_args" != "--stop" ] && [ "$ee_debug_args" != "--nginx" ] && [ "$ee_debug_args" != "--rewrite" ] && [ "$ee_debug_args" != "--php" ] && [ "$ee_debug_args" != "--fpm" ] && [ "$ee_debug_args" != "--mysql" ] && [ "$ee_debug_args" != "--wp" ]; then |
|||
ls /etc/nginx/sites-available/ | grep $ee_debug_args &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
EE_DOMAIN_CHECK=$ee_debug_args && echo EE_DOMAIN_CHECK = $EE_DOMAIN_CHECK &>> $EE_COMMAND_LOG |
|||
|
|||
# Domain name find out |
|||
ee_lib_check_domain |
|||
echo EE_DOMAIN = $EE_DOMAIN &>> $EE_COMMAND_LOG |
|||
fi |
|||
fi |
|||
done |
|||
|
|||
# The following code execute on |
|||
# ee debug |
|||
# ee debug -i |
|||
# ee debug --start |
|||
# ee debug --stop |
|||
# ee debug example.com |
|||
if [ -z "$EE_DEBUG_NGINX" ] && [ -z "$EE_DEBUG_REWRITE" ] && [ -z "$EE_DEBUG_PHP" ] && [ -z "$EE_DEBUG_FPM" ] && [ -z "$EE_DEBUG_MYSQL" ] && [ -z "$EE_DEBUG_WP" ]; then |
|||
EE_DEBUG_NGINX="--nginx" && echo EE_DEBUG_NGINX = $EE_DEBUG_NGINX &>> $EE_COMMAND_LOG |
|||
EE_DEBUG_REWRITE="--rewrite" && echo EE_DEBUG_REWRITE = $EE_DEBUG_REWRITE &>> $EE_COMMAND_LOG |
|||
EE_DEBUG_PHP="--php" && echo EE_DEBUG_PHP = $EE_DEBUG_PHP &>> $EE_COMMAND_LOG |
|||
EE_DEBUG_FPM="--fpm" && echo EE_DEBUG_FPM = $EE_DEBUG_FPM &>> $EE_COMMAND_LOG |
|||
EE_DEBUG_MYSQL="--mysql" && echo EE_DEBUG_MYSQL = $EE_DEBUG_MYSQL &>> $EE_COMMAND_LOG |
|||
|
|||
if [ -n "$EE_DOMAIN" ]; then |
|||
EE_DEBUG_WP="--wp" && echo EE_DEBUG_WP = $EE_DEBUG_WP &>> $EE_COMMAND_LOG |
|||
fi |
|||
fi |
|||
|
|||
# Actual debug function call |
|||
if [ "$EE_DEBUG_NGINX" = "--nginx" ]; then |
|||
# Debug NGINX |
|||
ee_mod_debug_nginx |
|||
fi |
|||
|
|||
if [ "$EE_DEBUG_REWRITE" = "--rewrite" ]; then |
|||
# Debug NGINX rewrite rules |
|||
ee_mod_debug_rewrite |
|||
fi |
|||
|
|||
if [ "$EE_DEBUG_PHP" = "--php" ]; then |
|||
# Debug PHP slow log and enable xdebug profiling |
|||
ee_mod_debug_php |
|||
fi |
|||
|
|||
if [ "$EE_DEBUG_FPM" = "--fpm" ]; then |
|||
# Change PHP log_level from notice to debug |
|||
ee_mod_debug_fpm |
|||
fi |
|||
|
|||
if [ "$EE_DEBUG_MYSQL" = "--mysql" ]; then |
|||
# Enable MySQL slow query |
|||
ee_mod_debug_mysql |
|||
fi |
|||
|
|||
if [ "$EE_DEBUG_WP" = "--wp" ]; then |
|||
# Enable WordPress debug.log |
|||
ee_mod_debug_wp |
|||
fi |
|||
|
|||
# Execute: service nginx reload |
|||
if [ "$EE_TRIGGER_NGINX" = "true" ]; then |
|||
ee_lib_service nginx reload |
|||
fi |
|||
|
|||
if [ "$EE_TRIGGER_PHP" = "true" ]; then |
|||
ee_lib_service php5-fpm restart |
|||
fi |
|||
|
|||
if [ "$EE_DEBUG_INTERACTIVE" = "-i" ]; then |
|||
# Debug stop on CTRL+C |
|||
trap "ee_mod_debug_stop" EXIT |
|||
|
|||
if [ ! -z "$EE_DEBUG_MSG" ]; then |
|||
tail -f $EE_DEBUG_MSG |
|||
fi |
|||
elif [ "$EE_DEBUG_INTERACTIVE" != "-i" ] && [ "$EE_DEBUG" != "--stop" ]; then |
|||
if [ ! -z "$EE_DEBUG_MSG" ]; then |
|||
ee_lib_echo_info "tail -f $EE_DEBUG_MSG" |
|||
fi |
|||
fi |
|||
|
|||
# EasyEngine secure |
|||
elif [ "$EE_FIRST" = "secure" ]; then |
|||
if [ "$EE_SECOND" = "--auth" ] || [ "$EE_SECOND" = "--port" ] || [ "$EE_SECOND" = "--ip" ]; then |
|||
ee_mod_secure_$(echo $EE_SECOND | sed 's/--//') |
|||
ee_lib_service nginx reload |
|||
else |
|||
ee_lib_echo "ee secure commands:" |
|||
ee_lib_echo_escape "\t--auth\tUpdate credential of HTTP authentication" |
|||
ee_lib_echo_escape "\t--port\tChange EasyEngine admin port 22222" |
|||
ee_lib_echo_escape "\t--ip\tUpdate whitelist IP address" |
|||
fi |
|||
|
|||
# Clean NGINX FastCGI, Memcache, OPcache cache |
|||
elif [ "$EE_FIRST" = "clean" ]; then |
|||
ee_mod_clean ${@:2} |
|||
|
|||
# Import MySQL slow log to Anememoter |
|||
elif [ "$EE_FIRST" = "import-slow-log" ];then |
|||
ee_lib_import_slow_log |
|||
|
|||
# EasyEngine update |
|||
elif [ "$EE_FIRST" = "update" ]; then |
|||
ee_lib_echo "Run following command to update EasyEngine" |
|||
ee_lib_echo_info "wget --no-check-certificate -qO eeup http://rt.cx/eeup && sudo bash eeup" |
|||
|
|||
else |
|||
ee_lib_echo "EasyEngine (ee) commands:" |
|||
ee_lib_echo_escape "\tversion\tDisplay EasyEngine (ee) version" |
|||
ee_lib_echo_escape "\thelp\tDisplay EasyEngine (ee) man page" |
|||
ee_lib_echo_escape "\tinfo\tDisplay Information about NGINX, PHP5, MySQL" |
|||
ee_lib_echo_escape "\tclean\tClean Nginx FastCGI cache/OPcache/Memcache/all cache" |
|||
ee_lib_echo_escape "\tstack\tInstall/Remove/Purge NGINX, PHP, MySQL, Postfix" |
|||
ee_lib_echo_escape "\tsite\tPerform various site specific operation" |
|||
ee_lib_echo_escape "\tdebug\tPerform various debugging operation" |
|||
ee_lib_echo_escape "\tsecure\tUpdate HTTP authentication and EasyEngine admin port" |
|||
ee_lib_echo_escape "\tupdate\tUpdate EasyEngine (ee) to latest version" |
|||
fi |
|||
|
|||
} |
|||
|
|||
EasyEngine $@ | tee -ai $EE_TEE_LOG |
|||
|
|||
|
|||
# If any command fails its return non-zero exit code [EasyEngine $@] |
|||
# But when failed command piped then its [EasyEngine $@] exit status |
|||
# is suppress by next piped command [| tee -ai $EE_COMMAND_LOG] |
|||
|
|||
# Example: |
|||
# (call | tee -ai example.log); echo $? |
|||
# 0 |
|||
|
|||
# (call | tee -ai example.log; exit ${PIPESTATUS[0]}); echo $? |
|||
# 127 |
|||
|
|||
exit ${PIPESTATUS[0]} |
@ -1,238 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
# Define echo function |
|||
# Blue color |
|||
function ee_lib_echo() |
|||
{ |
|||
echo $(tput setaf 4)$@$(tput sgr0) |
|||
} |
|||
|
|||
# White color |
|||
function ee_lib_echo_info() |
|||
{ |
|||
echo $(tput setaf 7)$@$(tput sgr0) |
|||
} |
|||
|
|||
# Red color |
|||
function ee_lib_echo_fail() |
|||
{ |
|||
echo $(tput setaf 1)$@$(tput sgr0) |
|||
} |
|||
|
|||
|
|||
# Checking permissions |
|||
if [[ $EUID -ne 0 ]]; then |
|||
ee_lib_echo_fail "Sudo privilege required..." |
|||
ee_lib_echo_fail "Uses: wget -qO ee rt.cx/ee && sudo bash ee" |
|||
exit 1 |
|||
fi |
|||
|
|||
# Execute: apt-get update |
|||
ee_lib_echo "Executing apt-get update, please wait..." |
|||
apt-get update &>> /dev/null |
|||
|
|||
# Checking lsb_release package |
|||
if [ ! -x /usr/bin/lsb_release ]; then |
|||
ee_lib_echo "Installing lsb-release, please wait..." |
|||
apt-get -y install lsb-release &>> /dev/null |
|||
fi |
|||
|
|||
# Define variables for later use |
|||
readonly EE_LOG_DIR=/var/log/easyengine |
|||
readonly EE_INSTALL_LOG=/var/log/easyengine/install.log |
|||
readonly EE_ERROR_LOG=/var/log/easyengine/error.log |
|||
readonly EE_LINUX_DISTRO=$(lsb_release -i |awk '{print $3}') |
|||
readonly EE_DEBIAN_VERSION=$(lsb_release -sc) |
|||
|
|||
# Checking linux distro |
|||
if [ "$EE_LINUX_DISTRO" != "Ubuntu" ] && [ "$EE_LINUX_DISTRO" != "Debian" ]; then |
|||
ee_lib_echo_fail "EasyEngine (ee) is made for Ubuntu and Debian only as of now" |
|||
ee_lib_echo_fail "You are free to fork EasyEngine (ee): https://github.com/rtCamp/easyengine/fork" |
|||
exit 100 |
|||
fi |
|||
|
|||
# EasyEngine (ee) only support all Ubuntu/Debian distro except the distro reached EOL |
|||
lsb_release -d | egrep -e "12.04|14.04|14.10|squeeze|wheezy" &>> /dev/null |
|||
if [ "$?" -ne "0" ]; then |
|||
ee_lib_echo_fail "EasyEngine (ee) only support Ubuntu 12.04/14.04/14.10 and Debian 6.x/7.x" |
|||
exit 100 |
|||
fi |
|||
|
|||
|
|||
# Capture errors |
|||
function ee_lib_error() |
|||
{ |
|||
echo "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG |
|||
exit $2 |
|||
} |
|||
|
|||
# Check the specified package is installed or not |
|||
function ee_lib_package_check() |
|||
{ |
|||
local ee_package |
|||
|
|||
for ee_package in $@;do |
|||
dpkg --get-selections | grep -v deinstall | grep $ee_package &>> $EE_INSTALL_LOG |
|||
|
|||
# Generate a list of not installed package |
|||
if [ $? -ne 0 ]; then |
|||
EE_PACKAGE_NAME="$EE_PACKAGE_NAME $ee_package" |
|||
fi |
|||
|
|||
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,install.log,update.log,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 |
|||
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then |
|||
ee_lib_package_check graphviz python-software-properties software-properties-common |
|||
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then |
|||
ee_lib_package_check graphviz python-software-properties |
|||
fi |
|||
|
|||
if [ ! -x /usr/bin/tee ] || [ ! -x /bin/ed ] || [ ! -x /usr/bin/bc ] || [ ! -x /usr/bin/wget ] || [ ! -x /usr/bin/curl ] || [ ! -x /bin/tar ] || [ ! -x /usr/bin/git ] || [ ! -x /usr/bin/pv ] || [ ! -x /usr/bin/lftp ] || [ ! -x /usr/bin/sshpass ] || [ ! -x /usr/bin/sudo ] || [ -n "$EE_PACKAGE_NAME" ]; then |
|||
ee_lib_echo "Installing required packages, please wait..." | tee -ai $EE_INSTALL_LOG |
|||
apt-get -y install coreutils ed bc wget curl tar git-core lftp pv sshpass sudo $EE_PACKAGE_NAME | tee -ai $EE_INSTALL_LOG\ |
|||
|| ee_lib_error "Unable to install required packages, exit status = " $? |
|||
fi |
|||
|
|||
# Checking name servers |
|||
if [[ -z $(cat /etc/resolv.conf 2> /dev/null | awk '/^nameserver/ { print $2 }') ]]; then |
|||
ee_lib_echo_fail "Unable to detect name servers" && ee_lib_error "Unable to detect name servers, exit status = " $? |
|||
ee_lib_echo_fail "Please configure /etc/resolv.conf" && ee_lib_error "Please configure /etc/resolv.conf, exit status = " $? |
|||
fi |
|||
# Pre checks end |
|||
|
|||
# Decide EasyEngine (ee) branch |
|||
BRANCH=$1 |
|||
if [ -z "$BRANCH" ]; then |
|||
BRANCH=stable |
|||
else |
|||
# Cross check EasyEngine (ee) branch name |
|||
git ls-remote --heads https://github.com/rtCamp/easyengine | grep ${BRANCH}$ &>> $EE_INSTALL_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_error "The $BRANCH branch does not exist, please provide the correct branch name, exit status = " $? |
|||
fi |
|||
fi |
|||
|
|||
# Remove old version of EasyEngine (ee) |
|||
rm -rf /tmp/easyengine &>> /dev/null |
|||
|
|||
# Let's clone EasyEngine (ee) |
|||
ee_lib_echo "Cloning EasyEngine (ee) $BRANCH branch, please wait..." | tee -ai $EE_INSTALL_LOG |
|||
git clone -b $BRANCH https://github.com/rtCamp/easyengine.git /tmp/easyengine &>> $EE_INSTALL_LOG \ |
|||
|| ee_lib_error "Unable to clone EasyEngine (ee) $BRANCH branch, exit status = " $? |
|||
|
|||
|
|||
# Setup EasyEngine (ee) |
|||
if [ ! -d /etc/easyengine ]; then |
|||
mkdir -p /etc/easyengine \ |
|||
|| ee_lib_error "Unable to create /etc/easyengine directory, exit status = " $? |
|||
fi |
|||
|
|||
if [ ! -d /usr/share/easyengine/ ] |
|||
then |
|||
mkdir -p /usr/share/easyengine/ \ |
|||
|| ee_lib_error "Unable to create /usr/share/easyengine/ directory, exit status = " $? |
|||
fi |
|||
|
|||
if [ ! -d /usr/local/lib/easyengine ] |
|||
then |
|||
mkdir -p /usr/local/lib/easyengine \ |
|||
|| ee_lib_error "Unable to create /usr/local/lib/easyengine directory, exit status = " $? |
|||
fi |
|||
|
|||
|
|||
# Install EasyEngine (ee) |
|||
ee_lib_echo "Installing EasyEngine (ee), please wait..." | tee -ai $EE_INSTALL_LOG |
|||
|
|||
# EasyEngine (ee) auto completion file |
|||
cp -a /tmp/easyengine/config/bash_completion.d/ee /etc/bash_completion.d/ &>> $EE_INSTALL_LOG \ |
|||
|| ee_lib_error "Unable to copy EasyEngine (ee) auto completion file, exit status = " $? |
|||
|
|||
# EasyEngine (ee) config file |
|||
cp -a /tmp/easyengine/config/easyengine/ee.conf /etc/easyengine/ &>> $EE_INSTALL_LOG \ |
|||
|| ee_lib_error "Unable to copy EasyEngine (ee) config file, exit status = " $? |
|||
|
|||
# Templates |
|||
cp -a /tmp/easyengine/config/nginx /tmp/easyengine/templates/* /usr/share/easyengine/ &>> $EE_INSTALL_LOG \ |
|||
|| ee_lib_error "Unable to copy NGINX sample files, exit status = " $? |
|||
|
|||
# EasyEngine (ee) library and modules |
|||
cp -a /tmp/easyengine/src/* /usr/local/lib/easyengine \ |
|||
|| ee_lib_error "Unable to copy src files, exit status = " $? |
|||
|
|||
# EasyEngine (ee) command |
|||
cp -a /tmp/easyengine/bin/easyengine /usr/local/sbin/ &>> $EE_INSTALL_LOG \ |
|||
|| ee_lib_error "Unable to copy EasyEngine (ee) command, exit status = " $? |
|||
|
|||
# Change permission of EasyEngine (ee) command |
|||
chmod 750 /usr/local/sbin/easyengine || ee_lib_error "Unable to change permission of EasyEngine (ee) command, exit status = " $? |
|||
|
|||
# Create symbolic link |
|||
if [ ! -L /usr/local/sbin/ee ]; then |
|||
ln -s /usr/local/sbin/easyengine /usr/local/sbin/ee |
|||
fi |
|||
|
|||
# EasyEngine (ee) man page |
|||
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 = " $? |
|||
|
|||
# Git config settings |
|||
GIT_USER_NAME=$(git config user.name) |
|||
GIT_USER_EMAIL=$(git config user.email) |
|||
|
|||
if [ -z "$GIT_USER_NAME" ] || [ -z "$GIT_USER_EMAIL" ]; then |
|||
echo |
|||
ee_lib_echo "EasyEngine (ee) required your name & email address" | tee -ai $EE_INSTALL_LOG |
|||
ee_lib_echo "to track changes you made under the Git version control" | tee -ai $EE_INSTALL_LOG |
|||
ee_lib_echo "EasyEngine (ee) will be able to send you daily reports & alerts in upcoming version" | tee -ai $EE_INSTALL_LOG |
|||
ee_lib_echo "EasyEngine (ee) will NEVER send your information across" | tee -ai $EE_INSTALL_LOG |
|||
fi |
|||
|
|||
if [ -z "$GIT_USER_NAME" ]; then |
|||
read -p "Enter your name [$(whoami)]: " GIT_USER_NAME |
|||
# If enter is pressed |
|||
if [[ $GIT_USER_NAME = "" ]]; then |
|||
GIT_USER_NAME=$(whoami) |
|||
fi |
|||
git config --global user.name "${GIT_USER_NAME}" |
|||
echo "git config user.name = $(git config user.name)" &>> $EE_INSTALL_LOG |
|||
fi |
|||
|
|||
if [ -z "$GIT_USER_EMAIL" ];then |
|||
read -p "Enter your email address [$(whoami)@$(hostname -f)]: " GIT_USER_EMAIL |
|||
# If enter is pressed |
|||
if [[ $GIT_USER_EMAIL = "" ]] |
|||
then |
|||
GIT_USER_EMAIL=$(whoami)@$(hostname -f) |
|||
fi |
|||
git config --global user.email $GIT_USER_EMAIL |
|||
echo "git config user.email = $(git config user.email)" &>> $EE_INSTALL_LOG |
|||
fi |
|||
|
|||
# Enable EasyEngine (ee) auto completion |
|||
echo |
|||
ee_lib_echo "For EasyEngine (ee) auto completion, run the following command" | tee -ai $EE_INSTALL_LOG |
|||
ee_lib_echo_info "source /etc/bash_completion.d/ee" | tee -ai $EE_INSTALL_LOG |
|||
echo |
|||
|
|||
# Display success message |
|||
ee_lib_echo "EasyEngine (ee) installed successfully" | tee -ai $EE_INSTALL_LOG |
|||
ee_lib_echo "EasyEngine (ee) help: https://rtcamp.com/easyengine/docs/" | tee -ai $EE_INSTALL_LOG |
|||
echo |
@ -1,530 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
# Define variables |
|||
readonly EE_UPDATE_LOG=/var/log/easyengine/update.log |
|||
|
|||
# Define echo function |
|||
# Blue color |
|||
function ee_lib_echo() |
|||
{ |
|||
echo $(tput setaf 4)$@$(tput sgr0) |
|||
} |
|||
|
|||
# White color |
|||
function ee_lib_echo_info() |
|||
{ |
|||
echo $(tput setaf 7)$@$(tput sgr0) |
|||
} |
|||
|
|||
# Red color |
|||
function ee_lib_echo_fail() |
|||
{ |
|||
echo $(tput setaf 1)$@$(tput sgr0) |
|||
} |
|||
|
|||
# Capture errors |
|||
function ee_lib_error() |
|||
{ |
|||
echo "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG |
|||
exit $2 |
|||
} |
|||
|
|||
# Initialize Git |
|||
function ee_lib_git() |
|||
{ |
|||
for ee_git_dir in ${@:1:$(($#-1))}; do |
|||
if [ -d $ee_git_dir ]; then |
|||
# Change directory |
|||
cd $ee_git_dir |
|||
|
|||
# Check .git |
|||
if [ ! -d .git ]; then |
|||
# ee_lib_echo "Initialize Git on ${ee_git_dir}" |
|||
git init &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $? |
|||
fi |
|||
|
|||
# Check for untracked files |
|||
if [ $(git status -s | wc -l) -ne 0 ]; then |
|||
# Add files in Git version control |
|||
ee_lib_echo "Git commit on $ee_git_dir, please wait..." |
|||
git add --all && git commit -am "${@: -1}" &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $? |
|||
fi |
|||
fi |
|||
done |
|||
} |
|||
|
|||
# Update EasyEngine (ee) |
|||
# EasyEngine version: 1.0.0 |
|||
# EasyEngine (ee) version: 2.0.0 |
|||
EE_CURRENT_VERSION=$(ee version | sed 's/(ee) //' | awk '{print $3}') |
|||
EE_LATEST_VERSION=$(curl -sL https://api.github.com/repos/rtCamp/easyengine/releases | grep tag_name | awk '{print($2)}' | cut -d'"' -f2 | cut -c2- | head -n1) |
|||
echo EE_CURRENT_VERSION = $EE_CURRENT_VERSION EE_LATEST_VERSION = $EE_LATEST_VERSION &>> $EE_UPDATE_LOG |
|||
|
|||
if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then |
|||
read -p "Update EasyEngine to $EE_LATEST_VERSION (y/n): " EE_ANS |
|||
|
|||
if [ "$EE_ANS" = "y" ] || [ "$EE_ANS" = "Y" ]; then |
|||
ee_lib_echo "EasyEngine (ee) update started [$(date)]" | tee -ai $EE_UPDATE_LOG |
|||
|
|||
# Install required packages |
|||
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then |
|||
ee_lib_package_check graphviz python-software-properties software-properties-common |
|||
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then |
|||
ee_lib_package_check graphviz python-software-properties |
|||
fi |
|||
|
|||
if [ ! -x /usr/bin/tee ] || [ ! -x /bin/ed ] || [ ! -x /usr/bin/bc ] || [ ! -x /usr/bin/wget ] || [ ! -x /usr/bin/curl ] || [ ! -x /bin/tar ] || [ ! -x /usr/bin/git ] || [ -n "$EE_PACKAGE_NAME" ]; then |
|||
ee_lib_echo "Installing required packages, please wait..." | tee -ai $EE_INSTALL_LOG |
|||
apt-get -y install coreutils ed bc wget curl tar git-core $EE_PACKAGE_NAME | tee -ai $EE_INSTALL_LOG\ |
|||
|| ee_lib_error "Unable to install required packages, exit status = " $? |
|||
fi |
|||
|
|||
# Get Anemometer password |
|||
if [ -d /var/www/22222/htdocs/db/anemometer ]; then |
|||
if [ -f /usr/local/lib/easyengine/lib/ee_lib_import_slow_log.sh ]; then |
|||
ee_anemometer_pass=$(grep "\-\-password" /usr/local/lib/easyengine/lib/ee_lib_import_slow_log.sh | cut -d"=" -f3 ) |
|||
else |
|||
ee_anemometer_pass=$(grep "password=" /etc/logrotate.d/mysql-server | cut -d"=" -f3 ) |
|||
fi |
|||
ee_anemometer_pass=$(echo $ee_anemometer_pass | rev | cut -c 3- | rev) |
|||
fi |
|||
|
|||
# Git backup |
|||
ee_lib_git /etc/nginx/ /etc/php5/ /etc/mysql/ /etc/postfix "EasyEngine version $EE_CURRENT_VERSION" |
|||
|
|||
# Remove old version of EasyEngine (ee) |
|||
rm -rf /tmp/easyengine &>> /dev/null |
|||
|
|||
# Let's clone EasyEngine (ee) |
|||
ee_lib_echo "Cloning EasyEngine (ee) stable branch, please wait..." | tee -ai $EE_UPDATE_LOG |
|||
git clone -b stable https://github.com/rtCamp/easyengine.git /tmp/easyengine &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to clone EasyEngine (ee) stable branch, exit status = " $? |
|||
|
|||
# Setup EasyEngine (ee) |
|||
if [ ! -d /etc/easyengine ]; then |
|||
mkdir -p /etc/easyengine \ |
|||
|| ee_lib_error "Unable to create /etc/easyengine directory, exit status = " $? |
|||
fi |
|||
|
|||
if [ ! -d /usr/share/easyengine/ ] |
|||
then |
|||
mkdir -p /usr/share/easyengine/ \ |
|||
|| ee_lib_error "Unable to create /usr/share/easyengine/ directory, exit status = " $? |
|||
fi |
|||
|
|||
if [ ! -d /usr/local/lib/easyengine ] |
|||
then |
|||
mkdir -p /usr/local/lib/easyengine \ |
|||
|| ee_lib_error "Unable to create /usr/local/lib/easyengine directory, exit status = " $? |
|||
fi |
|||
|
|||
# Setup EasyEngine (ee) |
|||
# EasyEngine (ee) auto completion file |
|||
cp -av /tmp/easyengine/config/bash_completion.d/ee /etc/bash_completion.d/ &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to copy EasyEngine (ee) auto completion file, exit status = " $? |
|||
|
|||
# Templates |
|||
cp -a /tmp/easyengine/config/nginx /tmp/easyengine/templates/* /usr/share/easyengine/ &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to copy NGINX sample files, exit status = " $? |
|||
|
|||
# NGINX Setup |
|||
sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $EE_LATEST_VERSION\";/" /etc/nginx/nginx.conf |
|||
rsync -avz --exclude acl.conf /usr/share/easyengine/nginx/common/* /etc/nginx/common/ &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to rsync NGINX common files, exit status = " $? |
|||
|
|||
# EasyEngine (ee) library and modules |
|||
cp -av /tmp/easyengine/src/* /usr/local/lib/easyengine &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to copy src files, exit status = " $? |
|||
|
|||
# EasyEngine (ee) command |
|||
cp -av /tmp/easyengine/bin/easyengine /usr/local/sbin/ &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to copy EasyEngine (ee) command, exit status = " $? |
|||
|
|||
# Change permission of EasyEngine (ee) command |
|||
chmod 750 /usr/local/sbin/easyengine || ee_lib_error "Unable to change permission of EasyEngine (ee) command, exit status = " $? |
|||
|
|||
# Create symbolic link |
|||
if [ ! -L /usr/local/sbin/ee ]; then |
|||
ln -s /usr/local/sbin/easyengine /usr/local/sbin/ee |
|||
fi |
|||
|
|||
# EasyEngine (ee) man page |
|||
cp -av /tmp/easyengine/docs/man/ee.8 /usr/share/man/man8/ &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to copy EasyEngine (ee) man page, exit status = " $? |
|||
|
|||
|
|||
if [[ $EE_CURRENT_VERSION < 1.9.0 ]]; then |
|||
# EasyEngine (ee) config file |
|||
cp -av /etc/easyengine/ee.conf /etc/easyengine/ee.bak &>> $EE_UPDATE_LOG |
|||
cp -av /tmp/easyengine/config/easyengine/ee.conf /etc/easyengine/ &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to copy EasyEngine (ee) config file, exit status = " $? |
|||
|
|||
|
|||
# Lets re-used our functions |
|||
# Include library |
|||
for ee_include in $(find /usr/local/lib/easyengine/ -iname "*.sh"); do |
|||
source $ee_include |
|||
done |
|||
|
|||
# Avoid re-source and readonly errors |
|||
ee_source=1 |
|||
|
|||
# Lets modify the $EE_COMMAND_LOG value |
|||
# So all the logs write in $EE_UPDATE_LOG |
|||
EE_COMMAND_LOG=$EE_UPDATE_LOG |
|||
|
|||
# Install required packages |
|||
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then |
|||
ee_lib_package_check graphviz python-software-properties software-properties-common |
|||
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then |
|||
ee_lib_package_check graphviz python-software-properties |
|||
fi |
|||
|
|||
if [ ! -x /usr/bin/tee ] || [ ! -x /bin/ed ] || [ ! -x /usr/bin/bc ] || [ ! -x /usr/bin/wget ] || [ ! -x /usr/bin/curl ] || [ ! -x /bin/tar ] || [ ! -x /usr/bin/git ] || [ -n "$EE_PACKAGE_NAME" ]; then |
|||
ee_lib_echo "Installing required packages, please wait..." | tee -ai $EE_UPDATE_LOG |
|||
apt-get -y install coreutils ed bc wget curl tar git-core $EE_PACKAGE_NAME | tee -ai $EE_UPDATE_LOG\ |
|||
|| ee_lib_error "Unable to install required packages, exit status = " $? |
|||
fi |
|||
|
|||
# Get old value from ee.bak file |
|||
ee_stack_ip=$(grep ip_address /etc/easyengine/ee.bak | cut -d'=' -f2) |
|||
ee_mysql_host=$(grep mysqlhost /etc/easyengine/ee.bak | cut -d'=' -f2) |
|||
ee_wp_user=$(grep wpadminuser /etc/easyengine/ee.bak | cut -d'=' -f2) |
|||
ee_wp_pass=$(grep wpadminpass /etc/easyengine/ee.bak | cut -d'=' -f2) |
|||
#ee_wp_email=$(grep wpadminemail /etc/easyengine/ee.bak | cut -d'=' -f2) |
|||
|
|||
# Set localhost when no host found |
|||
if [ -z $ee_mysql_host ]; then |
|||
ee_mysql_host=localhost |
|||
fi |
|||
|
|||
# Ask email address |
|||
ee_lib_echo "Update your email address, which is used to setup WordPress" |
|||
read -p "Enter email address: " ee_wp_email |
|||
|
|||
# Update value in ee.conf file |
|||
$EE_CONFIG_SET stack.ip-address "$(echo -n $ee_stack_ip)" && \ |
|||
$EE_CONFIG_SET mysql.host "$(echo -n $ee_mysql_host)" && \ |
|||
$EE_CONFIG_SET wordpress.user "$(echo -n $ee_wp_user)" && \ |
|||
$EE_CONFIG_SET wordpress.password "$(echo -n $ee_wp_pass)" && \ |
|||
$EE_CONFIG_SET wordpress.email "$(echo -n $ee_wp_email)" \ |
|||
|| ee_lib_error "Unable to update ee.conf file, exit status = " $? |
|||
|
|||
# NGINX conf.d |
|||
cp -v /usr/share/easyengine/nginx/conf.d/fastcgi.conf /etc/nginx/conf.d/ &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to copy fastcgi.conf file, exit status = " $? |
|||
|
|||
cp -v /usr/share/easyengine/nginx/conf.d/upstream.conf /etc/nginx/conf.d/ &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to copy upstream.conf file, exit status = " $? |
|||
|
|||
|
|||
# NGINX common |
|||
if [[ $EE_CURRENT_VERSION = 1.0.0 ]] || [[ $EE_CURRENT_VERSION = 1.0.1 ]] || [[ $EE_CURRENT_VERSION = 1.1.0 ]]; then |
|||
# Move allowed_ip.conf to acl.conf |
|||
(sed "/allow/,+2d" /usr/share/easyengine/nginx/common/acl.conf; grep -v ^# /etc/nginx/common/allowed_ip.conf ) > /etc/nginx/common/acl.conf |
|||
sed -i '/allow ;/d' /etc/nginx/common/acl.conf |
|||
|
|||
# Update nginx.conf |
|||
# SSL settings |
|||
grep ssl_ /etc/nginx/nginx.conf &>> $EE_UPDATE_LOG |
|||
if [ $? -ne 0 ]; then |
|||
sed -i "/client_max_body_size/a \ \n\t# SSL Settings\n\tssl_session_cache shared:SSL:20m;\n\tssl_session_timeout 10m;\n\tssl_prefer_server_ciphers on;\n\tssl_ciphers HIGH:\!aNULL:\!MD5:\!kEDH;\n\n" /etc/nginx/nginx.conf |
|||
fi |
|||
# Log format |
|||
sed -i "s/log_format rt_cache.*/log_format rt_cache '\$remote_addr \$upstream_response_time \$upstream_cache_status [\$time_local] '/" /etc/nginx/nginx.conf |
|||
sed -i "s/.*\$body_bytes_sent'/\t\t'\$http_host \"\$request\" \$status \$body_bytes_sent '/" /etc/nginx/nginx.conf |
|||
|
|||
# Update PHP session storage to Memcache |
|||
sed -i "/extension/a \session.save_handler = memcache\nsession.save_path = \"tcp://localhost:11211\"" /etc/php5/mods-available/memcache.ini |
|||
|
|||
# Set easyengine:easyengine as default http authentication |
|||
if [ ! -f /etc/nginx/htpasswd-ee ]; then |
|||
printf "easyengine:$(openssl passwd -crypt easyengine 2> /dev/null)\n" > /etc/nginx/htpasswd-ee 2> /dev/null |
|||
fi |
|||
|
|||
# Update EasyEngine current version |
|||
EE_CURRENT_VERSION="1.2.2" |
|||
fi |
|||
if [[ $EE_CURRENT_VERSION = 1.2.2 ]]; then |
|||
# Update NGINX configuration |
|||
sed -i "/worker_processes/a \worker_rlimit_nofile 100000;" /etc/nginx/nginx.conf |
|||
sed -i "s/# multi_accept/multi_accept/" /etc/nginx/nginx.conf |
|||
sed -i "s/keepalive_timeout.*/keepalive_timeout 30;/" /etc/nginx/nginx.conf |
|||
|
|||
# Setup port 22222 |
|||
cp -av /usr/share/easyengine/nginx/22222 /etc/nginx/sites-available/ &>> $EE_UPDATE_LOG |
|||
if [ "$EE_LINUX_DISTRO" == "Debian" ]; then |
|||
# Dotdeb nginx repository doesn't support spdy |
|||
sed -i "s/ spdy//;" /usr/share/easyengine/nginx/22222 |
|||
fi |
|||
|
|||
# Create a symbolic link for 22222 |
|||
if [ ! -L /etc/nginx/sites-enabled/22222 ]; then |
|||
ln -s /etc/nginx/sites-available/22222 /etc/nginx/sites-enabled/ |
|||
fi |
|||
|
|||
# Setup logs for 22222 |
|||
if [ ! -d /var/www/22222/logs ]; then |
|||
mkdir -p /var/www/22222/logs |
|||
ln -s /var/log/nginx/22222.access.log /var/www/22222/logs/access.log |
|||
ln -s /var/log/nginx/22222.error.log /var/www/22222/logs/error.log |
|||
fi |
|||
|
|||
# Setup SSL |
|||
# Create SSL certificate directory |
|||
if [ ! -d /var/www/22222/cert ]; then |
|||
mkdir /var/www/22222/cert |
|||
fi |
|||
|
|||
# Generate SSL key |
|||
ee_lib_echo "Generating SSL private key" |
|||
openssl genrsa -out /var/www/22222/cert/22222.key 2048 &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to generate SSL private key for port 22222, exit status = " $? |
|||
|
|||
ee_lib_echo "Generating a certificate signing request (CSR)" |
|||
openssl req -new -batch -subj /commonName=127.0.0.1/ -key /var/www/22222/cert/22222.key -out /var/www/22222/cert/22222.csr &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to generate certificate signing request (CSR) for port 22222, exit status = " $? |
|||
|
|||
ee_lib_echo "Removing pass phrase from SSL private key" |
|||
mv /var/www/22222/cert/22222.key /var/www/22222/cert/22222.key.org |
|||
openssl rsa -in /var/www/22222/cert/22222.key.org -out /var/www/22222/cert/22222.key &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to remove pass phrase from SSL for port 22222, exit status = " $? |
|||
|
|||
ee_lib_echo "Generating SSL certificate" |
|||
openssl x509 -req -days 3652 -in /var/www/22222/cert/22222.csr -signkey /var/www/22222/cert/22222.key -out /var/www/22222/cert/22222.crt &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to generate SSL certificate for port 22222, exit status = " $? |
|||
|
|||
# Update PHP configuration |
|||
dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Installing php5-xdebug package, please wait..." |
|||
apt-get -y install php5-xdebug \ |
|||
|| ee_lib_error "Unable to install php5-xdebug package, exit status = " $? |
|||
|
|||
ee_lib_echo "Setting up PHP5, please wait..." |
|||
|
|||
# Custom php5 log directory |
|||
if [ ! -d /var/log/php5/ ]; then |
|||
mkdir -p /var/log/php5/ \ |
|||
|| ee_lib_error "Unable to create /var/log/PHP5/, exit status = " $? |
|||
fi |
|||
|
|||
# Update timezone |
|||
local ee_time_zone=$(cat /etc/timezone | head -n1 | sed "s'/'\\\/'") |
|||
sed -i "s/;date.timezone.*/date.timezone = $ee_time_zone/" /etc/php5/fpm/php.ini |
|||
|
|||
# Change php5-fpm error log location |
|||
sed -i "s'error_log.*'error_log = /var/log/php5/fpm.log'" /etc/php5/fpm/php-fpm.conf |
|||
|
|||
# Separate php5-fpm for ee debug command |
|||
cp -v /etc/php5/fpm/pool.d/www.conf /etc/php5/fpm/pool.d/debug.conf |
|||
|
|||
sed -i "s'\[www\]'[debug]'" /etc/php5/fpm/pool.d/debug.conf \ |
|||
|| ee_lib_error "Unable to change debug pool name, exit status = " $? |
|||
|
|||
sed -i "s'listen = 127.0.0.1:9000'listen = 127.0.0.1:9001'" /etc/php5/fpm/pool.d/debug.conf \ |
|||
|| ee_lib_error "Unable to change listen = 127.0.0.1:9001 for debug pool, exit status = " $? |
|||
|
|||
sed -i "s';slowlog.*'slowlog = /var/log/php5/slow.log'" /etc/php5/fpm/pool.d/debug.conf \ |
|||
|| ee_lib_error "Unable to change slowlog settings for debug pool, exit status = " $? |
|||
|
|||
sed -i "s';request_slowlog_timeout.*'request_slowlog_timeout = 10s'" /etc/php5/fpm/pool.d/debug.conf \ |
|||
|| ee_lib_error "Unable to change request_slowlog_timeout for debug pool, exit status = " $? |
|||
|
|||
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_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to add xdebug settings for debug pool, exit status = " $? |
|||
fi |
|||
|
|||
mysqladmin ping &> /dev/null &>> $EE_UPDATE_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Installing percona-toolkit package, please wait..." |
|||
apt-get -y install percona-toolkit \ |
|||
|| ee_lib_error "Unable to install percona-toolkit package, exit status = " $? |
|||
fi |
|||
|
|||
# Install 22222 admin tools |
|||
ee_ven_install_utils |
|||
ee_ven_install_phpmyadmin |
|||
|
|||
# Update EasyEngine current version |
|||
EE_CURRENT_VERSION="1.3.0" |
|||
fi |
|||
if [[ $EE_CURRENT_VERSION = 1.3.0 ]] || [[ $EE_CURRENT_VERSION = 1.3.1 ]] || [[ $EE_CURRENT_VERSION = 1.3.2 ]] || [[ $EE_CURRENT_VERSION = 1.3.3 ]]; then |
|||
grep "^pm = ondemand" /etc/php5/fpm/pool.d/www.conf &>> $EE_UPDATE_LOG |
|||
if [ $? -ne 0 ]; then |
|||
sed -i "s/pm = dynamic/pm = ondemand/" /etc/php5/fpm/pool.d/www.conf \ |
|||
|| ee_lib_error "Unable to change process manager from dynamic to ondemand, exit status = " $? |
|||
fi |
|||
grep "^pm = ondemand" /etc/php5/fpm/pool.d/debug.conf &>> $EE_UPDATE_LOG |
|||
if [ $? -ne 0 ]; then |
|||
sed -i "s/pm = dynamic/pm = ondemand/" /etc/php5/fpm/pool.d/debug.conf \ |
|||
|| ee_lib_error "Unable to change process manager from dynamic to ondemand on debug.conf, exit status = " $? |
|||
fi |
|||
|
|||
# Update EasyEngine current version |
|||
EE_CURRENT_VERSION="1.3.4" |
|||
fi |
|||
if [[ $EE_CURRENT_VERSION = 1.3.4 ]] || [[ $EE_CURRENT_VERSION = 1.3.5 ]] || [[ $EE_CURRENT_VERSION = 1.3.6 ]] || [[ $EE_CURRENT_VERSION = 1.3.7 ]] || [[ $EE_CURRENT_VERSION = 1.3.8 ]]; then |
|||
# Update 22222 for fix #259 |
|||
cp -av /usr/share/easyengine/nginx/22222 /etc/nginx/sites-available/ &>> $EE_UPDATE_LOG |
|||
if [ "$EE_LINUX_DISTRO" == "Debian" ]; then |
|||
# Dotdeb nginx repository doesn't support spdy |
|||
sed -i "s/ spdy//;" /usr/share/easyengine/nginx/22222 |
|||
fi |
|||
# Update NGINX |
|||
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; 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..." |
|||
add-apt-repository -y ppa:rtcamp/nginx &>> $EE_UPDATE_LOG \ |
|||
|| ee_lib_error "Unable to add rtCamp NGINX launchpad repository, exit status = " $? |
|||
|
|||
# Execute: apt-get update |
|||
ee_lib_apt_get_update |
|||
|
|||
# Install NGINX |
|||
apt-get -o Dpkg::Options::="--force-confold" -y install nginx-custom \ |
|||
|| ee_lib_error "Unable to install nginx-custom package, exit status = " $? |
|||
fi |
|||
fi |
|||
|
|||
# Update EasyEngine current version |
|||
EE_CURRENT_VERSION="2.0.0" |
|||
fi |
|||
fi |
|||
|
|||
if [[ $EE_CURRENT_VERSION > 1.9.0 ]]; then |
|||
|
|||
# Lets re-used our functions |
|||
# Include library |
|||
if [ -z $ee_source ]; then |
|||
for ee_include in $(find /usr/local/lib/easyengine/ -iname "*.sh"); do |
|||
source $ee_include |
|||
done |
|||
fi |
|||
|
|||
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 |
|||
|
|||
# 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 |
|||
|
|||
if [ -d /var/www/22222/htdocs/db/anemometer ];then |
|||
# Download pt-query-advisor Fixed #189 |
|||
wget -q http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/2.1/download/head:/ptquerydigest-20110624220137-or26tn4expb9ul2a-16/pt-query-digest -O /usr/bin/pt-query-advisor \ |
|||
|| ee_lib_error "Unable to copy download pt-query-advisor, exit status = " $? |
|||
chmod 0755 /usr/bin/pt-query-advisor |
|||
|
|||
# Enable pt-query-advisor plugin in Anemometer |
|||
sed -i "s/# 'query_advisor'/ 'query_advisor'/" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \ |
|||
|| ee_lib_error "Unable to to activate pt-query-advisor plugin, exit status = " $? |
|||
fi |
|||
|
|||
# Update EasyEngine current version |
|||
EE_CURRENT_VERSION="2.1.0" |
|||
fi |
|||
|
|||
if [[ $EE_CURRENT_VERSION = 2.1.0 ]]; then |
|||
|
|||
# Change permission of EasyEngine log folder |
|||
chmod -R 700 /var/log/easyengine \ |
|||
|| ee_lib_error "Unable to change permissions for EasyEngine log folder, exit status = " $? |
|||
|
|||
# RAM based optimization settings |
|||
ee_lib_ram |
|||
|
|||
if [ -f /etc/php5/fpm/pool.d/www.conf ]; then |
|||
sed -i "s/pm.max_children = .*/pm.max_children = ${EE_PHP_MAX_CHILDREN}/" /etc/php5/fpm/pool.d/www.conf |
|||
fi |
|||
|
|||
# Setup Zend OpCache as per RAM |
|||
if [ -f /etc/php5/fpm/conf.d/05-opcache.ini ]; then |
|||
grep memory_consumption /etc/php5/fpm/conf.d/05-opcache.ini &> /dev/null |
|||
if [ $? -ne 0 ]; then |
|||
sed -i "s/zend_extension=opcache.so/zend_extension=opcache.so\nopcache.memory_consumption=${EE_OPCACHE_SIZE}\nopcache.max_accelerated_files=50000/" /etc/php5/fpm/conf.d/05-opcache.ini \ |
|||
|| ee_lib_error "Unable to change opcache.memory_consumption, exit status = " $? |
|||
fi |
|||
fi |
|||
|
|||
# Setup PHP Memcache as per RAM |
|||
if [ -f /etc/memcached.conf ]; then |
|||
sed -i "s/-m.*/-m ${EE_MEMCACHE_SIZE}/" /etc/memcached.conf \ |
|||
|| ee_lib_error "Unable to change Memcache memory value, exit status = " $? |
|||
fi |
|||
|
|||
# Add PHP GeoIP module |
|||
dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG |
|||
if [ $? -eq 0 ]; then |
|||
$EE_APT_GET install php5-geoip |
|||
ee_lib_echo "Downloading GeoIP Database, please wait..." |
|||
mkdir -p /usr/share/GeoIP |
|||
wget -qO /usr/share/GeoIP/GeoLiteCity.dat.gz 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 |
|||
|
|||
# Fix PhpMyAdmin config issue |
|||
if [ -d /var/www/22222/htdocs/db/pma ]; then |
|||
ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 7 | head -n1) |
|||
|
|||
if [ ! -f /var/www/22222/htdocs/db/pma/config.inc.php ]; then |
|||
cp -v /var/www/22222/htdocs/db/pma/config.sample.inc.php /var/www/22222/htdocs/db/pma/config.inc.php &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to setup phpMyAdmin, exit status = " $? |
|||
fi |
|||
|
|||
sed -i "s/a8b7c6d/$ee_random/" /var/www/22222/htdocs/db/pma/config.inc.php \ |
|||
|| ee_lib_error "Unable to setup phpMyAdmin, exit status = " $? |
|||
fi |
|||
|
|||
# Update EasyEngine current version |
|||
EE_CURRENT_VERSION="2.2.0" |
|||
fi |
|||
# if [[ $EE_CURRENT_VERSION = 2.2.0 ]]; then |
|||
# fi |
|||
fi |
|||
|
|||
# Update WP-CLI |
|||
ee_ven_install_wpcli |
|||
|
|||
# Set Anemometer password |
|||
if [ -d /var/www/22222/htdocs/db/anemometer ]; then |
|||
# Change Anemometer Hostname in ee_lib_import_slow_log |
|||
sed -i "s:hostname.*:hostname}=\\\\\"$EE_MYSQL_HOST\\\\\"\" /var/log/mysql/mysql-slow.log:" /usr/local/lib/easyengine/lib/ee_lib_import_slow_log.sh \ |
|||
|| ee_lib_error "Unable to change Anemometer hostnameme, exit status = " $? |
|||
|
|||
# Change Anemometer password in ee_lib_import_slow_log |
|||
sed -i "s/--password.*/--password=${ee_anemometer_pass} \\\/" /usr/local/lib/easyengine/lib/ee_lib_import_slow_log.sh \ |
|||
|| ee_lib_error "Unable to change Anemometer password, exit status = " $? |
|||
fi |
|||
|
|||
# Restart service |
|||
ee_lib_service nginx php5-fpm restart |
|||
|
|||
# Git backup |
|||
ee_lib_git /etc/nginx/ /etc/php5/ /etc/mysql/ /etc/postfix /etc/easyengine "EasyEngine version $EE_LATEST_VERSION" |
|||
|
|||
# Enable EasyEngine (ee) auto completion |
|||
echo |
|||
ee_lib_echo "For EasyEngine (ee) auto completion, run the following command" | tee -ai $EE_UPDATE_LOG |
|||
ee_lib_echo_info "source /etc/bash_completion.d/ee" | tee -ai $EE_UPDATE_LOG |
|||
echo |
|||
ee_lib_echo "EasyEngine (ee) updated successfully" |
|||
fi |
|||
else |
|||
ee_lib_echo "Latest version ($EE_CURRENT_VERSION) already installed" |
|||
fi |
@ -1,5 +0,0 @@ |
|||
1. **bash_completion.d** - EasyEngine auto completion script. Actual Linux Path : `/etc/bash_completion.d/` |
|||
|
|||
1. **easyengine** - EasyEngine (ee) configuration file. Actual Linux Path : `/etc/easyengine/` |
|||
|
|||
1. **nginx** - NGINX configuration files. Actual Linux Path : `/etc/nginx` |
@ -1 +0,0 @@ |
|||
1. **ee** - EasyEngine auto completion script. |
@ -1,127 +0,0 @@ |
|||
# EasyEngine auto complete |
|||
|
|||
function ee_single() |
|||
{ |
|||
for (( j=0; j<${#COMP_WORDS[@]}; j++ )); do |
|||
for (( i=0; i<${#COMPREPLY[@]}; i++ )); do |
|||
if [[ ${COMP_WORDS[COMP_CWORD-j]} == ${COMPREPLY[i]} ]]; then |
|||
rem=( ${COMP_WORDS[COMP_CWORD-j]} ); |
|||
COMPREPLY=( "${COMPREPLY[@]/$rem}" ) |
|||
fi |
|||
done |
|||
done |
|||
} |
|||
|
|||
function EE_AUTO() |
|||
{ |
|||
# Get current word |
|||
local CURRENT=${COMP_WORDS[COMP_CWORD]} |
|||
|
|||
# Get previous word |
|||
local PREVIOUS=${COMP_WORDS[COMP_CWORD-1]} |
|||
local PREVIOUS2=${COMP_WORDS[COMP_CWORD-2]} |
|||
local PREVIOUS3=${COMP_WORDS[COMP_CWORD-3]} |
|||
|
|||
# List of suggested words |
|||
case "$PREVIOUS" in |
|||
|
|||
# List of suggested words |
|||
easyengine|ee) |
|||
COMPREPLY=( $(compgen -W '$(echo clean version help info update import-slow-log; command find /usr/local/lib/easyengine/modules/ -maxdepth 1 -type d -printf "%P " 2> /dev/null)' -- $CURRENT) ) |
|||
return 0 |
|||
;; |
|||
|
|||
stack) |
|||
COMPREPLY=( $( compgen -W '$(echo purge status stop start reload restart; command find /usr/local/lib/easyengine/modules/stack -maxdepth 1 -type d -printf "%P " 2> /dev/null)' -- $CURRENT ) ) |
|||
return 0 |
|||
;; |
|||
|
|||
install|remove|purge) |
|||
COMPREPLY=( $( compgen -W '$(echo mail all web mailscanner admin; 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 |
|||
;; |
|||
|
|||
clean) |
|||
COMPREPLY=( $( compgen -W '$(echo cd fastcgi memcache opcache all;)' -- $CURRENT ) ) |
|||
return 0 |
|||
;; |
|||
|
|||
site) |
|||
COMPREPLY=( $( compgen -W '$(echo cd create delete disable edit enable info list log show update;)' -- $CURRENT ) ) |
|||
return 0 |
|||
;; |
|||
|
|||
list) |
|||
COMPREPLY=( $( compgen -W "enable available" -- $CURRENT ) ) |
|||
return 0 |
|||
;; |
|||
|
|||
info|enable|edit|show|delete|cd|log|update) |
|||
if [ "$PREVIOUS2" = "site" ]; then |
|||
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null)' -- $CURRENT ) ) |
|||
fi |
|||
return 0 |
|||
;; |
|||
|
|||
disable) |
|||
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null)' -- $CURRENT ) ) |
|||
return 0 |
|||
;; |
|||
|
|||
--wpsubdir|--wpsubdomain) |
|||
COMPREPLY=( $( compgen -W "--basic --w3tc --wpsc --wpfc" -- $CURRENT ) ) |
|||
return 0 |
|||
;; |
|||
|
|||
debug) |
|||
COMPREPLY=( $(compgen -W '$(command cd /usr/local/lib/easyengine/modules/debug/; find -type f | grep debug | cut -d'_' -f4 | cut -d '.' -f1 | sed 's/^/--/g' 2> /dev/null)' -- $CURRENT) ) |
|||
return 0 |
|||
;; |
|||
|
|||
--nginx|--rewrite|--php|--fpm|--mysql) |
|||
if [ "$PREVIOUS" = "--mysql" ]; then |
|||
COMPREPLY=( $(compgen -W '$(echo --import-slow-log-interval; command cd /usr/local/lib/easyengine/modules/debug/; find -type f | grep debug | cut -d'_' -f4 | cut -d '.' -f1 | sed 's/^/--/g' 2> /dev/null)' -- $CURRENT) ) |
|||
else |
|||
COMPREPLY=( $(compgen -W '$(command cd /usr/local/lib/easyengine/modules/debug/; find -type f | grep debug | cut -d'_' -f4 | cut -d '.' -f1 | sed 's/^/--/g' 2> /dev/null)' -- $CURRENT) ) |
|||
fi |
|||
ee_single |
|||
return 0 |
|||
;; |
|||
|
|||
|
|||
--wp) |
|||
if [ "$PREVIOUS3" = "create" ] || [ "$PREVIOUS3" = "update" ]; then |
|||
COMPREPLY=( $( compgen -W "--basic --w3tc --wpsc --wpfc" -- $CURRENT ) ) |
|||
else |
|||
COMPREPLY=( $(compgen -W '$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null; command cd /usr/local/lib/easyengine/modules/debug/; find -type f | grep debug | grep -v wp | cut -d'_' -f4 | cut -d '.' -f1 | sed 's/^/--/g' 2> /dev/null)' -- $CURRENT) ) |
|||
ee_single |
|||
fi |
|||
return 0 |
|||
;; |
|||
|
|||
--stop) |
|||
|
|||
COMPREPLY=( $( compgen -W '$(command find /etc/nginx/sites-enabled/ -type l -printf "%P " 2> /dev/null)' -- $CURRENT ) ) |
|||
ee_single |
|||
return 0 |
|||
;; |
|||
|
|||
secure) |
|||
COMPREPLY=( $( compgen -W '$( cd /usr/local/lib/easyengine/modules/secure; find -type f | grep secure | cut -d'_' -f4 | cut -d '.' -f1 | sed 's/^/--/g' 2> /dev/null)' -- $CURRENT ) ) |
|||
return 0 |
|||
;; |
|||
|
|||
*) |
|||
if [ "$PREVIOUS2" = "create" ]; then |
|||
COMPREPLY=( $( compgen -W "--html --php --mysql --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) |
|||
elif [ "$PREVIOUS2" = "update" ]; then |
|||
COMPREPLY=( $( compgen -W "--password --php --mysql --wp --wpsubdir --wpsubdomain" -- $CURRENT ) ) |
|||
elif [ "$PREVIOUS2" = "delete" ]; then |
|||
COMPREPLY=( $( compgen -W "--db --all --files --no-prompt" -- $CURRENT ) ) |
|||
fi |
|||
return 0 |
|||
;; |
|||
esac |
|||
} |
|||
|
|||
complete -F EE_AUTO ee easyengine |
@ -1 +0,0 @@ |
|||
1. **ee** - EasyEngine (ee) configuration file. |
@ -1,17 +0,0 @@ |
|||
# EasyEngine (ee) configuration file |
|||
|
|||
[stack] |
|||
apt-get-assume-yes = true |
|||
gpg-key-fix = false |
|||
ip-address = |
|||
|
|||
[mysql] |
|||
grant-host = localhost |
|||
db-name = false |
|||
db-user = false |
|||
|
|||
[wordpress] |
|||
prefix = false |
|||
user = |
|||
password = |
|||
email = |
@ -1,2 +0,0 @@ |
|||
1. **common** - NGINX common configuration settings |
|||
1. **conf.d** - NGINX default settings for access control, PHP upstream & FastCGI cache settings. |
@ -1,8 +0,0 @@ |
|||
1. **acl.conf** - Protect locations using HTTP AUTH OR IP-Based authentication |
|||
1. **locations.conf** - Defines common locations |
|||
1. **php** - common PHP NGINX configuration. |
|||
1. **wpcommon.conf** - WordPress common settings |
|||
1. **w3tc.conf** - W3 Total Cache configuration settings. |
|||
1. **wpsc.conf** - WP Super Cache configuration settings. |
|||
1. **wpfc.conf** - NGINX FastCGI configuration settings. |
|||
1. **wpsubdir.conf** - NGINX configuration for WordPress Multisite (subdirectory). |
@ -1,10 +0,0 @@ |
|||
# EasyEngine (ee) protect locations using |
|||
# HTTP authentication || IP address |
|||
|
|||
satisfy any; |
|||
auth_basic "Restricted Area"; |
|||
auth_basic_user_file htpasswd-ee; |
|||
|
|||
# Allowed IP Address List |
|||
allow 127.0.0.1; |
|||
deny all; |
@ -1,82 +0,0 @@ |
|||
# NGINX CONFIGURATION FOR COMMON LOCATION |
|||
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee) |
|||
|
|||
# Basic locations files |
|||
location = /favicon.ico { |
|||
access_log off; |
|||
log_not_found off; |
|||
expires max; |
|||
} |
|||
|
|||
location = /robots.txt { |
|||
# Some WordPress plugin gererate robots.txt file |
|||
# Refer #340 issue |
|||
try_files $uri $uri/ /index.php?$args; |
|||
access_log off; |
|||
log_not_found off; |
|||
} |
|||
|
|||
# Cache static files |
|||
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)$ { |
|||
add_header "Access-Control-Allow-Origin" "*"; |
|||
access_log off; |
|||
log_not_found off; |
|||
expires max; |
|||
} |
|||
|
|||
|
|||
# Security settings for better privacy |
|||
|
|||
# Deny hidden files |
|||
location ~ /\. { |
|||
deny all; |
|||
access_log off; |
|||
log_not_found off; |
|||
} |
|||
|
|||
# Deny backup extensions & log files |
|||
location ~* ^.+\.(bak|log|old|orig|original|php#|php~|php_bak|save|swo|swp|sql)$ { |
|||
deny all; |
|||
access_log off; |
|||
log_not_found off; |
|||
} |
|||
|
|||
# Return 403 forbidden for readme.(txt|html) or license.(txt|html) |
|||
if ($request_uri ~* "^.+(readme|license)\.(txt|html)$") { |
|||
return 403; |
|||
} |
|||
|
|||
|
|||
# Status pages |
|||
location /nginx_status { |
|||
stub_status on; |
|||
access_log off; |
|||
include common/acl.conf; |
|||
} |
|||
|
|||
location ~ ^/(status|ping) { |
|||
include fastcgi_params; |
|||
fastcgi_pass php; |
|||
include common/acl.conf; |
|||
} |
|||
|
|||
|
|||
# EasyEngine (ee) utilities |
|||
|
|||
# phpMyAdmin settings |
|||
location /pma { |
|||
return 301 https://$host:22222/db/pma; |
|||
} |
|||
|
|||
location /phpMyAdmin { |
|||
return 301 https://$host:22222/db/pma; |
|||
} |
|||
|
|||
location /phpmyadmin { |
|||
return 301 https://$host:22222/db/pma; |
|||
} |
|||
|
|||
# Adminer settings |
|||
location /adminer { |
|||
return 301 https://$host:22222/db/adminer; |
|||
} |
@ -1,12 +0,0 @@ |
|||
# PHP NGINX CONFIGURATION |
|||
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee) |
|||
|
|||
location / { |
|||
try_files $uri $uri/ /index.php?$args; |
|||
} |
|||
|
|||
location ~ \.php$ { |
|||
try_files $uri =404; |
|||
include fastcgi_params; |
|||
fastcgi_pass php; |
|||
} |
@ -1,38 +0,0 @@ |
|||
# W3TC NGINX CONFIGURATION |
|||
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee) |
|||
|
|||
set $cache_uri $request_uri; |
|||
|
|||
# POST requests and URL with a query string should always go to php |
|||
if ($request_method = POST) { |
|||
set $cache_uri 'null cache'; |
|||
} |
|||
|
|||
if ($query_string != "") { |
|||
set $cache_uri 'null cache'; |
|||
} |
|||
|
|||
# Don't cache URL containing the following segments |
|||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|||
set $cache_uri 'null cache'; |
|||
} |
|||
|
|||
# Don't use the cache for logged in users or recent commenter |
|||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { |
|||
set $cache_uri 'null cache'; |
|||
} |
|||
|
|||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|||
location / { |
|||
try_files /wp-content/cache/page_enhanced/${host}${cache_uri}_index.html $uri $uri/ /index.php?$args; |
|||
} |
|||
|
|||
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { |
|||
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; |
|||
} |
|||
|
|||
location ~ \.php$ { |
|||
try_files $uri =404; |
|||
include fastcgi_params; |
|||
fastcgi_pass php; |
|||
} |
@ -1,42 +0,0 @@ |
|||
# WordPress COMMON SETTINGS |
|||
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee) |
|||
|
|||
# Limit access to avoid brute force attack |
|||
location = /wp-login.php { |
|||
limit_req zone=one burst=1 nodelay; |
|||
include fastcgi_params; |
|||
fastcgi_pass php; |
|||
} |
|||
|
|||
# Disable wp-config.txt |
|||
location = /wp-config.txt { |
|||
deny all; |
|||
access_log off; |
|||
log_not_found off; |
|||
} |
|||
|
|||
# Disallow php in upload folder |
|||
location /wp-content/uploads/ { |
|||
location ~ \.php$ { |
|||
#Prevent Direct Access Of PHP Files From Web Browsers |
|||
deny all; |
|||
} |
|||
} |
|||
|
|||
# Yoast sitemap |
|||
location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ { |
|||
rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent; |
|||
rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last; |
|||
|
|||
# Rules for yoast sitemap with wp|wpsubdir|wpsubdomain |
|||
rewrite ^.*/sitemap_index\.xml$ /index.php?sitemap=1 last; |
|||
rewrite ^.*/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last; |
|||
|
|||
# Following lines are options. Needed for WordPress seo addons |
|||
rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last; |
|||
rewrite ^/locations\.kml$ /index.php?sitemap=wpseo_local_kml last; |
|||
rewrite ^/geo_sitemap\.xml$ /index.php?sitemap=wpseo_local last; |
|||
rewrite ^/video-sitemap\.xsl$ /index.php?xsl=video last; |
|||
|
|||
access_log off; |
|||
} |
@ -1,47 +0,0 @@ |
|||
# WPFC NGINX CONFIGURATION |
|||
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee) |
|||
|
|||
set $skip_cache 0; |
|||
|
|||
# POST requests and URL with a query string should always go to php |
|||
if ($request_method = POST) { |
|||
set $skip_cache 1; |
|||
} |
|||
|
|||
if ($query_string != "") { |
|||
set $skip_cache 1; |
|||
} |
|||
|
|||
# Don't cache URL containing the following segments |
|||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|||
set $skip_cache 1; |
|||
} |
|||
|
|||
# Don't use the cache for logged in users or recent commenter |
|||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { |
|||
set $skip_cache 1; |
|||
} |
|||
|
|||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|||
location / { |
|||
try_files $uri $uri/ /index.php?$args; |
|||
} |
|||
|
|||
location ~ ^/wp-content/cache/minify/(.+\.(css|js))$ { |
|||
try_files $uri /wp-content/plugins/w3-total-cache/pub/minify.php?file=$1; |
|||
} |
|||
|
|||
location ~ \.php$ { |
|||
try_files $uri =404; |
|||
include fastcgi_params; |
|||
fastcgi_pass php; |
|||
|
|||
fastcgi_cache_bypass $skip_cache; |
|||
fastcgi_no_cache $skip_cache; |
|||
|
|||
fastcgi_cache WORDPRESS; |
|||
} |
|||
|
|||
location ~ /purge(/.*) { |
|||
fastcgi_cache_purge WORDPRESS "$scheme$request_method$host$1"; |
|||
} |
@ -1,39 +0,0 @@ |
|||
# WPSC NGINX CONFIGURATION |
|||
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee) |
|||
|
|||
set $cache_uri $request_uri; |
|||
|
|||
# POST requests and URL with a query string should always go to php |
|||
if ($request_method = POST) { |
|||
set $cache_uri 'null cache'; |
|||
} |
|||
|
|||
if ($query_string != "") { |
|||
set $cache_uri 'null cache'; |
|||
} |
|||
|
|||
# Don't cache URL containing the following segments |
|||
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|wp-.*.php|index.php|/feed/|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { |
|||
set $cache_uri 'null cache'; |
|||
} |
|||
|
|||
# Don't use the cache for logged in users or recent commenter |
|||
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in") { |
|||
set $cache_uri 'null cache'; |
|||
} |
|||
|
|||
# Use cached or actual file if they exists, Otherwise pass request to WordPress |
|||
location / { |
|||
# If we add index.php?$args its break WooCommerce like plugins |
|||
# Ref: #330 |
|||
try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php; |
|||
} |
|||
|
|||
location ~ \.php$ { |
|||
try_files $uri =404; |
|||
include fastcgi_params; |
|||
fastcgi_pass php; |
|||
|
|||
# Following line is needed by WP Super Cache plugin |
|||
fastcgi_param SERVER_NAME $http_host; |
|||
} |
@ -1,14 +0,0 @@ |
|||
# WPSUBDIRECTORY NGINX CONFIGURATION |
|||
# DO NOT MODIFY, ALL CHNAGES LOST AFTER UPDATE EasyEngine (ee) |
|||
|
|||
if (!-e $request_filename) { |
|||
|
|||
# Redirect wp-admin to wp-admin/ |
|||
rewrite /wp-admin$ $scheme://$host$uri/ permanent; |
|||
|
|||
# Redirect wp-* files/folders |
|||
rewrite ^(/[^/]+)?(/wp-.*) $2 last; |
|||
|
|||
# Redirect other php files |
|||
rewrite ^(/[^/]+)?(/.*\.php) $2 last; |
|||
} |
@ -1,3 +0,0 @@ |
|||
1. **blockips.conf** - Block IP address |
|||
1. **fastcgi.conf** - FastCGI cache Settings |
|||
1. **upstream.conf** - Common upstream settings |
@ -1,2 +0,0 @@ |
|||
# Block IP Address |
|||
# deny 1.1.1.1; |
@ -1,12 +0,0 @@ |
|||
# FastCGI cache settings |
|||
|
|||
fastcgi_cache_path /var/run/nginx-cache levels=1:2 keys_zone=WORDPRESS:50m inactive=60m; |
|||
fastcgi_cache_key "$scheme$request_method$host$request_uri"; |
|||
fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503; |
|||
fastcgi_cache_valid any 1h; |
|||
|
|||
fastcgi_buffers 16 16k; |
|||
fastcgi_buffer_size 32k; |
|||
|
|||
fastcgi_param SERVER_NAME $http_host; |
|||
fastcgi_ignore_headers Cache-Control Expires Set-Cookie; |
@ -1,11 +0,0 @@ |
|||
# Common upstream settings |
|||
|
|||
upstream php { |
|||
# server unix:/run/php5-fpm.sock; |
|||
server 127.0.0.1:9000; |
|||
} |
|||
|
|||
upstream debug { |
|||
# Debug Pool |
|||
server 127.0.0.1:9001; |
|||
} |
@ -1 +1,11 @@ |
|||
1. **man** - manual pages for EasyEngine (ee). Actual Linux Path : `/usr/share/man/man8/` |
|||
**Framework** |
|||
|
|||
EasyEngine 3.x is based on cement cli application developement framework |
|||
|
|||
Cement version 2.4.0 |
|||
|
|||
Know more about Cement From [here](http://builtoncement.com/2.4/) |
|||
|
|||
**Language** |
|||
|
|||
EasyEngine intend to use latest version of Python i.e 3.4 to avoid future refactoring. |
|||
|
@ -0,0 +1,13 @@ |
|||
|
|||
## EasyEngine coding standard |
|||
|
|||
For contributing EasyEngine you must follow [PEP8](https://www.python.org/dev/peps/pep-0008) style guide. |
|||
|
|||
- Indentation - |
|||
|
|||
4 spaces shoule be used as Indentation as mentioned in above style guide. |
|||
|
|||
- Class Name - |
|||
|
|||
|
|||
- Function Name - |
@ -0,0 +1,21 @@ |
|||
|
|||
**EasyEngine 3.x Ditectory Structure** |
|||
|
|||
``` |
|||
easyengine |
|||
|-- config |
|||
| `-- plugins.d |
|||
|-- ee |
|||
| |-- cli |
|||
| | |-- controllers |
|||
| | |-- ext |
|||
| | |-- plugins |
|||
| | `-- templates |
|||
| |-- core |
|||
| `-- utils |
|||
`-- tests |
|||
|-- cli |
|||
| |-- ext |
|||
| `-- plugins |
|||
`-- core |
|||
``` |
@ -1 +0,0 @@ |
|||
1. **ee.8** - manual page for EasyEngine (ee). |
@ -1,310 +0,0 @@ |
|||
.TH ee 8 "EasyEngine (ee) version: 2.0.0" "July 11, 2014" "EasyEngine" |
|||
.SH NAME |
|||
.B EasyEngine (ee) |
|||
\- Manage Nginx Based Websites. |
|||
.SH SYNOPSIS |
|||
ee [ version | help | info | stack | site | debug | update ] |
|||
.TP |
|||
ee stack [ install | remove | purge ] [ --web | --mail | --all | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] |
|||
.TP |
|||
ee stack [ status | start | stop | reload | restart ] |
|||
.TP |
|||
ee site [ list | info | show | enable | disable | edit ] [ example.com ] |
|||
.TP |
|||
ee site create example.com [ --html | --php | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--basic | --wpsc | --w3tc | --wpfc]] |
|||
.TP |
|||
ee site update example.com [ --php | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--basic | --wpsc | --w3tc | --wpfc]] |
|||
.TP |
|||
ee site delete example.com [--db | --files | --all | --no-prompt ] |
|||
.TP |
|||
ee debug [ -i | --nginx | --rewrite | --php | --fpm | --mysql ] [ --stop ] |
|||
.TP |
|||
ee debug example.com [ -i | --nginx | --rewrite | --wp ] [--stop ] |
|||
.TP |
|||
ee secure [ --auth | --port | --ip ] |
|||
.SH DESCRIPTION |
|||
EasyEngine aka ee is the opensource project developed with the purpose to automate web-server configuration. |
|||
.br |
|||
EasyEngine is the collection of shell scripts that provides automation for the web-server |
|||
.br |
|||
installation, site creation, services debugging & monitoring. |
|||
.SH OPTIONS |
|||
.TP |
|||
.B version |
|||
.br |
|||
Display easyengine (ee) version information. |
|||
.TP |
|||
.B info |
|||
.br |
|||
ee info - Display Nginx, PHP, MySQL and ee common location information |
|||
.br |
|||
ee site info - Diplay given website details like enable, disable. weboot and log files. |
|||
.TP |
|||
.B help |
|||
.br |
|||
Display easyengine (ee) help. |
|||
.TP |
|||
.B stack |
|||
.TP |
|||
.B install [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] |
|||
.br |
|||
Install Nginx PHP5 MySQL Postfix stack Packages if not used with |
|||
.br |
|||
any options.Installs specific package if used with option. |
|||
.TP |
|||
.B remove [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] |
|||
.br |
|||
Remove Nginx PHP5 MySQL Postfix stack Packages if not used with |
|||
.br |
|||
any options. Remove specific package if used with option. |
|||
.TP |
|||
.B purge [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] |
|||
.br |
|||
Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any |
|||
.br |
|||
options.Purge specific package if used with option. |
|||
.TP |
|||
.B status |
|||
.br |
|||
Display status of NGINX, PHP5-FPM, MySQL, Postfix services. |
|||
.TP |
|||
.B start |
|||
.br |
|||
Start services NGINX, PHP5-FPM, MySQL, Postfix. |
|||
.TP |
|||
.B stop |
|||
.br |
|||
Stop services NGINX, PHP5-FPM, MySQL, Postfix. |
|||
.TP |
|||
.B reload |
|||
.br |
|||
Reload services NGINX, PHP5-FPM, MySQL, Postfix. |
|||
.TP |
|||
.B restart |
|||
.br |
|||
Restart services NGINX, PHP5-FPM, MySQL, Postfix. |
|||
.TP |
|||
.B site |
|||
.br |
|||
.TP |
|||
.B cd [ example.com ] |
|||
.br |
|||
Change directory to webroot of specified site in subshell. |
|||
.TP |
|||
.B log [ example.com ] |
|||
.br |
|||
monitor access and error logs for site specified. |
|||
.TP |
|||
.B list [ enable | available ] |
|||
.br |
|||
Lists all available sites from /etc/nginx/sites-enabled/ |
|||
.br |
|||
by default & enable argument. Display sites list from |
|||
.br |
|||
/etc/nginx/sites-available/ if used with available option. |
|||
|
|||
.TP |
|||
.B info [ example.com ] |
|||
.br |
|||
prints information about site such as access log, error log |
|||
.br |
|||
location and type of site. |
|||
.TP |
|||
.B show [ example.com ] |
|||
.br |
|||
Display NGINX configuration of site. |
|||
.TP |
|||
.B enable [ example.com ] |
|||
.br |
|||
Enable site by creating softlink with site file in |
|||
.br |
|||
/etc/nginx/sites-available to /etc/nginx/sites-enabled/. |
|||
.TP |
|||
.B disable [ example.com ] |
|||
.br |
|||
Disable site by Destroying softlink with site file in |
|||
.br |
|||
/etc/nginx/sites-available to /etc/nginx/sites-enabled/. |
|||
.TP |
|||
.B edit [ example.com ] |
|||
.br |
|||
Edit NGINX configuration of site. |
|||
.TP |
|||
.B create [ example.com ] [ --html | --php | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--basic | --wpsc | --w3tc | --wpfc]] |
|||
.br |
|||
Create new site according to given options. If no options provided |
|||
.br |
|||
create static site with html only. |
|||
.TP |
|||
.B update [ example.com ] [ --html | --php | --mysql] [[--wp | --wpsubdir | --wpsubdomain ] [--basic | --wpsc | --w3tc | --wpfc]] |
|||
.br |
|||
Update site configuration according to specified options. |
|||
.TP |
|||
.B delete [ example.com ] [--no-prompt ] [ --db | --files ] |
|||
.br |
|||
Delete site i.e webroot, database, ad configuration permenantly. |
|||
.TP |
|||
.B debug [ -i | --nginx | --php | --mysql | --rewrite | --fpm ] [ --start | --stop ] |
|||
.br |
|||
Starts server level debugging. If used without arguments starts debugging |
|||
.br |
|||
all services, else debug only service provided with argument. Stop |
|||
.br |
|||
Debugging if used with --stop argument. |
|||
.TP |
|||
.B debug example.com [ -i | --nginx | --rewrite | --wp ] [ --start | --stop ] |
|||
.br |
|||
Starts site level debugging. If used without arguments starts debugging all |
|||
.br |
|||
services, else debug only service provided with argument. Stop Debugging |
|||
.br |
|||
if used with --stop argument. |
|||
.TP |
|||
.B secure [ --auth | --port ] |
|||
.br |
|||
Update security settings. |
|||
.TP |
|||
.B clean [ fastcgi | opcache | memcache | all ] |
|||
.br |
|||
Clean NGINX fastCGI cache, Opcache, Memcache. |
|||
.br |
|||
Clean NGINX fastCGI cache if no option specified. |
|||
.SH ARGUMENTS |
|||
.TP |
|||
.B -i |
|||
.br |
|||
setup intractive mode while used with debug. |
|||
.TP |
|||
.B --nginx |
|||
.br |
|||
used with ee debug command. used to start or stop nginx debugging. |
|||
.TP |
|||
.B --php |
|||
.br |
|||
used with ee debug command. used to start or stop php debugging. |
|||
.TP |
|||
.B --mysql |
|||
.br |
|||
used with ee debug command. used to start or stop mysql debugging. |
|||
.TP |
|||
.B --rewrite |
|||
.br |
|||
used with ee debug command. used to start or stop nginx rewrite rules debugging. |
|||
.TP |
|||
.B --fpm |
|||
.br |
|||
used with ee debug command. used to start or stop fpm debugging. |
|||
.TP |
|||
.B --wp |
|||
.br |
|||
used with ee debug command. used to start or stop wordpress site debugging. |
|||
.TP |
|||
.B --start |
|||
.br |
|||
used with ee debug command. used to stop debugging. |
|||
.TP |
|||
.B --stop |
|||
.br |
|||
used with ee debug command. used to stop debugging. |
|||
.TP |
|||
.B --html |
|||
.br |
|||
Create a HTML website. |
|||
.TP |
|||
.B --php |
|||
.br |
|||
Create a PHP website. |
|||
.TP |
|||
.B --mysql |
|||
.br |
|||
Create a PHP+MySQL website. |
|||
.TP |
|||
.B --wp |
|||
.br |
|||
Create a WordPress Website. |
|||
.TP |
|||
.B --wpsubdir |
|||
.br |
|||
Create a Wordpress Multisite with Sub Directories Setup. |
|||
.TP |
|||
.B --wpsubdomain |
|||
.br |
|||
Create a Wordpress Multisite with Sub Domains Setup. |
|||
.br |
|||
.TP |
|||
.B --db |
|||
.br |
|||
Delete website database. |
|||
.br |
|||
.TP |
|||
.B --files |
|||
.br |
|||
Delete website webroot. |
|||
.br |
|||
.TP |
|||
.B --no-prompt |
|||
.br |
|||
Does not prompt for confirmation when delete command used. |
|||
.TP |
|||
.B --auth |
|||
.br |
|||
used with ee secure command. Update credential of HTTP authentication |
|||
.TP |
|||
.B --port |
|||
.br |
|||
used with ee secure command. Change EasyEngine admin port 22222. |
|||
.TP |
|||
.B --ip |
|||
.br |
|||
used with ee secure command. Update whitelist IP address |
|||
.SH WORDPRESS CACHING OPTIONS |
|||
.TP |
|||
.B --basic |
|||
.br |
|||
Create WordPress website without cache. |
|||
.TP |
|||
.B --w3tc |
|||
.br |
|||
Install and activate Nginx-helper and W3 Total Cache plugin. |
|||
.TP |
|||
.B --wpsc |
|||
.br |
|||
Install and activate Nginx-helper and WP Super Cache plugin. |
|||
.TP |
|||
.B --wpfc |
|||
.br |
|||
Install and activate Nginx-helper and W3 Total Cache plugin with |
|||
.br |
|||
Nginx FastCGI cache. |
|||
.SH FILES |
|||
.br |
|||
/etc/easyengine/ee.conf |
|||
.SH BUGS |
|||
Report bugs at <http://github.com/rtCamp/easyengine/issues/> |
|||
.SH AUTHOR |
|||
.br |
|||
.B rtCamp Team |
|||
.I \<admin@rtcamp.com\> |
|||
.br |
|||
.B Mitesh Shah |
|||
.I \<Mitesh.Shah@rtcamp.com\> |
|||
.br |
|||
.B Manish |
|||
.I \<Manish.Songirkar@rtcamp.com\> |
|||
.br |
|||
.B Gaurav |
|||
.I \<Gaurav.Astikar@rtcamp.com\> |
|||
.br |
|||
.B Harshad |
|||
.I \<harshad.yeola@rtcamp.com> |
|||
.SH "SEE ALSO" |
|||
.br |
|||
EE: |
|||
.I https://rtcamp.com/easyengine/ |
|||
.br |
|||
FAQ: |
|||
.I https://rtcamp.com/easyengine/faq/ |
|||
.br |
|||
DOCS: |
|||
.I https://rtcamp.com/easyengine/docs/ |
|||
|
@ -0,0 +1,11 @@ |
|||
EasyEngine |
|||
============================================================================== |
|||
|
|||
Installation |
|||
------------ |
|||
|
|||
``` |
|||
$ pip install -r requirements.txt |
|||
|
|||
$ python setup.py install |
|||
``` |
@ -0,0 +1,41 @@ |
|||
# EasyEngine Configuration |
|||
# |
|||
# All commented values are the application default |
|||
# |
|||
|
|||
[ee] |
|||
|
|||
### Toggle application level debug (does not toggle framework debugging) |
|||
# debug = false |
|||
|
|||
### Where external (third-party) plugins are loaded from |
|||
# plugin_dir = /var/lib/ee/plugins/ |
|||
|
|||
### Where all plugin configurations are loaded from |
|||
# plugin_config_dir = /etc/ee/plugins.d/ |
|||
|
|||
### Where external templates are loaded from |
|||
# template_dir = /var/lib/ee/templates/ |
|||
|
|||
|
|||
[log] |
|||
|
|||
### Where the log file lives (no log file by default) |
|||
# file = none |
|||
|
|||
### The level for which to log. One of: info, warn, error, fatal, debug |
|||
# level = info |
|||
|
|||
### Whether or not to log to console |
|||
# to_console = true |
|||
|
|||
### Whether or not to rotate the log file when it reaches `max_bytes` |
|||
# rotate = false |
|||
|
|||
### Max size in bytes that a log file can grow until it is rotated. |
|||
# max_bytes = 512000 |
|||
|
|||
### The maximun number of log files to maintain when rotating |
|||
# max_files = 4 |
|||
|
|||
|
@ -0,0 +1,11 @@ |
|||
### Example Plugin Configuration for EasyEngine |
|||
|
|||
[example] |
|||
|
|||
### If enabled, load a plugin named `example` either from the Python module |
|||
### `ee.cli.plugins.example` or from the file path |
|||
### `/var/lib/ee/plugins/example.py` |
|||
enable_plugin = true |
|||
|
|||
### Additional plugin configuration settings |
|||
foo = bar |
@ -0,0 +1 @@ |
|||
__import__('pkg_resources').declare_namespace(__name__) |
@ -0,0 +1,10 @@ |
|||
"""EasyEngine bootstrapping.""" |
|||
|
|||
# All built-in application controllers should be imported, and registered |
|||
# in this file in the same way as EEBaseController. |
|||
|
|||
from cement.core import handler |
|||
from ee.cli.controllers.base import EEBaseController |
|||
|
|||
def load(app): |
|||
handler.register(EEBaseController) |
@ -0,0 +1,28 @@ |
|||
"""EasyEngine base controller.""" |
|||
|
|||
from cement.core.controller import CementBaseController, expose |
|||
|
|||
class EEBaseController(CementBaseController): |
|||
class Meta: |
|||
label = 'base' |
|||
description = 'easyengine is the commandline tool to manage your websites based on wordpress and nginx with easy to use commands.' |
|||
arguments = [ |
|||
(['-f', '--foo'], |
|||
dict(help='the notorious foo option', dest='foo', action='store', |
|||
metavar='TEXT') ), |
|||
] |
|||
|
|||
@expose(hide=True) |
|||
def default(self): |
|||
print "Inside EEBaseController.default()." |
|||
|
|||
# If using an output handler such as 'mustache', you could also |
|||
# render a data dictionary using a template. For example: |
|||
# |
|||
# data = dict(foo='bar') |
|||
# self.app.render(data, 'default.mustache') |
|||
# |
|||
# |
|||
# The 'default.mustache' file would be loaded from |
|||
# ``ee.cli.templates``, or ``/var/lib/ee/templates/``. |
|||
# |
@ -0,0 +1,30 @@ |
|||
"""EasyEngine site controller.""" |
|||
|
|||
from cement.core.controller import CementBaseController, expose |
|||
|
|||
class EESiteController(CementBaseController): |
|||
class Meta: |
|||
label = 'site' |
|||
interface = controller.IController |
|||
stacked_on = 'base' |
|||
stacked_type = 'nested' |
|||
description = 'site command manges website configuration with the help of the following subcommands' |
|||
(['-f', '--foo'], |
|||
dict(help='the notorious foo option', dest='foo', action='store', |
|||
metavar='TEXT') ), |
|||
] |
|||
|
|||
@expose(hide=True) |
|||
def default(self): |
|||
print "Inside EESiteController.default()." |
|||
|
|||
# If using an output handler such as 'mustache', you could also |
|||
# render a data dictionary using a template. For example: |
|||
# |
|||
# data = dict(foo='bar') |
|||
# self.app.render(data, 'default.mustache') |
|||
# |
|||
# |
|||
# The 'default.mustache' file would be loaded from |
|||
# ``ee.cli.templates``, or ``/var/lib/ee/templates/``. |
|||
# |
@ -0,0 +1,87 @@ |
|||
"""EasyEngine main application entry point.""" |
|||
|
|||
from cement.core import foundation |
|||
from cement.utils.misc import init_defaults |
|||
from cement.core.exc import FrameworkError, CaughtSignal |
|||
from ee.core import exc |
|||
|
|||
# Application default. Should update config/ee.conf to reflect any |
|||
# changes, or additions here. |
|||
defaults = init_defaults('ee') |
|||
|
|||
# All internal/external plugin configurations are loaded from here |
|||
defaults['ee']['plugin_config_dir'] = '/etc/ee/plugins.d' |
|||
|
|||
# External plugins (generally, do not ship with application code) |
|||
defaults['ee']['plugin_dir'] = '/var/lib/ee/plugins' |
|||
|
|||
# External templates (generally, do not ship with application code) |
|||
defaults['ee']['template_dir'] = '/var/lib/ee/templates' |
|||
|
|||
|
|||
class EEApp(foundation.CementApp): |
|||
class Meta: |
|||
label = 'ee' |
|||
config_defaults = defaults |
|||
|
|||
# All built-in application bootstrapping (always run) |
|||
bootstrap = 'ee.cli.bootstrap' |
|||
|
|||
# Optional plugin bootstrapping (only run if plugin is enabled) |
|||
plugin_bootstrap = 'ee.cli.plugins' |
|||
|
|||
# Internal templates (ship with application code) |
|||
template_module = 'ee.cli.templates' |
|||
|
|||
# Internal plugins (ship with application code) |
|||
plugin_bootstrap = 'ee.cli.plugins' |
|||
|
|||
|
|||
class EETestApp(EEApp): |
|||
"""A test app that is better suited for testing.""" |
|||
class Meta: |
|||
argv = [] |
|||
config_files = [] |
|||
|
|||
|
|||
# Define the applicaiton object outside of main, as some libraries might wish |
|||
# to import it as a global (rather than passing it into another class/func) |
|||
app = EEApp() |
|||
|
|||
def main(): |
|||
try: |
|||
# Default our exit status to 0 (non-error) |
|||
code = 0 |
|||
|
|||
# Setup the application |
|||
app.setup() |
|||
|
|||
# Run the application |
|||
app.run() |
|||
except exc.EEError as e: |
|||
# Catch our application errors and exit 1 (error) |
|||
code = 1 |
|||
print(e) |
|||
except FrameworkError as e: |
|||
# Catch framework errors and exit 1 (error) |
|||
code = 1 |
|||
print(e) |
|||
except CaughtSignal as e: |
|||
# Default Cement signals are SIGINT and SIGTERM, exit 0 (non-error) |
|||
code = 0 |
|||
print(e) |
|||
finally: |
|||
# Print an exception (if it occurred) and --debug was passed |
|||
if app.debug: |
|||
import sys |
|||
import traceback |
|||
|
|||
exc_type, exc_value, exc_traceback = sys.exc_info() |
|||
if exc_traceback is not None: |
|||
traceback.print_exc() |
|||
|
|||
# Close the application |
|||
app.close(code) |
|||
|
|||
if __name__ == '__main__': |
|||
main() |
@ -0,0 +1,50 @@ |
|||
"""Example Plugin for EasyEngine.""" |
|||
|
|||
from cement.core.controller import CementBaseController, expose |
|||
from cement.core import handler, hook |
|||
|
|||
def example_plugin_hook(app): |
|||
# do something with the ``app`` object here. |
|||
pass |
|||
|
|||
class ExamplePluginController(CementBaseController): |
|||
class Meta: |
|||
# name that the controller is displayed at command line |
|||
label = 'example' |
|||
|
|||
# text displayed next to the label in ``--help`` output |
|||
description = 'this is an example plugin controller' |
|||
|
|||
# stack this controller on-top of ``base`` (or any other controller) |
|||
stacked_on = 'base' |
|||
|
|||
# determines whether the controller is nested, or embedded |
|||
stacked_type = 'nested' |
|||
|
|||
# these arguments are only going to display under |
|||
# ``$ ee example --help`` |
|||
arguments = [ |
|||
( |
|||
['-f', '--foo'], |
|||
dict( |
|||
help='Notorious foo option', |
|||
action='store', |
|||
) |
|||
) |
|||
] |
|||
|
|||
@expose(hide=True) |
|||
def default(self): |
|||
print("Inside ExamplePluginController.default()") |
|||
|
|||
@expose(help="this is an example sub-command.") |
|||
def example_plugin_command(self): |
|||
print("Inside ExamplePluginController.example_plugin_command()") |
|||
|
|||
|
|||
def load(app): |
|||
# register the plugin class.. this only happens if the plugin is enabled |
|||
handler.register(ExamplePluginController) |
|||
|
|||
# register a hook (function) to run after arguments are parsed. |
|||
hook.register('post_argument_parsing', example_plugin_hook) |
@ -0,0 +1,22 @@ |
|||
"""EasyEngine exception classes.""" |
|||
|
|||
class EEError(Exception): |
|||
"""Generic errors.""" |
|||
def __init__(self, msg): |
|||
Exception.__init__(self) |
|||
self.msg = msg |
|||
|
|||
def __str__(self): |
|||
return self.msg |
|||
|
|||
class EEConfigError(EEError): |
|||
"""Config related errors.""" |
|||
pass |
|||
|
|||
class EERuntimeError(EEError): |
|||
"""Generic runtime errors.""" |
|||
pass |
|||
|
|||
class EEArgumentError(EEError): |
|||
"""Argument related errors.""" |
|||
pass |
@ -0,0 +1,16 @@ |
|||
"""Testing utilities for EasyEngine.""" |
|||
|
|||
from ee.cli.main import EETestApp |
|||
from cement.utils.test import * |
|||
|
|||
class EETestCase(CementTestCase): |
|||
app_class = EETestApp |
|||
|
|||
def setUp(self): |
|||
"""Override setup actions (for every test).""" |
|||
super(EETestCase, self).setUp() |
|||
|
|||
def tearDown(self): |
|||
"""Override teardown actions (for every test).""" |
|||
super(EETestCase, self).tearDown() |
|||
|
@ -0,0 +1 @@ |
|||
cement>=2.4.0 |
@ -0,0 +1,9 @@ |
|||
[nosetests] |
|||
verbosity=3 |
|||
debug=0 |
|||
detailed-errors=1 |
|||
with-coverage=1 |
|||
cover-package=ee |
|||
cover-erase=1 |
|||
cover-html=1 |
|||
cover-html-dir=coverage_report/ |
@ -0,0 +1,34 @@ |
|||
|
|||
from setuptools import setup, find_packages |
|||
import sys, os |
|||
|
|||
setup(name='ee', |
|||
version='3.0', |
|||
description="EasyEngine is the commandline tool to manage your Websites based on WordPress and NGINX with easy to use commands.", |
|||
long_description="EasyEngine is the commandline tool to manage your Websites based on WordPress and NGINX with easy to use commands.", |
|||
classifiers=[], |
|||
keywords='', |
|||
author='rtCamp Soultions Pvt. LTD', |
|||
author_email='sys@rtcamp.com', |
|||
url='http://rtcamp.com/easyengine', |
|||
license='GPL', |
|||
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), |
|||
include_package_data=True, |
|||
zip_safe=False, |
|||
test_suite='nose.collector', |
|||
install_requires=[ |
|||
### Required to build documentation |
|||
# "Sphinx >= 1.0", |
|||
### Required for testing |
|||
# "nose", |
|||
# "coverage", |
|||
### Required to function |
|||
'cement', |
|||
], |
|||
setup_requires=[], |
|||
entry_points=""" |
|||
[console_scripts] |
|||
ee = ee.cli.main:main |
|||
""", |
|||
namespace_packages=[], |
|||
) |
@ -0,0 +1,8 @@ |
|||
"""Tests for Example Plugin.""" |
|||
|
|||
from ee.utils import test |
|||
|
|||
class ExamplePluginTestCase(test.EETestCase): |
|||
def test_load_example_plugin(self): |
|||
self.app.setup() |
|||
self.app.plugin.load_plugin('example') |
@ -0,0 +1,9 @@ |
|||
"""CLI tests for ee.""" |
|||
|
|||
from ee.utils import test |
|||
|
|||
class CliTestCase(test.EETestCase): |
|||
def test_ee_cli(self): |
|||
self.app.setup() |
|||
self.app.run() |
|||
self.app.close() |
@ -1,12 +0,0 @@ |
|||
|
|||
1. **lib** - EasyEngine (ee) libraries |
|||
|
|||
Actual Linux path: `/usr/local/lib/easyengine/lib/` |
|||
|
|||
1. **modules** - EasyEngine (ee) modules |
|||
|
|||
Actual Linux path: `/usr/local/lib/easyengine/modules/` |
|||
|
|||
1. **vendor** - EasyEngine (ee) 3rd party packages |
|||
|
|||
Actual Linux path: `/usr/local/lib/easyengine/vendor/` |
@ -1,11 +0,0 @@ |
|||
1. **ee_lib_apt_get_update.sh** - Execute apt-get update |
|||
1. **ee_lib_dotdeb.sh** - Fetch and install Dotdeb.org GnuPG key |
|||
1. **ee_lib_echo.sh**- Define echo function |
|||
1. **ee_lib_error.sh** - Capture errors |
|||
1. **ee_lib_git_commit.sh** - Record changes to the repository |
|||
1. **ee_lib_git_init.sh** - Initialize Git |
|||
1. **ee_lib_gpg_key_fix.sh** - Fix GnuPG key |
|||
1. **ee_lib_http_auth.sh** - Setup HTTP authentication |
|||
1. **ee_lib_package_check.sh** - Check the specified package is installed or not |
|||
1. **ee_lib_service.sh** - Services Start/Stop/Restart/Reload |
|||
1. **ee_lib_variables.sh** - Define global variables |
@ -1,7 +0,0 @@ |
|||
# Execute: apt-get update |
|||
|
|||
function ee_lib_apt_get_update() |
|||
{ |
|||
ee_lib_echo "Executing apt-get update, please wait..." |
|||
apt-get update &>> $EE_COMMAND_LOG || ee_lib_error "Unable to execute apt-get update, exit status = " $? |
|||
} |
@ -1,7 +0,0 @@ |
|||
# Execute: apt-get autoremove |
|||
|
|||
function ee_lib_autoremove() |
|||
{ |
|||
ee_lib_echo "Removing unwanted packages, please wait..." |
|||
$EE_APT_GET autoremove |
|||
} |
@ -1,16 +0,0 @@ |
|||
# Check domain name |
|||
|
|||
function ee_lib_check_domain() |
|||
{ |
|||
# Check if domain name is empty or not |
|||
while [ -z $EE_DOMAIN_CHECK ]; do |
|||
# Ask user to enter domain name |
|||
read -p "Enter domain name: " EE_DOMAIN_CHECK |
|||
done |
|||
|
|||
# Remove http:// https:// & www. |
|||
EE_DOMAIN=$(echo $EE_DOMAIN_CHECK | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'/''" | sed "s'www.''" ) |
|||
|
|||
# Remove http:// https:// For WordPress Setup (www.example.com) |
|||
EE_WWW_DOMAIN=$(echo $EE_DOMAIN_CHECK | tr 'A-Z' 'a-z' | sed "s'http://''" | sed "s'https://''" | sed "s'/''") |
|||
} |
@ -1,27 +0,0 @@ |
|||
# Check Server hostname is FQDN or not |
|||
|
|||
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_COMMAND_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_COMMAND_LOG |
|||
else |
|||
service hostname restart &>> $EE_COMMAND_LOG |
|||
fi |
|||
echo "hostname = $(hostname -f)" &>> $EE_COMMAND_LOG |
|||
fi |
|||
;; |
|||
*) |
|||
read -p "Enter hostname [FQDN]: " EE_FQDN |
|||
ee_lib_check_fqdn $EE_FQDN |
|||
;; |
|||
esac |
|||
} |
@ -1,10 +0,0 @@ |
|||
# Fetch and install Dotdeb.org GnuPG key |
|||
|
|||
function ee_lib_dotdeb() |
|||
{ |
|||
wget --no-check-certificate -cO /tmp/dotdeb.gpg http://www.dotdeb.org/dotdeb.gpg \ |
|||
&>> $EE_COMMAND_LOG || ee_lib_error "Unable to download Dotdeb.org GnuPG key, exit status = " $? |
|||
|
|||
apt-key add /tmp/dotdeb.gpg &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to add Dotdeb.org GnuPG key, exit status = " $? |
|||
} |
@ -1,25 +0,0 @@ |
|||
# Define echo function |
|||
|
|||
# Blue color |
|||
function ee_lib_echo() |
|||
{ |
|||
echo $(tput setaf 4)$@$(tput sgr0) |
|||
} |
|||
|
|||
# White color |
|||
function ee_lib_echo_info() |
|||
{ |
|||
echo $(tput setaf 7)$@$(tput sgr0) |
|||
} |
|||
|
|||
# Red color |
|||
function ee_lib_echo_fail() |
|||
{ |
|||
echo $(tput setaf 1)$@$(tput sgr0) |
|||
} |
|||
|
|||
# Execute: echo -e |
|||
function ee_lib_echo_escape() |
|||
{ |
|||
echo -e $(tput sgr0)$@$(tput sgr0) |
|||
} |
@ -1,7 +0,0 @@ |
|||
# Capture errors |
|||
|
|||
function ee_lib_error() |
|||
{ |
|||
echo -e "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG |
|||
exit $2 |
|||
} |
@ -1,26 +0,0 @@ |
|||
# Initialize Git |
|||
|
|||
function ee_lib_git() |
|||
{ |
|||
for ee_git_dir in ${@:1:$(($#-1))}; do |
|||
if [ -d $ee_git_dir ]; then |
|||
# Change directory |
|||
cd $ee_git_dir |
|||
|
|||
# Check .git |
|||
if [ ! -d .git ]; then |
|||
# ee_lib_echo "Initialize Git on ${ee_git_dir}" |
|||
git init &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $? |
|||
fi |
|||
|
|||
# Check for untracked files |
|||
if [ $(git status -s | wc -l) -ne 0 ]; then |
|||
# Add files in Git version control |
|||
ee_lib_echo "Git commit on $ee_git_dir, please wait..." |
|||
git add --all && git commit -am "${@: -1}" &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $? |
|||
fi |
|||
fi |
|||
done |
|||
} |
@ -1,24 +0,0 @@ |
|||
# Fix GnuPG key |
|||
|
|||
function ee_lib_gpg_key_fix() |
|||
{ |
|||
local ee_gpg_key_check |
|||
|
|||
# GnuPG key check |
|||
$EE_CONFIG_GET stack.gpg-key-fix | grep -i true &>> $EE_COMMAND_LOG |
|||
|
|||
if [ $? -eq 0 ];then |
|||
|
|||
# Fix GnuPG key problems |
|||
apt-get update > /dev/null 2> /tmp/gpg_key |
|||
|
|||
for ee_gpg_key_check in $(grep "NO_PUBKEY" /tmp/gpg_key |sed "s/.*NO_PUBKEY //") |
|||
do |
|||
ee_lib_echo "Processing GnuPG key: $ee_gpg_key_check" |
|||
gpg --keyserver subkeys.pgp.net --recv $ee_gpg_key_check &>> $EE_COMMAND_LOG \ |
|||
&& gpg --export --armor $ee_gpg_key_check \ |
|||
| apt-key add - &>> $EE_COMMAND_LOG |
|||
done |
|||
|
|||
fi |
|||
} |
@ -1,26 +0,0 @@ |
|||
# Import MySQL slow log to Anememoter |
|||
|
|||
function ee_lib_import_slow_log() |
|||
{ |
|||
|
|||
if [ -d /var/www/22222/htdocs/db/anemometer ]; then |
|||
if [ -f /var/log/mysql/mysql-slow.log ]; then |
|||
ee_lib_echo "Importing MySQL slow log, please wait..." |
|||
dpkg --compare-versions $(pt-query-digest --version | awk '{print $2 }') ge 2.2 |
|||
if [ $? -eq 0 ]; then |
|||
ee_anemometer_history=history |
|||
else |
|||
ee_anemometer_history=review-history |
|||
fi |
|||
|
|||
pt-query-digest --user=anemometer --password=anemometer_password \ |
|||
--review D=slow_query_log,t=global_query_review \ |
|||
--${ee_anemometer_history} D=slow_query_log,t=global_query_review_history \ |
|||
--no-report --limit=0% --filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"anemometer-mysql\"" /var/log/mysql/mysql-slow.log |
|||
else |
|||
ee_lib_echo_fail "Failed to find MySQL slow log file, enable MySQL slow log" |
|||
fi |
|||
else |
|||
ee_lib_echo_fail "Anemometer is not installed" |
|||
fi |
|||
} |
@ -1,27 +0,0 @@ |
|||
# MySQL information |
|||
|
|||
function ee_lib_mysql_info() |
|||
{ |
|||
mysqladmin ping &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
local ee_mysql_version=$(mysql -V | awk '{print($5)}' | cut -d ',' -f1) |
|||
local ee_mysql_port=$(mysql -e "show variables" | grep ^port | awk '{print($2)}') |
|||
local ee_mysql_socket=$(mysql -e "show variables" | grep "^socket" | awk '{print($2)}') |
|||
local ee_mysql_data_dir=$(mysql -e "show variables" | grep datadir | awk '{print($2)}') |
|||
local ee_mysql_wait_timeout=$(mysql -e "show variables" | grep ^wait_timeout | awk '{print($2)}') |
|||
local ee_mysql_interactive_timeout=$(mysql -e "show variables" | grep ^interactive_timeout | awk '{print($2)}') |
|||
local ee_mysql_max_connections=$(mysql -e "show variables" | grep "^max_connections" | awk '{print($2)}') |
|||
local ee_mysql_max_used_connections=$(mysql -e "show global status" | grep Max_used_connections | awk '{print($2)}') |
|||
|
|||
ee_lib_echo |
|||
ee_lib_echo "MySQL ($ee_mysql_version) on $EE_MYSQL_HOST:" |
|||
ee_lib_echo_escape "port\t\t\t\t \033[37m$ee_mysql_port" |
|||
ee_lib_echo_escape "wait_timeout\t\t\t \033[37m$ee_mysql_wait_timeout" |
|||
ee_lib_echo_escape "interactive_timeout\t\t \033[37m$ee_mysql_interactive_timeout" |
|||
ee_lib_echo_escape "max_used_connections\t\t \033[37m$ee_mysql_max_used_connections/$ee_mysql_max_connections" |
|||
ee_lib_echo_escape "datadir\t\t\t\t \033[37m$ee_mysql_data_dir" |
|||
ee_lib_echo_escape "socket\t\t\t\t \033[37m$ee_mysql_socket" |
|||
else |
|||
ee_lib_echo "MYSQL not installed" |
|||
fi |
|||
} |
@ -1,29 +0,0 @@ |
|||
# NGINX information |
|||
|
|||
function ee_lib_nginx_info() |
|||
{ |
|||
ee_lib_package_check $EE_NGINX_PACKAGE |
|||
if [ "$EE_PACKAGE_NAME" = "" ]; then |
|||
local ee_nginx_version=$(nginx -v 2>&1 | cut -d':' -f2 | cut -d' ' -f2 | cut -d'/' -f2) |
|||
local ee_nginx_user=$(grep ^user /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) |
|||
local ee_nginx_processes=$(grep worker_processes /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) |
|||
local ee_nginx_connections=$(grep worker_connections /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) |
|||
local ee_nginx_keep_alive=$(grep keepalive_timeout /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) |
|||
local ee_fastcgi_timeout=$(grep fastcgi_read_timeout /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) |
|||
local ee_clinet_max_body_size=$(grep client_max_body_size /etc/nginx/nginx.conf | cut -d' ' -f2 | cut -d';' -f1) |
|||
local ee_nginx_allowed_ip_add=$(grep ^allow /etc/nginx/common/acl.conf | cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' ') |
|||
|
|||
ee_lib_echo |
|||
ee_lib_echo |
|||
ee_lib_echo "NGINX ($ee_nginx_version):" |
|||
ee_lib_echo_escape "user\t\t\t\t \033[37m$ee_nginx_user" |
|||
ee_lib_echo_escape "worker_processes\t\t \033[37m$ee_nginx_processes" |
|||
ee_lib_echo_escape "worker_connections\t\t \033[37m$ee_nginx_connections" |
|||
ee_lib_echo_escape "keepalive_timeout\t\t \033[37m$ee_nginx_keep_alive" |
|||
ee_lib_echo_escape "fastcgi_read_timeout\t\t \033[37m$ee_fastcgi_timeout" |
|||
ee_lib_echo_escape "client_max_body_size\t\t \033[37m$ee_clinet_max_body_size" |
|||
ee_lib_echo_escape "allow\t\t\t\t \033[37m$ee_nginx_allowed_ip_add" |
|||
else |
|||
ee_lib_echo "NGINX not installed" |
|||
fi |
|||
} |
@ -1,20 +0,0 @@ |
|||
# Check the specified package is installed or not |
|||
|
|||
function ee_lib_package_check() |
|||
{ |
|||
# If nginx is not installed and php is installed |
|||
# ee site create example.com --wp is tries to installl php as $EE_PACKAGE_NAME=nginx-custom |
|||
EE_PACKAGE_NAME="" |
|||
|
|||
local ee_package |
|||
|
|||
for ee_package in $@;do |
|||
dpkg --get-selections | grep -v deinstall | grep $ee_package &>> $EE_COMMAND_LOG |
|||
|
|||
# Generate a list of not installed package |
|||
if [ $? -ne 0 ]; then |
|||
EE_PACKAGE_NAME="$EE_PACKAGE_NAME $ee_package" |
|||
fi |
|||
|
|||
done |
|||
} |
@ -1,8 +0,0 @@ |
|||
# Adjust permission |
|||
|
|||
function ee_lib_permissions() |
|||
{ |
|||
ee_lib_echo "Changing ownership of /var/www/$EE_DOMAIN, please wait..." |
|||
chown -R $EE_PHP_USER:$EE_PHP_USER /var/www/$EE_DOMAIN/ \ |
|||
|| ee_lib_error "Unable to change ownership for $EE_DOMAIN, exit status = " $? |
|||
} |
@ -1,56 +0,0 @@ |
|||
# PHP information |
|||
function ee_lib_php_info() |
|||
{ |
|||
ee_lib_package_check php5-fpm |
|||
if [ "$EE_PACKAGE_NAME" = "" ]; then |
|||
#Collect information from php.ini |
|||
local ee_php_version=$(php -v | head -n1 | cut -d' ' -f2 | cut -d'+' -f1) |
|||
local ee_php_memory=$(grep ^memory_limit /etc/php5/fpm/php.ini | awk '{print $3}') |
|||
local ee_php_expose=$(grep ^expose_php /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) |
|||
local ee_php_post_max_size=$(grep post_max_size /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) |
|||
local ee_php_upload_max_filesize=$(grep upload_max_filesize /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) |
|||
local ee_php_max_execution_time=$(grep max_execution_time /etc/php5/fpm/php.ini | cut -d'=' -f2 | cut -d' ' -f2) |
|||
|
|||
|
|||
ee_lib_echo |
|||
ee_lib_echo "PHP ($ee_php_version):" |
|||
ee_lib_echo_escape "user\t\t\t\t \033[37m$EE_PHP_USER" |
|||
ee_lib_echo_escape "expose_php\t\t\t \033[37m$ee_php_expose" |
|||
ee_lib_echo_escape "memory_limit\t\t\t \033[37m$ee_php_memory" |
|||
ee_lib_echo_escape "post_max_size\t\t\t \033[37m$ee_php_post_max_size" |
|||
ee_lib_echo_escape "upload_max_filesize\t\t \033[37m$ee_php_upload_max_filesize" |
|||
ee_lib_echo_escape "max_execution_time\t\t \033[37m$ee_php_max_execution_time" |
|||
|
|||
|
|||
#Collect information from $ee_php_pool and debug.conf |
|||
for ee_php_pool in www.conf debug.conf;do |
|||
local ee_php_ping_path=$(grep ^ping.path /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
local ee_php_status_path=$(grep ^pm.status_path /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
local ee_php_process_manager=$(grep "^pm =" /etc/php5/fpm/pool.d/$ee_php_pool | awk '{print $3}') |
|||
local ee_php_max_requests=$(grep ^pm.max_requests /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
local ee_php_max_children=$(grep ^pm.max_children /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
local ee_php_start_servers=$(grep ^pm.start_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
local ee_php_min_spare_servers=$(grep ^pm.min_spare_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
local ee_php_max_spare_servers=$(grep ^pm.max_spare_servers /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
local ee_php_request_terminate_timeout=$(grep ^request_terminate_timeout /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
local ee_xdebug_check=$( grep "php_admin_flag\[xdebug.profiler_enable_trigger\]" /etc/php5/fpm/pool.d/$ee_php_pool | grep on &> /dev/null && echo on || echo off) |
|||
local ee_php_listen=$(grep '^listen =' /etc/php5/fpm/pool.d/$ee_php_pool | cut -d'=' -f2| cut -d' ' -f2) |
|||
|
|||
ee_lib_echo |
|||
ee_lib_echo "Information about $ee_php_pool" |
|||
ee_lib_echo_escape "ping.path\t\t\t \033[37m$ee_php_ping_path" |
|||
ee_lib_echo_escape "pm.status_path\t\t\t \033[37m$ee_php_status_path" |
|||
ee_lib_echo_escape "process_manager\t\t\t \033[37m$ee_php_process_manager" |
|||
ee_lib_echo_escape "pm.max_requests\t\t\t \033[37m$ee_php_max_requests" |
|||
ee_lib_echo_escape "pm.max_children\t\t\t \033[37m$ee_php_max_children" |
|||
ee_lib_echo_escape "pm.start_servers\t\t \033[37m$ee_php_start_servers" |
|||
ee_lib_echo_escape "pm.min_spare_servers\t\t \033[37m$ee_php_min_spare_servers" |
|||
ee_lib_echo_escape "pm.max_spare_servers\t\t \033[37m$ee_php_max_spare_servers" |
|||
ee_lib_echo_escape "request_terminate_timeout\t \033[37m$ee_php_request_terminate_timeout" |
|||
ee_lib_echo_escape "xdebug.profiler_enable_trigger\t \033[37m$ee_xdebug_check" |
|||
ee_lib_echo_escape "listen\t\t\t\t \033[37m$ee_php_listen" |
|||
done |
|||
else |
|||
ee_lib_echo "PHP not installed" |
|||
fi |
|||
} |
@ -1,48 +0,0 @@ |
|||
# EasyEngine RAM based settings |
|||
|
|||
function ee_lib_ram() |
|||
{ |
|||
# Detect RAM and SWAP of System |
|||
readonly EE_TOTAL_RAM=$(free -m | grep -i Mem | awk '{ print $2 }') |
|||
readonly EE_TOTAL_SWAP=$(free -m | grep -i Swap | 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" |
|||
EE_SWAP="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" |
|||
EE_SWAP="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 > 2048MB and RAM < 4096MB |
|||
elif [ $EE_TOTAL_RAM -gt 2048 ] && [ $EE_TOTAL_RAM -le 4096 ]; then |
|||
EE_OPCACHE_SIZE="512" |
|||
EE_MEMCACHE_SIZE="512" |
|||
EE_PHP_MAX_CHILDREN="40" |
|||
# RAM > 4096MB and RAM < 8192MB |
|||
elif [ $EE_TOTAL_RAM -gt 4096 ] && [ $EE_TOTAL_RAM -le 8192 ]; then |
|||
EE_OPCACHE_SIZE="512" |
|||
EE_MEMCACHE_SIZE="1024" |
|||
EE_PHP_MAX_CHILDREN="80" |
|||
# RAM > 8192MB and RAM < 16384MB |
|||
elif [ $EE_TOTAL_RAM -gt 8192 ] && [ $EE_TOTAL_RAM -le 16384 ]; then |
|||
EE_OPCACHE_SIZE="512" |
|||
EE_MEMCACHE_SIZE="2048" |
|||
EE_PHP_MAX_CHILDREN="100" |
|||
# RAM > 16384MB |
|||
elif [ $EE_TOTAL_RAM -gt 16384 ]; then |
|||
EE_OPCACHE_SIZE="512" |
|||
EE_MEMCACHE_SIZE="2048" |
|||
EE_PHP_MAX_CHILDREN="100" |
|||
fi |
|||
} |
@ -1,44 +0,0 @@ |
|||
# Services Start/Stop/Restart/Reload |
|||
# ee_lib_service nginx start |
|||
# ee_lib_service nginx stop |
|||
# ee_lib_service nginx restart |
|||
# ee_lib_service nginx php5-fpm mysql postfix restart |
|||
|
|||
function ee_lib_service() |
|||
{ |
|||
for ee_service_name in ${@:1:$(($#-1))}; do |
|||
if [ -f /etc/init.d/$ee_service_name ];then |
|||
# Display message |
|||
ee_lib_echo "Executing service $ee_service_name ${@: -1}, please wait..." |
|||
|
|||
# Check nginx and php5-fpm test before start/stop/restart/reload |
|||
if [ $ee_service_name = "nginx" ]; then |
|||
# Adjust nginx server_names_hash_bucket_size |
|||
$ee_service_name -t 2>&1 | grep server_names_hash_bucket_size &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ];then |
|||
EE_NGINX_CALCULATION=$(echo "l($(ls /etc/nginx/sites-enabled/ | wc -c))/l(2)+2" | bc -l) |
|||
EE_NGINX_SET_BUCKET=$(echo "2^$EE_NGINX_CALCULATION" | bc -l 2> /dev/null) |
|||
sed -i "s/.*server_names_hash_bucket_size.*/\tserver_names_hash_bucket_size $EE_NGINX_SET_BUCKET;/" /etc/nginx/nginx.conf |
|||
fi |
|||
# Test and start/stop/restart/reload nginx service |
|||
$ee_service_name -t &>> $EE_COMMAND_LOG \ |
|||
&& service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? |
|||
elif [ $ee_service_name = "php5-fpm" ]; then |
|||
# Test and start/stop/restart/reload php5-fpm service |
|||
$ee_service_name -t &>> $EE_COMMAND_LOG \ |
|||
&& service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG\ |
|||
|| ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? |
|||
elif [ $ee_service_name = "dovecot" ]; then |
|||
# Test and start/stop/restart/reload Dovecot service |
|||
$ee_service_name -n &>> $EE_COMMAND_LOG \ |
|||
&& service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG\ |
|||
|| ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? |
|||
else |
|||
# start/stop/restart/reload services |
|||
service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? |
|||
fi |
|||
fi |
|||
done |
|||
} |
@ -1,54 +0,0 @@ |
|||
# Check & Install Packages |
|||
|
|||
function ee_lib_stack_packages() |
|||
{ |
|||
local ee_stack_package |
|||
# Log only single time |
|||
# ee site create example.com called ee stack install nginx |
|||
# So when ee stack install nginx run in sub-shell the value of EE_TEE_LOG=/dev/null |
|||
# So in log file all logs written single time only, to do so set EE_LOG=false |
|||
export EE_LOG=false |
|||
|
|||
for ee_stack_package in $@;do |
|||
# Check NGINX installed & install if not |
|||
if [ "$ee_stack_package" = "nginx" ]; then |
|||
ee_lib_package_check $EE_NGINX_PACKAGE |
|||
if [ "$EE_PACKAGE_NAME" != "" ]; then |
|||
# Export EE_DISPLAY variable to Display ee http auth after site creation. |
|||
export EE_DISPLAY=false |
|||
|
|||
# The following command creates its own sub-shell |
|||
# and our ee_lib_error function only exit from that sub-shell |
|||
# so we need to exit from parent shell also |
|||
ee stack install nginx || exit $? |
|||
fi |
|||
# Check PHP installed & install if not |
|||
elif [ "$ee_stack_package" = "php" ]; then |
|||
ee_lib_package_check php5-fpm |
|||
if [ "$EE_PACKAGE_NAME" != "" ]; then |
|||
# The following command creates its own sub-shell |
|||
# and our ee_lib_error function only exit from that sub-shell |
|||
# so we need to exit from parent shell also |
|||
ee stack install php || exit $? |
|||
fi |
|||
# Check MySQL installed & install if not |
|||
elif [ "$ee_stack_package" = "mysql" ]; then |
|||
mysqladmin ping &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
# The following command creates its own sub-shell |
|||
# and our ee_lib_error function only exit from that sub-shell |
|||
# so we need to exit from parent shell also |
|||
ee stack install mysql || exit $? |
|||
fi |
|||
# Check Postfix installed & install if not |
|||
elif [ "$ee_stack_package" = "postfix" ]; then |
|||
ee_lib_package_check postfix |
|||
if [ "$EE_PACKAGE_NAME" != "" ]; then |
|||
# The following command creates its own sub-shell |
|||
# and our ee_lib_error function only exit from that sub-shell |
|||
# so we need to exit from parent shell also |
|||
ee stack install postfix || exit $? |
|||
fi |
|||
fi |
|||
done |
|||
} |
@ -1,34 +0,0 @@ |
|||
# EasyEngine Swap creation |
|||
|
|||
function ee_lib_swap() |
|||
{ |
|||
if [ $EE_TOTAL_RAM -le 512 ]; then |
|||
if [ $EE_TOTAL_SWAP -le $EE_SWAP ];then |
|||
|
|||
# Use dd command to create SWAP |
|||
# Swap Parameters: |
|||
# Location: /ee-swapfile |
|||
# Block Size: 1024 |
|||
ee_lib_echo "Adding 1GB swapfile, please wait..." |
|||
dd if=/dev/zero of=/ee-swapfile bs=1024 count=1048k &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to generate /ee-swapfile, exit status = " $? |
|||
|
|||
# Create it as a Swap |
|||
mkswap /ee-swapfile &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to create swapfile, exit status = " $? |
|||
|
|||
# Change Permission for swapfile |
|||
chown root:root /ee-swapfile && |
|||
chmod 0600 /ee-swapfile \ |
|||
|| ee_lib_error "Unable to change Swapfile permission, exit status = " $? |
|||
|
|||
# On the Swap |
|||
swapon /ee-swapfile &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to on Swap, exit status = " $? |
|||
|
|||
# Add entry into /etc/fstab |
|||
echo "/ee-swapfile none swap sw 0 0" >> /etc/fstab \ |
|||
|| ee_lib_error "Unable to add entry into /etc/fstab, exit status = " $? |
|||
fi |
|||
fi |
|||
} |
@ -1,8 +0,0 @@ |
|||
# Create symbolic link |
|||
|
|||
function ee_lib_symbolic_link() |
|||
{ |
|||
# Creating symbolic link |
|||
ln -sf $1 $2 \ |
|||
|| ee_lib_error "Unable to create symbolic link for $1 -> $2, exit status = " $? |
|||
} |
@ -1,72 +0,0 @@ |
|||
# Define global variables |
|||
|
|||
# EasyEngine version |
|||
readonly EE_VERSION='2.2.1' |
|||
|
|||
# WP-CLI version |
|||
readonly EE_WP_CLI_VERSION='0.17.1' |
|||
|
|||
# Adminer version |
|||
readonly EE_ADMINER_VERSION='4.1.0' |
|||
|
|||
# Roundcube Version |
|||
readonly EE_ROUNDCUBE_VERSION='1.0.3' |
|||
|
|||
# ViMbAdmin Version |
|||
readonly EE_VIMBADMIN_VERSION='3.0.10' |
|||
|
|||
# EasyEngine Date variable for backup |
|||
readonly EE_DATE=$(date +%d%b%Y%H%M%S) |
|||
|
|||
# Log only single time |
|||
# ee site create example.com called ee stack install nginx |
|||
# So when ee stack install nginx run in sub-shell the value of EE_TEE_LOG=/dev/null |
|||
# So in log file all logs written single time only |
|||
if [ -n "$EE_LOG" ]; then |
|||
EE_TEE_LOG=/dev/null |
|||
else |
|||
EE_TEE_LOG=/var/log/easyengine/ee.log |
|||
fi |
|||
|
|||
EE_COMMAND_LOG=/var/log/easyengine/ee.log |
|||
readonly EE_LOG_DIR=/var/log/easyengine |
|||
readonly EE_ERROR_LOG=/var/log/easyengine/error.log |
|||
readonly EE_LINUX_DISTRO=$(lsb_release -i |awk '{print $3}') |
|||
readonly EE_CONFIG_GET=$(echo "git config --file /etc/easyengine/ee.conf") |
|||
readonly EE_CONFIG_SET=$(echo "git config --file /etc/easyengine/ee.conf" --replace-all) |
|||
readonly EE_APT_GET=$($EE_CONFIG_GET stack.apt-get-assume-yes | grep -i true &> /dev/null && echo apt-get -y || echo apt-get) |
|||
EE_IP_ADDRESS=$($EE_CONFIG_GET stack.ip-address | cut -d'=' -f2 | sed 's/ //g' | tr ',' '\n') |
|||
|
|||
# Distribution specific variable |
|||
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then |
|||
#Specify nginx package |
|||
readonly EE_NGINX_PACKAGE=nginx-custom |
|||
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then |
|||
# Specify nginx package |
|||
readonly EE_NGINX_PACKAGE=nginx-full |
|||
# Detect Debian version |
|||
readonly EE_DEBIAN_VERSION=$(lsb_release -sc) |
|||
fi |
|||
|
|||
# Find php user-name |
|||
if [ -f /etc/php5/fpm/pool.d/www.conf ]; then |
|||
readonly EE_PHP_USER=$(grep ^user /etc/php5/fpm/pool.d/www.conf | cut -d'=' -f2 | cut -d' ' -f2) |
|||
else |
|||
# At installation time: ee stack install |
|||
# File /etc/php5/fpm/pool.d/www.conf not present |
|||
readonly EE_PHP_USER=www-data |
|||
fi |
|||
|
|||
# Find out MySQL hostname |
|||
if [ -z $(git config --file $HOME/.my.cnf client.host) ]; then |
|||
readonly EE_MYSQL_HOST=localhost |
|||
else |
|||
readonly EE_MYSQL_HOST=$(git config --file $HOME/.my.cnf client.host) |
|||
fi |
|||
|
|||
# Find out MySQL client-host to setup grants |
|||
if [ -z $($EE_CONFIG_GET mysql.grant-host) ]; then |
|||
readonly EE_MYSQL_GRANT_HOST=localhost |
|||
else |
|||
readonly EE_MYSQL_GRANT_HOST=$($EE_CONFIG_GET mysql.grant-host) |
|||
fi |
@ -1,3 +0,0 @@ |
|||
1. **stack** - includes install and remove scripts for EasyEngine [ee] modules. (ee stack install/remove). |
|||
1. **site** - includes scripts for site create commands. |
|||
1. **debug** - includes scripts for debug commands. |
@ -1,6 +0,0 @@ |
|||
- ee_mod_debug_fpm.sh - debug PHP5-FPM |
|||
- ee_mod_debug_mysql.sh - debug mysql |
|||
- ee_mod_debug_nginx.sh - debug NGINX |
|||
- ee_mod_debug_php.sh - debug PHP |
|||
- ee_mod_debug_rewrite.sh - debug NGINX rewrite |
|||
- ee_mod_debug_wp.sh - debug WordPress |
@ -1,35 +0,0 @@ |
|||
# PHP5-FPM debug |
|||
|
|||
function ee_mod_debug_fpm() |
|||
{ |
|||
if [ "$EE_DEBUG" = "--start" ]; then |
|||
grep "log_level = debug" /etc/php5/fpm/php-fpm.conf &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_echo "Setup PHP5-FPM log_level = debug, please wait..." |
|||
sed -i "s';log_level.*'log_level = debug'" /etc/php5/fpm/php-fpm.conf \ |
|||
|| ee_lib_error "Unable to setup PHP5-FPM log_level = debug, exit status = " $? |
|||
|
|||
# PHP5-FPM reload trigger |
|||
EE_TRIGGER_PHP="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "PHP5-FPM log_level = debug already setup" |
|||
fi |
|||
|
|||
# Debug message |
|||
EE_DEBUG_MSG="$EE_DEBUG_MSG /var/log/php5/fpm.log" |
|||
elif [ "$EE_DEBUG" = "--stop" ]; then |
|||
grep "log_level = debug" /etc/php5/fpm/php-fpm.conf &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Disable PHP5-FPM log_level = debug, please wait..." |
|||
sed -i "s'log_level.*'log_level = notice'" /etc/php5/fpm/php-fpm.conf \ |
|||
|| ee_lib_error "Unable to setup PHP5-FPM log_level = debug, exit status = " $? |
|||
|
|||
# PHP5-FPM reload trigger |
|||
EE_TRIGGER_PHP="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "PHP5-FPM log_level = debug already disabled" |
|||
fi |
|||
fi |
|||
} |
@ -1,59 +0,0 @@ |
|||
# MySQL debug |
|||
|
|||
function ee_mod_debug_mysql() |
|||
{ |
|||
if [ "$EE_DEBUG" = "--start" ]; then |
|||
mysql -e "show variables like 'slow_query_log';" | grep ON &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_echo "Setup MySQL slow log, please wait..." |
|||
|
|||
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/mysql-slow.log';" \ |
|||
|| ee_lib_error "Unable to setup slow_query_log_file, exit status = " $? |
|||
|
|||
mysql -e "set global long_query_time = 2;" \ |
|||
|| ee_lib_error "Unable to setup long_query_time, exit status = " $? |
|||
|
|||
mysql -e "set global log_queries_not_using_indexes = 'ON';" \ |
|||
|| ee_lib_error "Unable to setup log_queries_not_using_indexes, exit status = " $? |
|||
|
|||
# Set a cron for slow query log |
|||
if [ ! -z $EE_DEBUG_IMPORT_SLOW_LOG ]; then |
|||
ee_cron_time=${EE_DEBUG_IMPORT_SLOW_LOG##*=} |
|||
[[ $ee_cron_time =~ ^-?[0-9]+$ ]] || ee_cron_time=5 |
|||
crontab -l 2> /dev/null | { cat; echo -e "#EasyEngine start MySQL slow log\n*/$ee_cron_time * * * * /usr/local/sbin/ee import-slow-log\n#EasyEngine end MySQL slow log"; } | crontab - |
|||
fi |
|||
|
|||
else |
|||
# Display message |
|||
ee_lib_echo "MySQL slow log already enabled" |
|||
fi |
|||
|
|||
# Debug message |
|||
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 |
|||
ee_lib_echo "Disable MySQL slow log, please wait..." |
|||
|
|||
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/mysql-slow.log';" \ |
|||
|| ee_lib_error "Unable to setup slow_query_log_file, exit status = " $? |
|||
|
|||
mysql -e "set global long_query_time = 10;" \ |
|||
|| ee_lib_error "Unable to setup long_query_time, exit status = " $? |
|||
|
|||
mysql -e "set global log_queries_not_using_indexes = 'OFF';" |
|||
|
|||
# Delete EasyEngine crons |
|||
crontab -l | sed '/#EasyEngine start/,/#EasyEngine end/d' | crontab - |
|||
else |
|||
# Display message |
|||
ee_lib_echo "MySQL slow log already disable" |
|||
fi |
|||
fi |
|||
} |
@ -1,77 +0,0 @@ |
|||
# NGINX debug |
|||
|
|||
function ee_mod_debug_nginx() |
|||
{ |
|||
if [ "$EE_DEBUG" = "--start" ]; then |
|||
if [ -z $EE_DOMAIN ]; then |
|||
if [ -z "$EE_IP_ADDRESS" ]; then |
|||
# Enable NGINX debug for all IP |
|||
EE_DEBUG_ADDRESS="0.0.0.0/0" |
|||
else |
|||
EE_DEBUG_ADDRESS=$EE_IP_ADDRESS |
|||
fi |
|||
|
|||
for ee_ip in $EE_DEBUG_ADDRESS; do |
|||
grep "debug_connection $ee_ip" /etc/nginx/nginx.conf &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_echo "Setup NGINX debug connection for $ee_ip, please wait..." |
|||
sed -i "/events {/a \\\t$(echo debug_connection $ee_ip\;)" /etc/nginx/nginx.conf \ |
|||
|| ee_lib_error "Unable to setup NGINX debug connection for $ee_ip, exit status = " $? |
|||
|
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
fi |
|||
done |
|||
|
|||
if [ "$EE_TRIGGER_NGINX" != "true" ]; then |
|||
# Display message |
|||
ee_lib_echo "NGINX debug connection already enabled" |
|||
fi |
|||
|
|||
# Debug message |
|||
EE_DEBUG_MSG="/var/log/nginx/*.error.log" |
|||
else |
|||
grep "error.log debug" /etc/nginx/sites-available/$EE_DOMAIN &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_echo "Setup NGINX debug connection for $EE_DOMAIN, please wait..." |
|||
sed -i "s/error.log;/error.log debug;/" /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to setup NGINX debug connection for for $EE_DOMAIN, exit status = " $? |
|||
|
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "Already enable NGINX debug connection for $EE_DOMAIN" |
|||
fi |
|||
|
|||
# Debug message |
|||
EE_DEBUG_MSG="/var/www/$EE_DOMAIN/logs/error.log" |
|||
fi |
|||
elif [ "$EE_DEBUG" = "--stop" ]; then |
|||
if [ -z $EE_DOMAIN ]; then |
|||
grep "debug_connection" /etc/nginx/nginx.conf &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Disable NGINX debug connection, please wait..." |
|||
sed -i "/debug_connection.*/d" /etc/nginx/nginx.conf \ |
|||
|| ee_lib_error "Unable to disable NGINX debug connection, exit status = " $? |
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "NGINX debug connection already disable" |
|||
fi |
|||
else |
|||
grep "error.log debug" /etc/nginx/sites-available/$EE_DOMAIN &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Disable NGINX debug connection for $EE_DOMAIN, please wait..." |
|||
sed -i "s/error.log debug;/error.log;/" /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to disable NGINX debug connection for $EE_DOMAIN, exit status = " $? |
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "Already disable NGINX debug connection for $EE_DOMAIN" |
|||
fi |
|||
fi |
|||
fi |
|||
} |
@ -1,37 +0,0 @@ |
|||
# PHP debug |
|||
|
|||
function ee_mod_debug_php() |
|||
{ |
|||
if [ "$EE_DEBUG" = "--start" ]; then |
|||
# Perform search inside upstream php block |
|||
sed -n "/upstream php {/,/}/p" /etc/nginx/conf.d/upstream.conf | grep 9001 &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_echo "Setup PHP5-FPM slow log, please wait..." |
|||
sed -i "/upstream php {/,/}/s/9000/9001/" /etc/nginx/conf.d/upstream.conf \ |
|||
|| ee_lib_error "Unable to setup PHP5-FPM slow log, exit status = " $? |
|||
|
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "PHP5-FPM slow log already enabled" |
|||
fi |
|||
|
|||
# Debug message |
|||
EE_DEBUG_MSG="$EE_DEBUG_MSG /var/log/php5/slow.log" |
|||
elif [ "$EE_DEBUG" = "--stop" ]; then |
|||
# Perform search inside upstream php block |
|||
sed -n "/upstream php {/,/}/p" /etc/nginx/conf.d/upstream.conf | grep 9001 &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Disable PHP5-FPM slow log, please wait..." |
|||
sed -i "/upstream php {/,/}/s/9001/9000/" /etc/nginx/conf.d/upstream.conf \ |
|||
|| ee_lib_error "Unable to disable PHP5-FPM slow log, exit status = " $? |
|||
|
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "PHP5-FPM slow log already disabled" |
|||
fi |
|||
fi |
|||
} |
@ -1,72 +0,0 @@ |
|||
# NGINX rewrite debug |
|||
|
|||
function ee_mod_debug_rewrite() |
|||
{ |
|||
if [ "$EE_DEBUG" = "--start" ]; then |
|||
if [ -z $EE_DOMAIN ]; then |
|||
grep "rewrite_log on;" /etc/nginx/nginx.conf &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_echo "Setup NGINX rewrite logs, please wait..." |
|||
sed -i '/http {/a \\trewrite_log on;' /etc/nginx/nginx.conf \ |
|||
|| ee_lib_error "Unable to setup NGINX rewrite logs, exit status = " $? |
|||
|
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "NGINX rewrite logs already enabled" |
|||
fi |
|||
|
|||
# Debug message |
|||
if [ "$EE_DEBUG_MSG" != "/var/log/nginx/*.error.log" ];then |
|||
EE_DEBUG_MSG="$EE_DEBUG_MSG /var/log/nginx/*.error.log" |
|||
fi |
|||
else |
|||
grep "rewrite_log on;" /etc/nginx/sites-available/$EE_DOMAIN &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_echo "Setup NGINX rewrite logs for $EE_DOMAIN, please wait..." |
|||
sed -i "/access_log/i \\\trewrite_log on;" /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to setup NGINX rewrite logs for $EE_DOMAIN, exit status = " $? |
|||
|
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "NGINX rewrite logs for $EE_DOMAIN already enabled" |
|||
fi |
|||
|
|||
# Debug message |
|||
if [ "$EE_DEBUG_MSG" != "/var/www/$EE_DOMAIN/logs/error.log" ];then |
|||
EE_DEBUG_MSG="$EE_DEBUG_MSG /var/www/$EE_DOMAIN/logs/error.log" |
|||
fi |
|||
fi |
|||
elif [ "$EE_DEBUG" = "--stop" ]; then |
|||
if [ -z $EE_DOMAIN ]; then |
|||
grep "rewrite_log on;" /etc/nginx/nginx.conf &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Disable NGINX rewrite logs, please wait..." |
|||
sed -i "/rewrite_log.*/d" /etc/nginx/nginx.conf \ |
|||
|| ee_lib_error "Unable to disable NGINX rewrite logs, exit status = " $? |
|||
|
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "NGINX rewrite logs already disable" |
|||
fi |
|||
else |
|||
grep "rewrite_log on;" /etc/nginx/sites-available/$EE_DOMAIN &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Disable NGINX rewrite logs for $EE_DOMAIN, please wait..." |
|||
sed -i "/rewrite_log.*/d" /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to disable NGINX rewrite logs for $EE_DOMAIN, exit status = " $? |
|||
|
|||
# NGINX reload trigger |
|||
EE_TRIGGER_NGINX="true" |
|||
else |
|||
# Display message |
|||
ee_lib_echo "NGINX rewrite logs for $EE_DOMAIN already disable" |
|||
fi |
|||
fi |
|||
fi |
|||
} |
@ -1,24 +0,0 @@ |
|||
# Execute: ee debug --stop |
|||
# When ee debug module run with -i flag |
|||
# This function is called when user press CTRL+C |
|||
|
|||
function ee_mod_debug_stop() |
|||
{ |
|||
if [ "$EE_DEBUG" = "--start" ]; then |
|||
if [ -z "$EE_DOMAIN" ]; then |
|||
ee debug --stop |
|||
else |
|||
ee debug --stop $EE_DOMAIN |
|||
fi |
|||
fi |
|||
|
|||
# Unset trap so we don't get infinite loop |
|||
trap - EXIT |
|||
|
|||
# Flush file system buffers |
|||
# More details: info coreutils 'sync invocation' |
|||
sync |
|||
|
|||
# Successful exit |
|||
exit 0; |
|||
} |
@ -1,61 +0,0 @@ |
|||
# WordPress debug |
|||
|
|||
function ee_mod_debug_wp() |
|||
{ |
|||
if [ "$EE_DEBUG" = "--start" ]; then |
|||
if [ -e /var/www/$EE_DOMAIN/wp-config.php ]; then |
|||
grep "'WP_DEBUG'" /var/www/$EE_DOMAIN/wp-config.php | grep true &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
ee_lib_echo "Enable WordPress debug logs for $EE_DOMAIN, please wait..." |
|||
|
|||
# Create debug.log and fix permission |
|||
touch /var/www/$EE_DOMAIN/htdocs/wp-content/debug.log |
|||
chown $EE_PHP_USER:$EE_PHP_USER /var/www/$EE_DOMAIN/htdocs/wp-content/debug.log |
|||
|
|||
# Turn on |
|||
sed -i "s/define('WP_DEBUG'.*/define('WP_DEBUG', true);\ndefine('WP_DEBUG_DISPLAY', false);\ndefine('WP_DEBUG_LOG', true);\ndefine('SAVEQUERIES', true);/" /var/www/$EE_DOMAIN/wp-config.php \ |
|||
|| ee_lib_error "Unable to activate WordPress debug logs, exit status = " $? |
|||
|
|||
# Install developer plugin |
|||
ee_lib_echo "Installing developer plugin, please wait..." |
|||
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" |
|||
fi |
|||
|
|||
# Debug message |
|||
EE_DEBUG_MSG="$EE_DEBUG_MSG /var/www/$EE_DOMAIN/htdocs/wp-content/debug.log" |
|||
else |
|||
# Display message |
|||
ee_lib_echo_fail "Unable to find /var/www/$EE_DOMAIN/wp-config.php" |
|||
fi |
|||
elif [ "$EE_DEBUG" = "--stop" ]; then |
|||
if [ -e /var/www/$EE_DOMAIN/wp-config.php ]; then |
|||
grep "'WP_DEBUG'" /var/www/$EE_DOMAIN/wp-config.php | grep true &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Disable WordPress debug logs for $EE_DOMAIN, please wait..." |
|||
|
|||
# Turn off |
|||
sed -i "s/define('WP_DEBUG', true);/define('WP_DEBUG', false);/" /var/www/$EE_DOMAIN/wp-config.php \ |
|||
&& sed -i "/define('WP_DEBUG_DISPLAY', false);/d" /var/www/$EE_DOMAIN/wp-config.php \ |
|||
&& sed -i "/define('WP_DEBUG_LOG', true);/d" /var/www/$EE_DOMAIN/wp-config.php \ |
|||
&& sed -i "/define('SAVEQUERIES', true);/d" /var/www/$EE_DOMAIN/wp-config.php \ |
|||
|| ee_lib_error "Unable to disable WordPress debug logs, exit status = " $? |
|||
else |
|||
# Display message |
|||
ee_lib_echo "WordPress debug log already disabled for $EE_DOMAIN" |
|||
fi |
|||
else |
|||
# Display message |
|||
ee_lib_echo_fail "Unable to find /var/www/$EE_DOMAIN/wp-config.php" |
|||
fi |
|||
fi |
|||
} |
@ -1,52 +0,0 @@ |
|||
# Clean NGINX FastCGI, Memcache, OPcache cache |
|||
|
|||
function ee_mod_clean() |
|||
{ |
|||
|
|||
if [ $# -eq 0 ]; then |
|||
ee_clean_fastcgi="fastcgi" |
|||
fi |
|||
for ee_clean in $@; do |
|||
if [ "$ee_clean" = "" ] || [ "$ee_clean" = "fastcgi" ]; then |
|||
ee_clean_fastcgi="fastcgi" |
|||
elif [ "$ee_clean" = "memcache" ]; then |
|||
ee_clean_memcache="memcache" |
|||
elif [ "$ee_clean" = "opcache" ]; then |
|||
ee_clean_opcache="opcache" |
|||
elif [ "$ee_clean" = "all" ]; then |
|||
ee_clean_fastcgi="fastcgi" |
|||
ee_clean_memcache="memcache" |
|||
ee_clean_opcache="opcache" |
|||
else |
|||
ee_lib_error "$ee_clean invalid option, exit status = " $? |
|||
fi |
|||
done |
|||
|
|||
# Clean NGINX FastCGI cache |
|||
if [ "$ee_clean_fastcgi" = "fastcgi" ]; then |
|||
if [ -d /var/run/nginx-cache/ ]; then |
|||
ee_lib_echo "Cleaning NGINX FastCGI cache, please wait..." |
|||
rm -rf /var/run/nginx-cache/* &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to clean FastCGI cache, exit status = " $? |
|||
fi |
|||
fi |
|||
|
|||
# Clean Memcache |
|||
if [ "$ee_clean_memcache" = "memcache" ]; then |
|||
dpkg --get-selections | grep -v deinstall | grep memcached &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Memcache not installed, exit status = " $? |
|||
|
|||
if [ $? -eq 0 ]; then |
|||
ee_lib_echo "Cleaning Memcached, please wait..." |
|||
service memcached restart &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to restart memcached, exit status = " $? |
|||
fi |
|||
fi |
|||
|
|||
# Clean OPcache |
|||
if [ "$ee_clean_opcache" = "opcache" ]; then |
|||
ee_lib_echo "Cleaning OPcache, please wait..." |
|||
wget --no-check-certificate --spider -q https://127.0.0.1:22222/cache/opcache/opgui.php?page=reset \ |
|||
|| ee_lib_error "Unable to clean OPcache, exit status = " $? |
|||
fi |
|||
} |
@ -1,28 +0,0 @@ |
|||
# Setup HTTP authentication |
|||
|
|||
function ee_mod_secure_auth() |
|||
{ |
|||
# Random characters |
|||
local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) |
|||
|
|||
read -p "Provide HTTP authentication user name [$(git config user.name)]: " EE_HTTP_AUTH_USER |
|||
read -sp "Provide HTTP authentication password [$ee_random]: " EE_HTTP_AUTH_PASS |
|||
echo |
|||
|
|||
# If enter is pressed, set git config user.name |
|||
if [[ $EE_HTTP_AUTH_USER = "" ]]; then |
|||
EE_HTTP_AUTH_USER=$(git config user.name) |
|||
fi |
|||
|
|||
if [[ $EE_HTTP_AUTH_PASS = "" ]]; then |
|||
EE_HTTP_AUTH_PASS=$ee_random |
|||
fi |
|||
|
|||
# Add HTTP authentication details |
|||
echo |
|||
ee_lib_echo "HTTP authentication username: $EE_HTTP_AUTH_USER" &>> $EE_COMMAND_LOG |
|||
ee_lib_echo "HTTP authentication password: $EE_HTTP_AUTH_PASS" &>> $EE_COMMAND_LOG |
|||
|
|||
# Generate htpasswd-ee file |
|||
printf "$EE_HTTP_AUTH_USER:$(openssl passwd -crypt $EE_HTTP_AUTH_PASS 2> /dev/null)\n" > /etc/nginx/htpasswd-ee 2> /dev/null |
|||
} |
@ -1,31 +0,0 @@ |
|||
# White list IP address |
|||
|
|||
function ee_mod_secure_ip() |
|||
{ |
|||
read -p "Enter the comma separated IP addresses to white list [127.0.0.1]: " ee_ip |
|||
|
|||
# If enter is pressed, set 127.0.0.1 |
|||
if [[ $ee_ip = "" ]]; then |
|||
ee_ip=127.0.0.1 |
|||
fi |
|||
|
|||
# Check weather IP address already present or not |
|||
for ee_check_ip in $(echo $ee_ip | cut -d'=' -f2 | sed 's/ //g' | tr ',' '\n'); do |
|||
grep $ee_check_ip /etc/easyengine/ee.conf &>> /dev/null |
|||
if [ $? -ne 0 ]; then |
|||
ee_update_ip="$ee_update_ip $ee_check_ip" |
|||
fi |
|||
done |
|||
|
|||
# Update ee.conf |
|||
$EE_CONFIG_SET stack.ip-address "$($EE_CONFIG_GET stack.ip-address),$(echo $ee_update_ip | tr ' ' ',')" |
|||
|
|||
# White list IP address |
|||
EE_IP_ADDRESS=$($EE_CONFIG_GET stack.ip-address | cut -d'=' -f2 | sed 's/ //g' | tr ',' '\n') |
|||
if [ -n "$EE_IP_ADDRESS" ]; then |
|||
sed -i "/allow.*/d" /etc/nginx/common/acl.conf |
|||
for ee_whitelist_ip_address in $(echo $EE_IP_ADDRESS);do |
|||
sed -i "/deny/i $(echo allow $ee_whitelist_ip_address\;)" /etc/nginx/common/acl.conf |
|||
done |
|||
fi |
|||
} |
@ -1,20 +0,0 @@ |
|||
# Setup EasyEngine admin port |
|||
|
|||
function ee_mod_secure_port() |
|||
{ |
|||
read -p "EasyEngine admin port [22222]: " ee_port |
|||
|
|||
# If enter is pressed, set 22222 |
|||
if [[ $ee_port = "" ]]; then |
|||
ee_port=22222 |
|||
fi |
|||
|
|||
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 |
|||
} |
@ -1,6 +0,0 @@ |
|||
|
|||
1. **create** - scripts to create website. |
|||
1. **delete** - scripts to delete website. |
|||
1. **edit** - script to edit site nginx configuration for website. |
|||
1. **info** - script to display website information. |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue