gau1991
10 years ago
167 changed files with 0 additions and 6897 deletions
@ -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,27 +0,0 @@ |
|||
## How to get support |
|||
|
|||
For FREE community support, please use - http://community.rtcamp.com/category/easyengine/ |
|||
|
|||
For premium support, please contact - https://rtcamp.com/contact |
|||
|
|||
Please do NOT create a support request here on github. Github issue tracker is used for development task-tracking only. |
|||
|
|||
## How to report issue: |
|||
|
|||
Please attach the output of following command when requesting support using any chaneel. |
|||
|
|||
``` |
|||
bash |
|||
lsb_release -a |
|||
ee version |
|||
ee info |
|||
wp --allow-root --info |
|||
``` |
|||
|
|||
### EasyEngine chat: |
|||
Developer & contributor discussion: https://gitter.im/rtCamp/easyengine |
|||
|
|||
|
|||
### Pull Requests: |
|||
|
|||
We love pull requests. But please make sure to add inline comments so that we can understand your code easily. |
@ -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,102 +0,0 @@ |
|||
IMPORTANT |
|||
============================================ |
|||
|
|||
#### We are looking for [Python Developers] (https://rtcamp.com/careers/python-developer/) to join our team. We offer work from home, so you can join EasyEngine team anywhere! _[Why Python?] (https://rtcamp.com/blog/easyengine-3-roadmap/#whypython)_ |
|||
|
|||
--- |
|||
|
|||
[![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" /> |
|||
|
|||
[![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:** |
|||
|
|||
- Ubuntu 12.04 & 14.04 |
|||
- Debian 6 & 7 |
|||
|
|||
## Quick Start |
|||
|
|||
```bash |
|||
wget -qO ee rt.cx/ee && sudo bash ee # install easyengine |
|||
sudo 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 |
|||
``` |
|||
|
|||
## Try EasyEngine 3.0.0-beta |
|||
|
|||
```bash |
|||
wget http://rt.cx/eebeta && sudo bash install |
|||
``` |
|||
|
|||
## 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 |
|||
|
|||
[![Donate](https://cloud.githubusercontent.com/assets/4115/5297691/c7b50292-7bd7-11e4-987b-2dc21069e756.png)] (https://rtcamp.com/donate/?project=easyengine) |
|||
|
|||
## License |
|||
|
|||
Same [GPL] (http://www.gnu.org/licenses/gpl-2.0.txt) that WordPress uses! |
@ -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,885 +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 |
|||
ee_lib_echo_info "Successfully Created New Website: http://$EE_WWW_DOMAIN" |
|||
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 |
|||
|
|||
# Setup WordPress |
|||
ee_mod_setup_wordpress |
|||
|
|||
# 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 |
|||
|
|||
# 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 |
|||
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 |
|||
|
|||
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 ] || [ -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 |
|||
|
|||
# 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 200 301 302 404 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 +0,0 @@ |
|||
1. **man** - manual pages for EasyEngine (ee). Actual Linux Path : `/usr/share/man/man8/` |
@ -1 +0,0 @@ |
|||
1. **ee.8** - manual page for EasyEngine (ee). |
@ -1,310 +0,0 @@ |
|||
.TH ee 8 "EasyEngine (ee) version: 2.2.1" "Oct 16,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/ |
|||
|
@ -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 |
|||
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.0' |
|||
|
|||
# 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.11' |
|||
|
|||
# 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. |
|||
|
@ -1,8 +0,0 @@ |
|||
|
|||
- ee_mod_plugin_nginx_helper.sh - setup nginx-helper plugin. |
|||
- ee_mod_plugin_w3tc.sh - Setup W3 Total Cache. |
|||
- ee_mod_plugin_wpsc.sh - Setup WP Super Cache |
|||
- ee_mod_setup_database.sh - Database setup |
|||
- ee_mod_setup_domain.sh - Domain setup |
|||
- ee_mod_setup_network.sh - Setup WordPress Network |
|||
- ee_mod_setup_wordpress.sh - Setup WordPress given domain name. |
@ -1,13 +0,0 @@ |
|||
# Setup NGINX Helper |
|||
|
|||
function ee_mod_plugin_nginx_helper() |
|||
{ |
|||
cd /var/www/$EE_DOMAIN/htdocs/ |
|||
ee_lib_echo "Installing Nginx Helper plugin, please wait..." |
|||
wp plugin --allow-root install nginx-helper &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to install Nginx Helper plugin, exit status = " $? |
|||
|
|||
# Activate Nginx Helper |
|||
wp plugin --allow-root activate nginx-helper $EE_NETWORK_ACTIVATE &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to activate Nginx Helper plugin, exit status = " $? |
|||
} |
@ -1,35 +0,0 @@ |
|||
# Display WordPress cache plugin settings |
|||
|
|||
function ee_mod_plugin_settings() { |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
ee_lib_echo_escape "Configure WPSC:\t\thttp://$EE_DOMAIN/wp-admin/network/settings.php?page=wpsupercache" |
|||
else |
|||
ee_lib_echo_escape "Configure WPSC:\t\thttp://$EE_DOMAIN/wp-admin/options-general.php?page=wpsupercache" |
|||
fi |
|||
fi |
|||
|
|||
if [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
ee_lib_echo_escape "Configure nginx-helper:\thttp://$EE_DOMAIN/wp-admin/network/settings.php?page=nginx" |
|||
else |
|||
ee_lib_echo_escape "Configure nginx-helper:\thttp://$EE_DOMAIN/wp-admin/options-general.php?page=nginx" |
|||
fi |
|||
fi |
|||
|
|||
if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
ee_lib_echo_escape "Configure W3TC:\t\thttp://$EE_DOMAIN/wp-admin/network/admin.php?page=w3tc_general" |
|||
else |
|||
ee_lib_echo_escape "Configure W3TC:\t\thttp://$EE_DOMAIN/wp-admin/admin.php?page=w3tc_general" |
|||
fi |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
ee_lib_echo_escape "Page Cache:\t\tDisable" |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then |
|||
ee_lib_echo_escape "Page Cache:\t\tDisk Enhanced" |
|||
fi |
|||
ee_lib_echo_escape "Database Cache:\t\tMemcached" |
|||
ee_lib_echo_escape "Object Cache:\t\tMemcached" |
|||
ee_lib_echo_escape "Browser Cache:\t\tDisable" |
|||
fi |
|||
} |
@ -1,13 +0,0 @@ |
|||
# Setup W3 Total Cache |
|||
|
|||
function ee_mod_plugin_w3tc() |
|||
{ |
|||
cd /var/www/$EE_DOMAIN/htdocs/ |
|||
ee_lib_echo "Installing W3 Total Cache plugin, please wait..." |
|||
wp plugin --allow-root install w3-total-cache &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to install W3 Total Cache plugin, exit status = " $? |
|||
|
|||
# Activate W3 Total Cache |
|||
wp plugin --allow-root activate w3-total-cache $EE_NETWORK_ACTIVATE &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to activate W3 Total Cache plugin, exit status = " $? |
|||
} |
@ -1,13 +0,0 @@ |
|||
# Setup WP Super Cache |
|||
|
|||
function ee_mod_plugin_wpsc() |
|||
{ |
|||
cd /var/www/$EE_DOMAIN/htdocs/ |
|||
ee_lib_echo "Installing WP Super Cache plugin, please wait..." |
|||
wp plugin --allow-root install wp-super-cache &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to install WP Super Cache plugin, exit status = " $? |
|||
|
|||
# Activate WP Super Cache |
|||
wp plugin --allow-root activate wp-super-cache $EE_NETWORK_ACTIVATE &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to activate WP Super Cache plugin, exit status = " $? |
|||
} |
@ -1,66 +0,0 @@ |
|||
# Database setup |
|||
|
|||
function ee_mod_setup_database() |
|||
{ |
|||
# Random characters |
|||
local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) |
|||
|
|||
# Replace dot(.) with underscore(_) in EE_DOMAIN Name |
|||
local ee_replace_dot=$(echo $EE_DOMAIN | tr '.' '_') |
|||
|
|||
# Default database or custom database |
|||
if [ $($EE_CONFIG_GET mysql.db-name) == "true" ];then |
|||
read -p "Enter the MySQL database name [$ee_replace_dot]: " EE_DB_NAME |
|||
fi |
|||
|
|||
# If mysql.db-name = false |
|||
# Then it never ask for MySQL database name in this case $EE_DB_NAME is empty |
|||
# If mysql.db-name = true |
|||
# User enter custom database name then $EE_DB_NAME is not empty & we used provided database name |
|||
# If user pressed enter then $EE_DB_NAME is empty |
|||
|
|||
if [[ $EE_DB_NAME = "" ]]; then |
|||
EE_DB_NAME=$ee_replace_dot |
|||
fi |
|||
|
|||
# Default database user or custom user |
|||
if [ $($EE_CONFIG_GET mysql.db-user) == "true" ]; then |
|||
read -p "Enter the MySQL database username [$ee_replace_dot]: " EE_DB_USER |
|||
read -sp "Enter the MySQL database password [$ee_random]: " EE_DB_PASS |
|||
fi |
|||
|
|||
# If mysql.db-user = false |
|||
# Then it never ask for MySQL database user in this case $EE_DB_USER is empty |
|||
# If mysql.db-name = true |
|||
# User enter custom database user then $EE_DB_USER is not empty & we used provided database user |
|||
# If user pressed enter then $EE_DB_USER is empty |
|||
|
|||
if [[ $EE_DB_USER = "" ]]; then |
|||
EE_DB_USER=$ee_replace_dot |
|||
fi |
|||
|
|||
if [[ $EE_DB_PASS = "" ]]; then |
|||
EE_DB_PASS=$ee_random |
|||
fi |
|||
|
|||
# Fix MySQL username ERROR 1470 (HY000) |
|||
if [[ $(echo -n $EE_DB_USER | wc -c) -gt 16 ]]; then |
|||
ee_lib_echo "Autofix MySQL username (ERROR 1470 (HY000)), please wait..." |
|||
local ee_random10=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n1) |
|||
EE_DB_USER=$(echo $EE_DB_USER | cut -c1-16 | sed "s/.\{10\}$/$ee_random10/") |
|||
fi |
|||
|
|||
# Create MySQL database |
|||
echo -e "EE_DB_NAME = $EE_DB_NAME \nEE_DB_USER = $EE_DB_USER \nEE_DB_PASS = $EE_DB_PASS \nEE_MYSQL_HOST = $EE_MYSQL_HOST \nEE_MYSQL_GRANT_HOST = $EE_MYSQL_GRANT_HOST" &>> $EE_COMMAND_LOG |
|||
mysql -e "create database \`$EE_DB_NAME\`" \ |
|||
|| ee_lib_error "Unable to create $EE_DB_NAME database, exit status = " $? |
|||
|
|||
# Create MySQL User |
|||
mysql -e "create user '$EE_DB_USER'@'$EE_MYSQL_GRANT_HOST' identified by '$EE_DB_PASS'" \ |
|||
|| ee_lib_error "Unable to create $EE_DB_USER database user, exit status = " $? |
|||
|
|||
# Grant permission |
|||
mysql -e "grant all privileges on \`$EE_DB_NAME\`.* to '$EE_DB_USER'@'$EE_MYSQL_GRANT_HOST'" \ |
|||
|| ee_lib_error "Unable to grant privileges for $EE_DB_USER database user, exit status = " $? |
|||
mysql -e "flush privileges" |
|||
} |
@ -1,30 +0,0 @@ |
|||
# Domain setup |
|||
|
|||
function ee_mod_setup_domain() |
|||
{ |
|||
ls /etc/nginx/sites-available/$EE_DOMAIN &> /dev/null |
|||
if [ $? -ne 0 ]; then |
|||
|
|||
# Creating $EE_DOMAIN |
|||
ee_lib_echo "Creating $EE_DOMAIN, please wait..." |
|||
sed "s/example.com/$EE_DOMAIN/g" \ |
|||
/usr/share/easyengine/nginx/$EE_NGINX_CONF \ |
|||
> /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to create NGINX configuration file for $EE_DOMAIN, exit status = " $? |
|||
|
|||
# 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/ |
|||
|
|||
# Creating htdocs & logs directory |
|||
ee_lib_echo "Creating htdocs & logs directory" |
|||
mkdir -p /var/www/$EE_DOMAIN/htdocs && mkdir -p /var/www/$EE_DOMAIN/logs \ |
|||
|| ee_lib_error "Unable to create htdocs & logs directory, exit status = " $? |
|||
|
|||
# Creating symbolic links for logs |
|||
ee_lib_symbolic_link /var/log/nginx/$EE_DOMAIN.access.log /var/www/$EE_DOMAIN/logs/access.log |
|||
ee_lib_symbolic_link /var/log/nginx/$EE_DOMAIN.error.log /var/www/$EE_DOMAIN/logs/error.log |
|||
else |
|||
ee_lib_error "$EE_DOMAIN already exist, exit status = " $? |
|||
fi |
|||
} |
@ -1,12 +0,0 @@ |
|||
# Setup WordPress Network |
|||
|
|||
function ee_mod_setup_network() |
|||
{ |
|||
cd /var/www/$EE_DOMAIN/htdocs || ee_lib_error "Unable to change directory, exit status = " $? |
|||
wp core install-network --allow-root --title="$EE_WWW_DOMAIN" $EE_WP_SUBDOMAIN &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to setup WordPress network, exit status = " $? |
|||
|
|||
sed -i "/WP_DEBUG/a \define('WP_ALLOW_MULTISITE', true);" /var/www/$EE_DOMAIN/wp-config.php |
|||
sed -i "/WP_ALLOW_MULTISITE/a \define('WPMU_ACCEL_REDIRECT', true);" /var/www/$EE_DOMAIN/wp-config.php |
|||
|
|||
} |
@ -1,144 +0,0 @@ |
|||
# Setup WordPress for $EE_DOMAIN |
|||
|
|||
function ee_mod_setup_wordpress() |
|||
{ |
|||
# Random characters |
|||
local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) |
|||
|
|||
# Download latest WordPress |
|||
ee_lib_echo "Downloading WordPress, please wait..." |
|||
cd /var/www/$EE_DOMAIN/htdocs && wp --allow-root core download &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to download WordPress, exit status = " $? |
|||
|
|||
# Database setup |
|||
# if EE_DB_NAME, EE_DB_USER, EE_DB_PASS are empty then setup database for new site |
|||
# else current mysql site is to be updated |
|||
if [ "$EE_DB_NAME" = "" ] && [ "$EE_DB_USER" = "" ] && [ "$EE_DB_PASS" = "" ]; then |
|||
ee_mod_setup_database |
|||
else |
|||
# Display when run ee site update mysql.com --wp |
|||
echo -e "EE_DB_NAME = $EE_DB_NAME \nEE_DB_USER = $EE_DB_USER \nEE_DB_PASS = $EE_DB_PASS \nEE_MYSQL_HOST = $EE_MYSQL_HOST \nEE_MYSQL_GRANT_HOST = $EE_MYSQL_GRANT_HOST" &>> $EE_COMMAND_LOG |
|||
fi |
|||
|
|||
# Default WordPress prefix or custom prefix |
|||
if [ $($EE_CONFIG_GET wordpress.prefix) == "true" ];then |
|||
read -p "Enter the WordPress table prefix [wp_]: " EE_WP_PREFIX |
|||
# Display EE_WP_PREFIX valid characters warning & try again |
|||
while [[ ! ($EE_WP_PREFIX =~ ^[A-Za-z0-9_]*$) ]]; do |
|||
echo "Warning: table prefix can only contain numbers, letters, and underscores" |
|||
read -p "Enter the WordPress table prefix [wp_]: " EE_WP_PREFIX |
|||
done |
|||
fi |
|||
|
|||
# If wordpress.prefix = false |
|||
# Then it never ask for WordPress prefix in this case $EE_WP_PREFIX is empty |
|||
# If wordpress.prefix = true |
|||
# User enter custom WordPress prefix then $EE_WP_PREFIX is not empty & we used provided WordPress prefix |
|||
# If user pressed enter then $EE_WP_PREFIX is empty |
|||
|
|||
# WordPress database table prefix default: wp_ |
|||
if [[ $EE_WP_PREFIX = "" ]];then |
|||
EE_WP_PREFIX=wp_ |
|||
fi |
|||
|
|||
# Let's log WordPress table prefix |
|||
echo EE_WP_PREFIX = $EE_WP_PREFIX &>> $EE_COMMAND_LOG |
|||
|
|||
# Modify wp-config.php & move outside the webroot |
|||
cp /var/www/$EE_DOMAIN/htdocs/wp-config-sample.php \ |
|||
/var/www/$EE_DOMAIN/wp-config.php |
|||
|
|||
sed -i "s/database_name_here/$EE_DB_NAME/" \ |
|||
/var/www/$EE_DOMAIN/wp-config.php |
|||
|
|||
sed -i "s/username_here/$EE_DB_USER/" \ |
|||
/var/www/$EE_DOMAIN/wp-config.php |
|||
|
|||
sed -i "s/password_here/$EE_DB_PASS/" \ |
|||
/var/www/$EE_DOMAIN/wp-config.php |
|||
|
|||
sed -i "s/localhost/$EE_MYSQL_HOST/" \ |
|||
/var/www/$EE_DOMAIN/wp-config.php |
|||
|
|||
sed -i "s/wp_/$EE_WP_PREFIX/" \ |
|||
/var/www/$EE_DOMAIN/wp-config.php |
|||
|
|||
printf '%s\n' "g/put your unique phrase here/d" \ |
|||
a "$(curl -sL https://api.wordpress.org/secret-key/1.1/salt/)" . w \ |
|||
| ed -s /var/www/$EE_DOMAIN/wp-config.php |
|||
|
|||
# Set WordPress username |
|||
# First get WordPress username from /etc/easyengine/ee.conf file |
|||
EE_WP_USER=$($EE_CONFIG_GET wordpress.user) |
|||
|
|||
if [[ $EE_WP_USER = "" ]]; then |
|||
git config user.name &>> /dev/null |
|||
if [ $? -eq 0 ]; then |
|||
# Set WordPress username from git config user.name |
|||
EE_WP_USER=$(git config user.name) |
|||
else |
|||
while [ -z $EE_WP_USER ]; do |
|||
# Ask user to provide WordPress username |
|||
ee_lib_echo "Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods and the @ symbol." |
|||
read -p "Enter WordPress username: " EE_WP_USER |
|||
done |
|||
fi |
|||
fi |
|||
|
|||
# Set WordPress password |
|||
EE_WP_PASS=$($EE_CONFIG_GET wordpress.password) |
|||
if [[ $EE_WP_PASS = "" ]]; then |
|||
EE_WP_PASS=$ee_random |
|||
fi |
|||
|
|||
# Set WordPress email |
|||
# First get WordPress email from /etc/easyengine/ee.conf file |
|||
EE_WP_EMAIL=$($EE_CONFIG_GET wordpress.email) |
|||
|
|||
if [[ $EE_WP_EMAIL = "" ]]; then |
|||
git config user.email &>> /dev/null |
|||
if [ $? -eq 0 ]; then |
|||
# Set WordPress email from git config user.email |
|||
EE_WP_EMAIL=$(git config user.email) |
|||
else |
|||
while [ -z $EE_WP_EMAIL ]; do |
|||
# Ask user to provide WordPress email |
|||
read -p "Enter WordPress email: " EE_WP_EMAIL |
|||
done |
|||
fi |
|||
fi |
|||
|
|||
# Let's log WordPress username/password/email |
|||
echo -e "EE_WP_USER = $EE_WP_USER \nEE_WP_PASS = $EE_WP_PASS \nEE_WP_EMAIL = $EE_WP_EMAIL" &>> $EE_COMMAND_LOG |
|||
|
|||
# Create WordPress tables |
|||
ee_lib_echo "Setting up WordPress, please wait..." |
|||
cd /var/www/$EE_DOMAIN/htdocs \ |
|||
|| ee_lib_error "Unable to change directory to install WordPress, exit status = " $? |
|||
|
|||
wp core install --allow-root --url=$EE_WWW_DOMAIN --title="$EE_WWW_DOMAIN" \ |
|||
--admin_name="$EE_WP_USER" --admin_password=$EE_WP_PASS --admin_email=$EE_WP_EMAIL &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to create WordPress tables for $EE_DOMAIN, exit status = " $? |
|||
|
|||
# Update WordPress permalink structure day and postname |
|||
ee_lib_echo "Updating WordPress permalink, please wait..." |
|||
wp rewrite structure --allow-root /%year%/%monthnum%/%day%/%postname%/ &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to update WordPress permalink for $EE_DOMAIN, exit status = " $? |
|||
|
|||
# Setup WordPress Network |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
ee_mod_setup_network |
|||
fi |
|||
|
|||
# Install WordPress plugins |
|||
ee_mod_plugin_nginx_helper |
|||
|
|||
if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
ee_mod_plugin_wpsc |
|||
fi |
|||
|
|||
if [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
ee_mod_plugin_w3tc |
|||
fi |
|||
|
|||
} |
@ -1,44 +0,0 @@ |
|||
# Delete MySQL database |
|||
|
|||
function ee_mod_delete_database() |
|||
{ |
|||
# HTML & PHP website doesn't have database |
|||
head -n1 /etc/nginx/sites-available/$EE_DOMAIN | egrep -e 'HTML|PHP' &>> $EE_COMMAND_LOG |
|||
if [ $? -ne 0 ]; then |
|||
# Database details |
|||
local ee_db_name=$(grep DB_NAME /var/www/$EE_DOMAIN/*-config.php | cut -d"'" -f4) |
|||
local ee_db_user=$(grep DB_USER /var/www/$EE_DOMAIN/*-config.php | cut -d"'" -f4) |
|||
local ee_db_pass=$(grep DB_PASS /var/www/$EE_DOMAIN/*-config.php | cut -d"'" -f4) |
|||
local ee_db_host=$(grep DB_HOST /var/www/$EE_DOMAIN/*-config.php | cut -d"'" -f4) |
|||
ee_lib_echo_escape " DB_NAME = $ee_db_name \n DB_USER = $ee_db_user \n DB_HOST = $ee_db_host \n GRANT_HOST = $EE_MYSQL_GRANT_HOST" |
|||
|
|||
if [ "$1" = "--no-prompt" ];then |
|||
# Delete database without any prompt |
|||
local ee_prompt="y" |
|||
else |
|||
# Fix read prompt |
|||
stty echo |
|||
# Ask user to confirm |
|||
read -p "Are you sure to drop $ee_db_name database (y/n): " ee_prompt |
|||
fi |
|||
|
|||
if [ "$ee_prompt" = "y" ]; then |
|||
# Drop database |
|||
mysql -e "drop database \`$ee_db_name\`" \ |
|||
|| ee_lib_error "Unable to drop $ee_db_name database, exit status = " $? |
|||
|
|||
# Never drop root user |
|||
if [ "$ee_db_user" != "root" ]; then |
|||
# Drop database user |
|||
mysql -e "drop user '$ee_db_user'@'$EE_MYSQL_GRANT_HOST'" \ |
|||
|| ee_lib_error "Unable to drop database user $ee_db_user, exit status = " $? |
|||
# Flush privileges |
|||
mysql -e "flush privileges" \ |
|||
|| ee_lib_error "Unable to flush MySQL privileges, exit status = " $? |
|||
fi |
|||
else |
|||
# Deny message |
|||
ee_lib_echo_fail "User denied to drop $ee_db_name database" |
|||
fi |
|||
fi |
|||
} |
@ -1,24 +0,0 @@ |
|||
# Delete NGINX configuration file |
|||
|
|||
function ee_mod_delete_nginxconf() |
|||
{ |
|||
|
|||
if [ "$1" = "--no-prompt" ];then |
|||
# Delete NGINX configuration without any prompt |
|||
local ee_prompt="y" |
|||
else |
|||
# Fix read prompt |
|||
stty echo |
|||
# Ask user to confirm |
|||
read -p "Are you sure to remove $EE_DOMAIN NGINX configuration (y/n): " ee_prompt |
|||
fi |
|||
|
|||
if [ "$ee_prompt" = "y" ]; then |
|||
# Delete $EE_DOMAIN NGINX configuration |
|||
rm -rf /etc/nginx/sites-available/$EE_DOMAIN /etc/nginx/sites-enabled/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to remove $EE_DOMAIN NGINX configuration, exit status = " $? |
|||
else |
|||
# Deny message |
|||
ee_lib_echo_fail "User denied to remove $EE_DOMAIN NGINX configuration" |
|||
fi |
|||
} |
@ -1,24 +0,0 @@ |
|||
# Delete webroot |
|||
|
|||
function ee_mod_delete_webroot() |
|||
{ |
|||
|
|||
if [ "$1" = "--no-prompt" ];then |
|||
# Delete webroot without any prompt |
|||
local ee_prompt="y" |
|||
else |
|||
# Fix read prompt |
|||
stty echo |
|||
# Ask user to confirm |
|||
read -p "Are you sure to remove $EE_DOMAIN webroot (y/n): " ee_prompt |
|||
fi |
|||
|
|||
if [ "$ee_prompt" = "y" ]; then |
|||
# Delete $EE_DOMAIN webroot |
|||
rm -rf /var/www/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to remove $EE_DOMAIN webroot, exit status = " $? |
|||
else |
|||
# Deny message |
|||
ee_lib_echo_fail "User denied to remove $EE_DOMAIN webroot" |
|||
fi |
|||
} |
@ -1,44 +0,0 @@ |
|||
# Backup NGINX configuration & Database & Webroot |
|||
|
|||
function ee_mod_site_backup() |
|||
{ |
|||
|
|||
# Backup directory setup |
|||
local ee_webroot=$(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/\/htdocs//') |
|||
if [ ! -d $ee_webroot/backup/$EE_DATE ]; then |
|||
mkdir -p $ee_webroot/backup/$EE_DATE || ee_lib_error "Fail to create backup directory, exit status =" $? |
|||
fi |
|||
|
|||
ee_lib_echo "Backup location: $ee_webroot/backup/$EE_DATE" |
|||
ee_lib_echo "Backup NGINX configuration, please wait..." |
|||
# Backup $EE_DOMAIN NGINX configuration |
|||
cp /etc/nginx/sites-available/$EE_DOMAIN $ee_webroot/backup/$EE_DATE/ \ |
|||
|| ee_lib_error "Failed: Backup NGINX configuration, exit status =" $? |
|||
|
|||
# Move htdocs |
|||
if [ "$EE_SITE_CURRENT_TYPE" = "--html" ] || [ "$EE_SITE_CURRENT_TYPE" = "--php" ] || [ "$EE_SITE_CURRENT_TYPE" = "--mysql" ]; then |
|||
ee_lib_echo "Backup webroot, please wait..." |
|||
mv $ee_webroot/htdocs $ee_webroot/backup/$EE_DATE/ \ |
|||
|| ee_lib_error "Failed: Backup webroot, exit status =" $? |
|||
ee_lib_echo "Setting up webroot, please wait..." |
|||
mkdir -p $ee_webroot/htdocs || ee_lib_error "Failed: Setting up webroot, exit status =" $? |
|||
fi |
|||
|
|||
# Database backup |
|||
# Check ee-config.php or wp-config.php present |
|||
if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/') ]; then |
|||
local ee_db_name=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) |
|||
ee_lib_echo "Backup Database, please wait..." |
|||
mysqldump $ee_db_name > $ee_webroot/backup/$EE_DATE/${ee_db_name}.sql \ |
|||
|| ee_lib_error "Failed: Backup Database, exit status =" $? |
|||
|
|||
# Move ee-config.php and copy wp-config.php to backup |
|||
if [ -f $ee_webroot/ee-config.php ]; then |
|||
mv $ee_webroot/ee-config.php $ee_webroot/backup/$EE_DATE/ \ |
|||
|| ee_lib_error "Failed: Backup ee-config.php, exit status =" $? |
|||
else |
|||
cp $ee_webroot/wp-config.php $ee_webroot/backup/$EE_DATE/ \ |
|||
|| ee_lib_error "Failed: Backup wp-config.php, exit status =" $? |
|||
fi |
|||
fi |
|||
} |
@ -1,8 +0,0 @@ |
|||
# Change directory to website root |
|||
|
|||
function ee_site_cd() |
|||
{ |
|||
cd $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g') \ |
|||
|| ee_lib_error "Unable to change directory for $EE_DOMAIN, exit status = " $? |
|||
exec bash |
|||
} |
@ -1,12 +0,0 @@ |
|||
# Open website in default editor |
|||
|
|||
function ee_mod_site_edit() |
|||
{ |
|||
# Redirect VIM warning to /dev/null |
|||
sensible-editor --help | head -n1 | grep VIM &>> $EE_COMMAND_LOG |
|||
if [ $? -eq 0 ]; then |
|||
sensible-editor /etc/nginx/sites-available/$EE_DOMAIN $1 2> /dev/null |
|||
else |
|||
sensible-editor /etc/nginx/sites-available/$EE_DOMAIN $1 |
|||
fi |
|||
} |
@ -1,34 +0,0 @@ |
|||
# Display information about website |
|||
|
|||
function ee_mod_site_info() |
|||
{ |
|||
local ee_site_status=$(ls /etc/nginx/sites-enabled/$EE_DOMAIN &> /dev/null && echo Enable || echo Disable) |
|||
local ee_site_info=$(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) |
|||
local ee_access_log=$(grep access_log /etc/nginx/sites-available/$EE_DOMAIN | grep "/var/log/nginx/" | awk '{print($2)}' | cut -d ';' -f1) |
|||
local ee_error_log=$(grep error_log /etc/nginx/sites-available/$EE_DOMAIN | grep "/var/log/nginx/" | awk '{print($2)}' | cut -d ';' -f1) |
|||
local ee_webroot=$(grep root /etc/nginx/sites-available/$EE_DOMAIN | grep htdocs | awk '{print($2)}' | cut -d ';' -f1) |
|||
|
|||
ee_lib_echo "Information about $EE_DOMAIN:" |
|||
ee_lib_echo_escape "\nNginx configuration\t \033[37m$ee_site_info ($ee_site_status)" |
|||
ee_lib_echo_escape "access_log\t\t \033[37m$ee_access_log" |
|||
ee_lib_echo_escape "error_log\t\t \033[37m$ee_error_log" |
|||
ee_lib_echo_escape "Webroot\t\t\t \033[37m$ee_webroot" |
|||
|
|||
if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/') ]; then |
|||
local ee_db_name=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) |
|||
local ee_db_host=$(grep DB_HOST $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) |
|||
local ee_db_user=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) |
|||
local ee_db_pass=$(grep DB_PASS $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/*-config.php/' 2> /dev/null) | cut -d"'" -f4) |
|||
|
|||
ee_lib_echo_escape "DB_HOST\t\t\t \033[37m$ee_db_host" |
|||
ee_lib_echo_escape "DB_NAME\t\t\t \033[37m$ee_db_name" |
|||
ee_lib_echo_escape "DB_USER\t\t\t \033[37m$ee_db_user" |
|||
ee_lib_echo_escape "DB_PASS\t\t\t \033[37m$ee_db_pass" |
|||
|
|||
if [ -f $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/wp-config.php/') ]; then |
|||
local ee_table_prefix=$(grep table_prefix $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed 's/htdocs/wp-config.php/') | cut -d"'" -f2) |
|||
ee_lib_echo_escape "table_prefix\t\t \033[37m$ee_table_prefix" |
|||
fi |
|||
fi |
|||
|
|||
} |
@ -1,27 +0,0 @@ |
|||
# Checks log |
|||
|
|||
function ee_mod_site_log() |
|||
{ |
|||
# Sets ee_log_path to empty, so that it should not use its previous values |
|||
local ee_log_path="" |
|||
# Check if domain name passed |
|||
if [ $# -eq 0 ]; then |
|||
for ee_domain_name in $(ls /etc/nginx/sites-available/*); do |
|||
ee_log_path="$ee_log_path /var/log/nginx/$(basename $ee_domain_name).*.log" |
|||
done |
|||
else |
|||
for ee_domain_name in $@; do |
|||
EE_DOMAIN_CHECK=$ee_domain_name |
|||
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 = " $? |
|||
|
|||
if [ $? -eq 0 ]; then |
|||
ee_log_path="$ee_log_path /var/log/nginx/$EE_DOMAIN.*.log" |
|||
fi |
|||
done |
|||
fi |
|||
tail -f ${ee_log_path} |
|||
} |
@ -1,48 +0,0 @@ |
|||
# Auto switch site options |
|||
|
|||
function ee_mod_site_option() |
|||
{ |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--basic" ] || [ "$EE_SITE_CREATE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpfc" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdirectory" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsubdomain" ]; then |
|||
EE_SITE_CREATE_OPTION=$EE_FIFTH |
|||
EE_SITE_CACHE_OPTION=$EE_FOURTH |
|||
else |
|||
EE_SITE_CREATE_OPTION=--wp |
|||
EE_SITE_CACHE_OPTION=$EE_FOURTH |
|||
fi |
|||
fi |
|||
|
|||
# WordPresss subdirectory variables |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdirectory" ]; then |
|||
EE_SITE_CREATE_OPTION="--wpsubdir" |
|||
EE_NETWORK_ACTIVATE="--network" |
|||
fi |
|||
|
|||
# WordPress sub-domain variables |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdom" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
EE_SITE_CREATE_OPTION="--wpsubdomain" |
|||
EE_NETWORK_ACTIVATE="--network" |
|||
EE_WP_SUBDOMAIN="--subdomains" |
|||
fi |
|||
|
|||
# Use default whenever possible |
|||
if [ "$EE_SITE_CREATE_OPTION" = "" ]; then |
|||
EE_SITE_CREATE_OPTION=--html |
|||
fi |
|||
|
|||
# For WordPress sites if $EE_SITE_CACHE_OPTION is empty then used --basic as a $EE_SITE_CACHE_OPTION |
|||
if [ "$EE_SITE_CACHE_OPTION" = "" ] && [ "$EE_SITE_CREATE_OPTION" != "--html" ] && [ "$EE_SITE_CREATE_OPTION" != "--php" ] && [ "$EE_SITE_CREATE_OPTION" != "--mysql" ]; then |
|||
EE_SITE_CACHE_OPTION=--basic |
|||
fi |
|||
|
|||
# Kick out for invalid cache option |
|||
if [[ "$EE_SECOND" = "update" && "$EE_SITE_CREATE_OPTION" = "--password" ]]; then |
|||
ee_lib_echo "This option is needed for updating WordPress website password" &> /dev/null |
|||
elif [[ "$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_CREATE_OPTION" != "--wpsubdomain" ]]; then |
|||
ee_lib_error "Invalid website type $EE_SITE_CREATE_OPTION, exit status = " $? |
|||
elif [[ "$EE_SITE_CREATE_OPTION" = "--html" || "$EE_SITE_CREATE_OPTION" = "--php" || "$EE_SITE_CREATE_OPTION" = "--mysql" ]] && [ -n "$EE_SITE_CACHE_OPTION" ]; then |
|||
ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION for $EE_SITE_CREATE_OPTION website, exit status = " $? |
|||
elif [[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--basic" && "$EE_SITE_CACHE_OPTION" != "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then |
|||
ee_lib_error "Invalid cache option $EE_SITE_CACHE_OPTION, exit status = " $? |
|||
fi |
|||
} |
@ -1,27 +0,0 @@ |
|||
# Install Required Packages while site create |
|||
|
|||
function ee_mod_site_packages() |
|||
{ |
|||
# Install required packages |
|||
|
|||
if [ "$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_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
# Check & Install NGINX Packages |
|||
ee_lib_stack_packages nginx |
|||
fi |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--php" ] || [ "$EE_SITE_CREATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
# Check & Install PHP Packages |
|||
ee_lib_stack_packages php |
|||
fi |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
# Check & Install Percona MySQL Packages |
|||
ee_lib_stack_packages mysql |
|||
fi |
|||
|
|||
# Check & Install Postfix Packages |
|||
ee_lib_stack_packages postfix |
|||
|
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wp" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
# Install WP-CLI |
|||
ee_ven_install_wpcli |
|||
fi |
|||
} |
@ -1,42 +0,0 @@ |
|||
# Update WordPress user password |
|||
|
|||
ee_mod_site_update_password() |
|||
{ |
|||
local ee_wp_user ee_wp_pass |
|||
|
|||
cd $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g') \ |
|||
|| ee_lib_error "Unable to change directory for $EE_DOMAIN, exit status = " $? |
|||
|
|||
wp --allow-root core version &>> /dev/null \ |
|||
|| ee_lib_error "Error: $EE_DOMAIN does not seem to be a WordPress install, exit status = " $? |
|||
|
|||
if [ $? -eq 0 ]; then |
|||
read -p "Provide WordPress user name [admin]: " ee_wp_user |
|||
|
|||
# If user enter ? mark then show list of WordPress users |
|||
if [ "$ee_wp_user" = "?" ]; then |
|||
ee_lib_echo "Fetching WordPress user list, please wait..." |
|||
wp --allow-root user list --fields=user_login | grep -v user_login |
|||
read -p "Provide WordPress user name [admin]: " ee_wp_user |
|||
fi |
|||
|
|||
if [ "$ee_wp_user" = "" ]; then |
|||
ee_wp_user=admin |
|||
fi |
|||
|
|||
# Check WordPress user exist or not |
|||
wp --allow-root user list --fields=user_login | grep ${ee_wp_user}$ &>> /dev/null |
|||
if [ $? -eq 0 ]; then |
|||
read -sp "Provide password for $ee_wp_user user: " ee_wp_pass |
|||
echo |
|||
if [[ ${#ee_wp_pass} -ge 8 ]]; then |
|||
wp --allow-root user update "${ee_wp_user}" --user_pass=$ee_wp_pass &>> $EE_COMMAND_LOG && \ |
|||
ee_lib_echo "Password updated successfully" |
|||
else |
|||
ee_lib_error "Password Unchanged. Hint : Your password must be 8 characters long, exit status = " $? |
|||
fi |
|||
else |
|||
ee_lib_error "Invalid WordPress user $ee_wp_user for $EE_DOMAIN, exit status = " $? |
|||
fi |
|||
fi |
|||
} |
@ -1,129 +0,0 @@ |
|||
# Update NGINX configuration for $EE_DOMAIN |
|||
|
|||
function ee_mod_update_nginx() |
|||
{ |
|||
# Git commit |
|||
ee_lib_git /etc/nginx/ "Before ee site update: $EE_DOMAIN running on $EE_SITE_CURRENT_TYPE" |
|||
|
|||
# Update NGINX configuration |
|||
ee_lib_echo "Updating $EE_DOMAIN, please wait..." |
|||
|
|||
if [ -f /etc/nginx/sites-available/$EE_DOMAIN ]; then |
|||
# Find out current NGINX configuration header |
|||
ee_nginx_current_header=$(head -n1 /etc/nginx/sites-available/$EE_DOMAIN | grep "NGINX CONFIGURATION") |
|||
|
|||
# Update NGINX configuration header |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--html" ] || [ "$EE_SITE_CREATE_OPTION" = "--php" ] || [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then |
|||
ee_nginx_conf=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/basic.conf |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--basic" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ] || [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ] || [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
ee_nginx_conf=$(echo $EE_SITE_CREATE_OPTION | cut -c3-)/$(echo $EE_SITE_CACHE_OPTION | cut -c3-).conf |
|||
fi |
|||
ee_nginx_update_header=$(head -n1 /usr/share/easyengine/nginx/$ee_nginx_conf | grep "NGINX CONFIGURATION") |
|||
|
|||
# Echo values |
|||
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_update_header = $ee_nginx_update_header" &>> $EE_COMMAND_LOG |
|||
|
|||
# Update Head Line of NGINX conf |
|||
sed -i "s'$ee_nginx_current_header'$ee_nginx_update_header'" /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? |
|||
|
|||
# Update NGINX conf for HTML site |
|||
if [ "$EE_SITE_CURRENT_TYPE" = "--html" ]; then |
|||
sed -i 's/access\.log/access.log rt_cache/' /etc/nginx/sites-available/$EE_DOMAIN && \ |
|||
sed -i '/index index.html index.htm;$/c \\tindex index.php index.htm index.html;' /etc/nginx/sites-available/$EE_DOMAIN && \ |
|||
sed -i '/location \/ {/,/}/d ' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
|
|||
# Update HTML to PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) options |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--php" ] || [ "$EE_SITE_CREATE_OPTION" = "--mysql" ] || [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then |
|||
sed -i '/include common\/locations.conf/i \\tinclude common\/php.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
# Update HTML to --wpsc (--wp/--wpsubdir/--wpsubdomain) options |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
sed -i '/include common\/locations.conf/i \\tinclude common\/wpsc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
# Update HTML to --w3tc (--wp/--wpsubdir/--wpsubdomain) options |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then |
|||
sed -i '/include common\/locations.conf/i \\tinclude common\/w3tc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
# Update HTML to --wpfc (--wp/--wpsubdir/--wpsubdomain) options |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
sed -i '/include common\/locations.conf/i \\tinclude common\/wpfc.conf;' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
fi |
|||
|
|||
# Update PHP MySQL --basic (--wp/--wpsubdir/--wpsubdomain) to --wpsc --w3tc --wpfc options |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "--php" ] || [ "$EE_SITE_CURRENT_TYPE" = "--mysql" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wp --basic" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --basic" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --basic" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
sed -i 's/include common\/php.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then |
|||
sed -i 's/include common\/php.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
sed -i 's/include common\/php.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
fi |
|||
|
|||
# Update --wpsc (--wp/--wpsubdir/--wpsubdomain) to --basic --w3tc --wpfc options |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "--wp --wpsc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpsc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpsc" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then |
|||
sed -i 's/include common\/wpsc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then |
|||
sed -i 's/include common\/wpsc.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
sed -i 's/include common\/wpsc.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
fi |
|||
|
|||
# Update --w3tc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --wpfc options |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "--wp --w3tc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --w3tc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --w3tc" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then |
|||
sed -i 's/include common\/w3tc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
sed -i 's/include common\/w3tc.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpfc" ]; then |
|||
sed -i 's/include common\/w3tc.conf/include common\/wpfc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
fi |
|||
|
|||
# Update --wpfc (--wp/--wpsubdir/--wpsubdomain) to --basic --wpsc --w3tc options |
|||
elif [ "$EE_SITE_CURRENT_TYPE" = "--wp --wpfc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdir --wpfc" ] || [ "$EE_SITE_CURRENT_TYPE" = "--wpsubdomain --wpfc" ]; then |
|||
if [ "$EE_SITE_CACHE_OPTION" = "--basic" ]; then |
|||
sed -i 's/include common\/wpfc.conf/include common\/php.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--wpsc" ]; then |
|||
sed -i 's/include common\/wpfc.conf/include common\/wpsc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
elif [ "$EE_SITE_CACHE_OPTION" = "--w3tc" ]; then |
|||
sed -i 's/include common\/wpfc.conf/include common\/w3tc.conf/' /etc/nginx/sites-available/$EE_DOMAIN \ |
|||
|| ee_lib_error "Unable to update NGINX configuration to $EE_SITE_CREATE_OPTION $EE_SITE_CACHE_OPTION, exit status =" $? |
|||
fi |
|||
fi |
|||
|
|||
# Add WordPress common file wpcommon.conf for HTML PHP & MYSQL sites |
|||
if [[ "$EE_SITE_CURRENT_TYPE" = "--html" || "$EE_SITE_CURRENT_TYPE" = "--php" || "$EE_SITE_CURRENT_TYPE" = "--mysql" ]] && \ |
|||
[[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ]]; then |
|||
sed -i '/include common\/locations.conf/i \\tinclude common\/wpcommon.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? |
|||
fi |
|||
|
|||
# Update server_name for HTML PHP MYSQL WP (single site) only |
|||
# Don't execute for WordPress Multisite |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ] \ |
|||
&& [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --basic" ] && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --basic" ] \ |
|||
&& [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpsc" ] && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpsc" ] \ |
|||
&& [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --w3tc" ] && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --w3tc" ] \ |
|||
&& [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdir --wpfc" ] && [ "$EE_SITE_CURRENT_TYPE" != "--wpsubdomain --wpfc" ]; then |
|||
|
|||
sed -i "s'server_name $EE_DOMAIN www.$EE_DOMAIN;'server_name $EE_DOMAIN *.$EE_DOMAIN;'" /etc/nginx/sites-available/$EE_DOMAIN && \ |
|||
sed -i '/server_name.*;/i \\t# Uncomment the following line for domain mapping;\n\t# listen 80 default_server;\n' /etc/nginx/sites-available/$EE_DOMAIN && \ |
|||
sed -i '/server_name.*;/a \\n\t# Uncomment the following line for domain mapping \n\t#server_name_in_redirect off;' /etc/nginx/sites-available/$EE_DOMAIN && \ |
|||
sed -i '/include common\/locations.conf/i \\tinclude common\/wpsubdir.conf;' /etc/nginx/sites-available/$EE_DOMAIN || ee_lib_error "Unable to update nginx configuration to $EE_SITE_CREATE_OPTION, $EE_SITE_CACHE_OPTION for $EE_DOMAIN, exit status =" $? |
|||
fi |
|||
else |
|||
ee_lib_error "Unable to find $EE_DOMAIN NGINX configuration, exit status =" $? |
|||
fi |
|||
} |
@ -1,90 +0,0 @@ |
|||
# Update Websites |
|||
|
|||
function ee_mod_update_website() { |
|||
# Let's take backup first |
|||
ee_mod_site_backup |
|||
|
|||
# Install required packages |
|||
ee_mod_site_packages |
|||
|
|||
# Let's start update |
|||
ee_mod_update_nginx |
|||
|
|||
# Setup MySQL database for HTML|PHP websites |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--mysql" ]; then |
|||
ee_mod_setup_database |
|||
|
|||
# Add Database Information On ee-config.php |
|||
echo -e "define('DB_NAME', '$EE_DB_NAME'); \ndefine('DB_USER', '$EE_DB_USER'); \ndefine('DB_PASSWORD', '$EE_DB_PASS'); \ndefine('DB_HOST', '$EE_MYSQL_HOST');" \ |
|||
&>> /var/www/$EE_DOMAIN/ee-config.php |
|||
fi |
|||
|
|||
# Use same database when update MySQL website updated to WordPress |
|||
if [ "$EE_SITE_CURRENT_TYPE" = "--mysql" ]; then |
|||
# Use same database for WordPress |
|||
EE_DB_NAME=$(grep DB_NAME $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) |
|||
EE_DB_USER=$(grep DB_USER $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) |
|||
EE_DB_PASS=$(grep DB_PASSWORD $(grep root /etc/nginx/sites-available/$EE_DOMAIN | awk '{ print $2 }' | sed 's/;//g' | sed "s'htdocs'backup/$EE_DATE/ee-config.php'" 2> /dev/null) | cut -d"'" -f4) |
|||
fi |
|||
|
|||
# Setup/Install WordPress for HTML|PHP|MySQL websites |
|||
if [[ "$EE_SITE_CURRENT_TYPE" = "--html" || "$EE_SITE_CURRENT_TYPE" = "--php" || "$EE_SITE_CURRENT_TYPE" = "--mysql" ]] && |
|||
[[ "$EE_SITE_CREATE_OPTION" = "--wp" || "$EE_SITE_CREATE_OPTION" = "--wpsubdir" || "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]]; then |
|||
# Setup WordPress |
|||
ee_mod_setup_wordpress |
|||
|
|||
# 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 |
|||
|
|||
# Update WordPress Websites |
|||
elif [[ "$EE_SITE_CURRENT_WP" = "--wp" || "$EE_SITE_CURRENT_WP" = "--wpsubdir" || "$EE_SITE_CURRENT_WP" = "--wpsubdomain" ]]; then |
|||
# Setup WordPress Network for --wp websites |
|||
if [[ "$EE_SITE_CURRENT_WP" = "--wp" ]]; then |
|||
if [ "$EE_SITE_CREATE_OPTION" = "--wpsubdir" ] || [ "$EE_SITE_CREATE_OPTION" = "--wpsubdomain" ]; then |
|||
ee_mod_setup_network |
|||
fi |
|||
fi |
|||
|
|||
# Uninstall unwanted plugins |
|||
# Current site type: --wp --wpsc |
|||
# Update site type: --wpsubdomain --wpsc |
|||
# Only delete plugin when current cache is --wpsc and update cache is not --wpsc |
|||
if [[ "$EE_SITE_CURRENT_CACHE" = "--wpsc" && "$EE_SITE_CACHE_OPTION" != "--wpsc" ]]; then |
|||
cd /var/www/$EE_DOMAIN/htdocs/ |
|||
ee_lib_echo "Unistalling WP Super Cache plugin, please wait..." |
|||
wp plugin --allow-root uninstall wp-super-cache &>> $EE_COMMAND_LOG |
|||
fi |
|||
|
|||
# Delete plugin when current cache is --w3tc|--wpfc and update cache is not --w3tc|--wpfc |
|||
if [[ "$EE_SITE_CURRENT_CACHE" = "--w3tc" || "$EE_SITE_CURRENT_CACHE" = "--wpfc" ]] && [[ "$EE_SITE_CACHE_OPTION" != "--w3tc" && "$EE_SITE_CACHE_OPTION" != "--wpfc" ]]; then |
|||
cd /var/www/$EE_DOMAIN/htdocs/ |
|||
ee_lib_echo "Uninstalling W3 Total Cache plugin, please wait..." |
|||
wp plugin --allow-root uninstall w3-total-cache &>> $EE_COMMAND_LOG |
|||
fi |
|||
|
|||
# Install WordPress plugins |
|||
# As nginx-helper is installed all type of WordPress |
|||
# We don't need to install it again |
|||
#ee_mod_plugin_nginx_helper |
|||
|
|||
if [[ "$EE_SITE_CURRENT_CACHE" != "--wpsc" && "$EE_SITE_CACHE_OPTION" = "--wpsc" ]]; then |
|||
ee_mod_plugin_wpsc |
|||
fi |
|||
|
|||
if [[ "$EE_SITE_CURRENT_CACHE" != "--w3tc" && "$EE_SITE_CURRENT_CACHE" != "--wpfc" ]] && [[ "$EE_SITE_CACHE_OPTION" = "--w3tc" || "$EE_SITE_CACHE_OPTION" = "--wpfc" ]]; then |
|||
ee_mod_plugin_w3tc |
|||
fi |
|||
|
|||
# Display WordPress cache plugin settings |
|||
ee_mod_plugin_settings |
|||
fi |
|||
|
|||
# Use this variable to detect and change ownership, reload nginx, |
|||
EE_UPDATE_WEBSITE="success" |
|||
} |
@ -1,2 +0,0 @@ |
|||
1. **install** - contains installation scripts for EasyEngine [ee] modules. ( ee stack install ) |
|||
1. **remove** - contains remove scripts for EasyEngine [ee] modules. ( ee stack remove ) |
@ -1,58 +0,0 @@ |
|||
# Execute: ee stack status |
|||
|
|||
function ee_mod_stack_status() |
|||
{ |
|||
# Detect operating system |
|||
local ee_operating_system=$(lsb_release -d | awk '{print $2,$3,$4}') |
|||
|
|||
# Detect system load and processes |
|||
local ee_system_load=$(cat /proc/loadavg | awk '{print $1}') |
|||
local ee_system_processes=$(ps ax | wc -l) |
|||
|
|||
# Uses of / partition and users logged in |
|||
local ee_logged_in_users=$(w -h | wc -l) |
|||
local ee_root_usage=$(df -h | grep /$ | head -1 | awk '{print $5}') |
|||
|
|||
# Memory uses |
|||
local ee_memory_total=$(free | grep Mem: | awk '{print $2}') |
|||
local ee_memory_used=$(free | grep Mem: | awk '{print $3}') |
|||
local ee_memory_buffers=$(free | grep Mem: | awk '{print $6}') |
|||
local ee_memory_cache=$(free | grep Mem: | awk '{print $7}') |
|||
local ee_memory_usage=$(echo "($ee_memory_used-$ee_memory_buffers-$ee_memory_cache)*100/$ee_memory_total" | bc -l | cut -d'.' -f1) |
|||
|
|||
# Swap uses |
|||
local ee_swap_total=$(free | grep Swap: | awk '{print $2}') |
|||
if [[ $ee_swap_total > 0 ]]; then |
|||
local ee_swap_used=$(free | grep Swap: | awk '{print $3}') |
|||
local ee_swap_usage=$(echo "scale=2; $ee_swap_used*100/$ee_swap_total" | bc -l)% |
|||
else |
|||
local ee_swap_usage=$(echo "N/A") |
|||
fi |
|||
|
|||
# Service status |
|||
local ee_nginx_status=$(service nginx status 2> /dev/null 2>> $EE_COMMAND_LOG| grep 'nginx is running' \ |
|||
&>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped") |
|||
local ee_php_status=$(service php5-fpm status 2> /dev/null | grep running \ |
|||
&>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped") |
|||
local ee_mysql_status=$(mysqladmin ping \ |
|||
&>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped") |
|||
local ee_postfix_status=$(service postfix status 2> /dev/null | grep 'postfix is running' \ |
|||
&>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped") |
|||
|
|||
ee_lib_echo |
|||
ee_lib_echo |
|||
ee_lib_echo_info " System information as of $(/bin/date)" |
|||
ee_lib_echo |
|||
ee_lib_echo_escape " System load:\t$ee_system_load\t\t Processes:\t\t$ee_system_processes" |
|||
ee_lib_echo_escape " Usage of /:\t$ee_root_usage\t\t Users logged in:\t$ee_logged_in_users" |
|||
ee_lib_echo_escape " Memory usage:\t$ee_memory_usage%\t\t Swap usage:\t\t$ee_swap_usage" |
|||
ee_lib_echo |
|||
ee_lib_echo_info " Service status information" |
|||
ee_lib_echo |
|||
ee_lib_echo_escape " Nginx:\t\t$ee_nginx_status" |
|||
ee_lib_echo_escape " PHP5-FPM:\t$ee_php_status" |
|||
ee_lib_echo_escape " MySQL:\t\t$ee_mysql_status" |
|||
ee_lib_echo_escape " Postfix:\t$ee_postfix_status" |
|||
ee_lib_echo |
|||
ee_lib_echo |
|||
} |
@ -1,9 +0,0 @@ |
|||
1. **ee_mod_install_mysql.sh** - Install MySQL package |
|||
1. **ee_mod_install_nginx.sh** - Install nginx package |
|||
1. **ee_mod_install_php.sh** - Install php5-fpm package |
|||
1. **ee_mod_install_postfix.sh** - Install Postfix package |
|||
1. **ee_mod_repo_nginx.sh** - Setup nginx repository |
|||
1. **ee_mod_repo_php.sh** - Setup php5-fpm repository |
|||
1. **ee_mod_setup_mysql.sh** - Setup MySQL |
|||
1. **ee_mod_setup_nginx.sh** - Setup nginx |
|||
1. **ee_mod_setup_php.sh** - Setup php5-fpm |
@ -1,31 +0,0 @@ |
|||
# Install MySQL package |
|||
|
|||
ee_mod_install_mysql() |
|||
{ |
|||
# Random characters |
|||
local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) |
|||
|
|||
# Check Percona MySQL is installed or not |
|||
ee_lib_package_check percona-server-server-5.6 |
|||
|
|||
# If Percona MySQL is not installed |
|||
# Then set random MySQL password for root user |
|||
if [ -n "$EE_PACKAGE_NAME" ]; then |
|||
|
|||
# Setting up MySQL password |
|||
debconf-set-selections <<< "percona-server-server-5.6 percona-server-server/root_password password $ee_random" |
|||
debconf-set-selections <<< "percona-server-server-5.6 percona-server-server/root_password_again password $ee_random" |
|||
|
|||
# Generate ~/.my.cnf |
|||
echo -e "[client]\nuser=root\npassword=$ee_random" > ~/.my.cnf |
|||
|
|||
fi |
|||
|
|||
ee_lib_echo "Installing Percona MySQL, please Wait..." |
|||
$EE_APT_GET install percona-server-server-5.6 mysqltuner percona-toolkit \ |
|||
|| ee_lib_error "Unable to install Percona MySQL, exit status = " $? |
|||
|
|||
# Download tuning-primer.sh |
|||
wget --no-check-certificate -cqO /usr/local/bin/tuning-primer.sh https://launchpadlibrarian.net/78745738/tuning-primer.sh |
|||
chmod a+x /usr/local/bin/tuning-primer.sh |
|||
} |
@ -1,8 +0,0 @@ |
|||
# Install nginx package |
|||
|
|||
function ee_mod_install_nginx() |
|||
{ |
|||
ee_lib_echo "Installing $EE_NGINX_PACKAGE, please wait..." |
|||
$EE_APT_GET install $EE_NGINX_PACKAGE \ |
|||
|| ee_lib_error "Unable to install $EE_NGINX_PACKAGE, exit status = " $? |
|||
} |
@ -1,9 +0,0 @@ |
|||
# Install php5-fpm package |
|||
|
|||
function ee_mod_install_php() |
|||
{ |
|||
ee_lib_echo "Installing PHP, please wait..." |
|||
$EE_APT_GET install php5-common php5-mysqlnd php5-xmlrpc \ |
|||
php5-curl php5-gd php5-cli php5-fpm php5-imap php5-mcrypt php5-xdebug \ |
|||
php5-memcache memcached php5-geoip 2>&1 || ee_lib_error "Unable to install PHP5, exit status = " $? |
|||
} |
@ -1,12 +0,0 @@ |
|||
# Install Postfix package |
|||
|
|||
function ee_mod_install_postfix() |
|||
{ |
|||
# Setup Postfix |
|||
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" |
|||
debconf-set-selections <<< "postfix postfix/mailname string $(hostname -f)" |
|||
|
|||
# Install Postfix |
|||
ee_lib_echo "Installing Postfix, please wait..." |
|||
$EE_APT_GET install postfix || ee_lib_error "Unable to install Postfix, exit status = " $? |
|||
} |
@ -1,14 +0,0 @@ |
|||
# Setup Percona repository |
|||
|
|||
function ee_mod_repo_mysql() |
|||
{ |
|||
# Add Percona repository |
|||
ee_lib_echo "Adding Percona repository, please wait..." |
|||
echo "deb http://repo.percona.com/apt $(lsb_release -sc) main" > /etc/apt/sources.list.d/percona-$(lsb_release -sc).list \ |
|||
|| ee_lib_error "Unable to add Percona repository, exit status = " $? |
|||
|
|||
# Fetch and install Percona GnuPG key |
|||
gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A &>> $EE_COMMAND_LOG && \ |
|||
gpg -a --export CD2EFD2A | sudo apt-key add - &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to add Percona GnuPG key, exit status = " $? |
|||
} |
@ -1,26 +0,0 @@ |
|||
# Setup nginx repository |
|||
|
|||
function ee_mod_repo_nginx() |
|||
{ |
|||
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then |
|||
|
|||
# Add rtCamp nginx launchpad repository |
|||
ee_lib_echo "Adding rtCamp NGINX launchpad repository, please wait..." |
|||
add-apt-repository -y ppa:rtcamp/nginx &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to add rtCamp NGINX launchpad repository, exit status = " $? |
|||
|
|||
elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then |
|||
|
|||
# Add Dotdeb nginx repository |
|||
ee_lib_echo "Adding Dotdeb NGINX repository, please wait..." |
|||
echo "deb http://packages.dotdeb.org $(lsb_release -sc) all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -sc).list \ |
|||
|| ee_lib_error "Unable to add Dotdeb NGINX repository, exit status = " $? |
|||
|
|||
# Fetch and install dotdeb GnuPG key |
|||
ee_lib_dotdeb |
|||
|
|||
# Dotdeb nginx repository doesn't support spdy |
|||
sed -i "s/ spdy//;" /usr/share/easyengine/nginx/22222 |
|||
|
|||
fi |
|||
} |
@ -1,34 +0,0 @@ |
|||
# Setup php5-fpm repository |
|||
|
|||
function ee_mod_repo_php() |
|||
{ |
|||
# Ubuntu |
|||
if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then |
|||
|
|||
# Add ondrej php5 launchpad repository |
|||
ee_lib_echo "Adding Ondrej PHP5 launchpad repository, please wait..." |
|||
add-apt-repository -y ppa:ondrej/php5 &>> $EE_COMMAND_LOG \ |
|||
|| ee_lib_error "Unable to add ondrej php5 launchpad repository, exit status = " $? |
|||
|
|||
# Debian 6 |
|||
elif [ "$EE_DEBIAN_VERSION" == "squeeze" ]; then |
|||
|
|||
ee_lib_echo "Adding Dotdeb PHP5.4 repository, please wait..." |
|||
echo "deb http://packages.dotdeb.org $(lsb_release -sc)-php54 all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -sc)-php54.list \ |
|||
|| ee_lib_error "Unable to add Dotdeb PHP5.4 repository, exit status = " $? |
|||
|
|||
# Fetch and install Dotdeb GnuPG key |
|||
ee_lib_dotdeb |
|||
|
|||
# Debian 7 |
|||
elif [ "$EE_DEBIAN_VERSION" == "wheezy" ]; then |
|||
|
|||
ee_lib_echo "Adding Dotdeb PHP5.5 repository, please wait..." |
|||
echo "deb http://packages.dotdeb.org $(lsb_release -sc)-php55 all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -sc)-php55.list \ |
|||
|| ee_lib_error "Unable to add Dotdeb PHP5.5 repository, exit status = " $? |
|||
|
|||
# Fetch and install dotdeb GnuPG key |
|||
ee_lib_dotdeb |
|||
|
|||
fi |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue