Merge pull request #67 from WordOps/updating-configuration

Updating configuration
This commit is contained in:
VirtuBox
2019-04-24 13:39:17 +02:00
committed by GitHub
12 changed files with 198 additions and 75 deletions

View File

@@ -27,7 +27,7 @@ script:
- sudo echo "Travis Banch = $TRAVIS_BRANCH" - sudo echo "Travis Banch = $TRAVIS_BRANCH"
- sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt ccze tree - sudo apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt ccze tree
- sudo bash install -b $TRAVIS_BRANCH --travis - sudo bash install -b $TRAVIS_BRANCH --travis
- sudo wo --help && sudo wo stack install && sudo wo stack install --admin - sudo wo --help && sudo wo stack install
- sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql || sudo tail -n50 /var/log/wo/wordops.log
- sudo wo site create proxy.com --proxy=127.0.0.1:3000 || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create proxy.com --proxy=127.0.0.1:3000 || sudo tail -n50 /var/log/wo/wordops.log
@@ -49,15 +49,10 @@ script:
- sudo wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc && sudo wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc && sudo wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc && sudo wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc && sudo wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain || sudo tail -n50 /var/log/wo/wordops.log
- sudo wo site create 1.com --html || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site create 1.com --html && sudo wo site create 2.com --php && sudo wo site create 3.com --mysql || sudo tail -n50 /var/log/wo/wordops.log
- sudo wo site create 2.com --php || sudo tail -n50 /var/log/wo/wordops.log - sudo wo site update 1.com --wp && sudo wo site update 2.com --php73 && sudo wo site update 3.com --php73 && sudo wo site update 1.com --wpfc && sudo wo site update 1.com --wpsc && sudo wo site update 1.com --wpredis || sudo tail -n50 /var/log/wo/wordops.log
- sudo wo site create 3.com --mysql || sudo tail -n50 /var/log/wo/wordops.log
- sudo wo site update 1.com --wp || sudo tail -n50 /var/log/wo/wordops.log
- sudo wo site update 2.com --php73 || sudo tail -n50 /var/log/wo/wordops.log
- sudo wo site update 3.com --php73 || sudo tail -n50 /var/log/wo/wordops.log
- sudo ls /var/www/ - sudo ls /var/www/
- sudo ls /var/www/22222/htdocs/
- sudo wp --allow-root --info - sudo wp --allow-root --info
- sudo wo info || sudo tail -n50 /var/log/wo/wordops.log - sudo wo info || sudo tail -n50 /var/log/wo/wordops.log
- sudo tree -L 2 /etc/nginx - sudo tree -L 2 /etc/nginx

View File

@@ -30,6 +30,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- additional argument for letsencrypt : --hsts - additional argument for letsencrypt : --hsts
- Theme for adminer - Theme for adminer
- Credits for tools shipped with WordOps - Credits for tools shipped with WordOps
- Cache exception for Easy Digital Download
- Additional cache exception for Woocommerce
- MySQL monitoring with Netdata
- WordOps-dashboard on 22222
- Extplorer filemanager
#### Changed #### Changed
@@ -41,6 +46,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Increase MySQL users password size to 16 characters - Increase MySQL users password size to 16 characters
- Nginx locations template is the same for php7.2 & 7.3 - Nginx locations template is the same for php7.2 & 7.3
- backend SSL configuration now stored in /var/www/22222/conf/nginx/ssl.conf - backend SSL configuration now stored in /var/www/22222/conf/nginx/ssl.conf
- Install Netdata with static pre-built binaries instead of having to compile it from source
- Nginx updated to new stable release (1.16.0)
#### Fixed #### Fixed
@@ -59,6 +66,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- command "wo clean --memcached" - command "wo clean --memcached"
- phpredisadmin setup - phpredisadmin setup
- --hsts flag with basic html site - --hsts flag with basic html site
- hsts flag on site not secure with letsencrypt
### v3.9.4 - 2019-03-15 ### v3.9.4 - 2019-03-15

View File

@@ -39,7 +39,7 @@
- **Easy to install** : One step automated installer with migration from EasyEngine v3 support - **Easy to install** : One step automated installer with migration from EasyEngine v3 support
- **Fast deployment** : Fast and automated WordPress, Nginx, PHP, MySQL & Redis installation - **Fast deployment** : Fast and automated WordPress, Nginx, PHP, MySQL & Redis installation
- **Up-to-date** : Nginx 1.14.2 with Brotli support, PHP 7.2 & 7.3, MariaDB 10.3 & Redis 5.0 - **Up-to-date** : Nginx 1.16.0 with Brotli support, PHP 7.2 & 7.3, MariaDB 10.3 & Redis 5.0
- **Secured** : Hardened WordPress security with strict Nginx location directives - **Secured** : Hardened WordPress security with strict Nginx location directives
- **Powerful** : Optimized Nginx configurations with multiple cache backends support - **Powerful** : Optimized Nginx configurations with multiple cache backends support
- **SSL** : Let's Encrypt SSL certificates handled by acme.sh - **SSL** : Let's Encrypt SSL certificates handled by acme.sh
@@ -76,7 +76,7 @@ WordOps made some fundamental changes:
- We've deprecated the mail stack. As an alternative, you can take a look at [Mail-in-a-Box](https://github.com/mail-in-a-box/mailinabox), [iRedMail](https://www.iredmail.org/) or [Caesonia](https://github.com/vedetta-com/caesonia). As Roundcube alternative, there is [Rainloop](https://www.rainloop.net/) or [Afterlogic WebMail](https://github.com/afterlogic/webmail-lite-8) - We've deprecated the mail stack. As an alternative, you can take a look at [Mail-in-a-Box](https://github.com/mail-in-a-box/mailinabox), [iRedMail](https://www.iredmail.org/) or [Caesonia](https://github.com/vedetta-com/caesonia). As Roundcube alternative, there is [Rainloop](https://www.rainloop.net/) or [Afterlogic WebMail](https://github.com/afterlogic/webmail-lite-8)
- Support for w3tc is dropped as a security precaution. - Support for w3tc is dropped as a security precaution.
- PHP 5.6 has been replaced by PHP 7.2 and PHP 7.0 has been replaced by PHP 7.3. - PHP 5.6 has been replaced by PHP 7.2 and PHP 7.0 has been replaced by PHP 7.3.
- Nginx-ee package has been replaced by Nginx-wo (based on Nginx stable v1.14.2 with Brotli support) - Nginx-ee package has been replaced by Nginx-wo (based on Nginx stable v1.16.0 with Brotli support)
- HHVM stack has been removed - HHVM stack has been removed
- Let's Encrypt stack isn't based on letsencrypt-auto anymore, we use acme.sh to handle SSL certificates - Let's Encrypt stack isn't based on letsencrypt-auto anymore, we use acme.sh to handle SSL certificates
@@ -153,16 +153,18 @@ There is no need to be a developer or a system administrator to contribute to Wo
- Source : [EasyEngine](https://github.com/easyengine/easyengine) - Source : [EasyEngine](https://github.com/easyengine/easyengine)
Shipped with WordOps Apps & Tools shipped with WordOps
- Acme client : [Acme.sh](https://github.com/Neilpang/acme.sh) - [Acme.sh](https://github.com/Neilpang/acme.sh)
- WordPress deployment : [WP-CLI](https://github.com/wp-cli/wp-cli) - [WP-CLI](https://github.com/wp-cli/wp-cli)
- Monitoring : [Netdata](https://github.com/netdata/netdata) - [Netdata](https://github.com/netdata/netdata)
- [phpMyAdmin](https://www.phpmyadmin.net/) - [phpMyAdmin](https://www.phpmyadmin.net/)
- [Composer](https://github.com/composer/composer)
- [Adminer](https://www.adminer.org/) - [Adminer](https://www.adminer.org/)
- [phpRedisAdmin](https://github.com/erikdubbelboer/phpRedisAdmin) - [phpRedisAdmin](https://github.com/erikdubbelboer/phpRedisAdmin)
- [PHPMemcachedAdmin](https://github.com/elijaa/phpmemcachedadmin) - [PHPMemcachedAdmin](https://github.com/elijaa/phpmemcachedadmin)
- [opcacheGUI](https://github.com/amnuts/opcache-gui) - [opcacheGUI](https://github.com/amnuts/opcache-gui)
- [eXtplorer](https://github.com/soerennb/extplorer)
## License ## License

View File

@@ -7,10 +7,10 @@
# Copyright (c) 2019 - WordOps # Copyright (c) 2019 - WordOps
# This script is licensed under M.I.T # This script is licensed under M.I.T
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Version 3.9.5 - 2019-04-14 # Version 3.9.5 - 2019-04-22
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
readonly wo_version_old="2.2.3" readonly wo_version_old="2.2.3"
readonly wo_version_new="3.9.4.5" readonly wo_version_new="3.9.4.6"
# CONTENTS # CONTENTS
# --- # ---
# 1. VARIABLES AND DECLARATIONS # 1. VARIABLES AND DECLARATIONS
@@ -93,8 +93,8 @@ echo ""
# 1- Update the apt sewers with fresh info # 1- Update the apt sewers with fresh info
### ###
[ -z "$wo_travis" ] && { [ -z "$wo_travis" ] && {
wo_lib_echo "Updating apt-get repository info" wo_lib_echo "Updating apt-get repository info"
apt-get update -qq apt-get update -qq
} }
### ###

View File

@@ -46,7 +46,8 @@ except Exception as e:
while not re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", while not re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$",
wo_email): wo_email):
print("Whoops, seems like you made a typo - the e-mailaddress is invalid...") print("Whoops, seems like you made a typo - "
"the e-mailaddress is invalid...")
wo_email = input("Enter your email: ") wo_email = input("Enter your email: ")
os.system("git config --global user.name {0}".format(wo_user)) os.system("git config --global user.name {0}".format(wo_user))

View File

@@ -50,7 +50,7 @@ class WOSecureController(CementBaseController):
"""This function secures authentication""" """This function secures authentication"""
passwd = ''.join([random.choice passwd = ''.join([random.choice
(string.ascii_letters + string.digits) (string.ascii_letters + string.digits)
for n in range(16)]) for n in range(24)])
if not self.app.pargs.user_input: if not self.app.pargs.user_input:
username = input("Provide HTTP authentication user " username = input("Provide HTTP authentication user "
"name [{0}] :".format(WOVariables.wo_user)) "name [{0}] :".format(WOVariables.wo_user))
@@ -93,16 +93,10 @@ class WOSecureController(CementBaseController):
Log.info(self, "Please Enter valid port number :") Log.info(self, "Please Enter valid port number :")
port = input("WordOps admin port [22222]:") port = input("WordOps admin port [22222]:")
self.app.pargs.user_input = port self.app.pargs.user_input = port
if WOVariables.wo_platform_distro == 'ubuntu': WOShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen "
WOShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen " "{port} default_server ssl http2;/\" "
"{port} default_server ssl http2;/\" " "/etc/nginx/sites-available/22222"
"/etc/nginx/sites-available/22222" .format(port=self.app.pargs.user_input))
.format(port=self.app.pargs.user_input))
if WOVariables.wo_platform_distro == 'debian':
WOShellExec.cmd_exec(self, "sed -i \"s/listen.*/listen "
"{port} default_server ssl http2;/\" "
"/etc/nginx/sites-available/22222"
.format(port=self.app.pargs.user_input))
WOGit.add(self, ["/etc/nginx"], WOGit.add(self, ["/etc/nginx"],
msg="Adding changed secure port into Git") msg="Adding changed secure port into Git")
if not WOService.reload_service(self, 'nginx'): if not WOService.reload_service(self, 'nginx'):

View File

@@ -673,22 +673,14 @@ class WOSiteCreateController(CementBaseController):
"`tail /var/log/wo/wordops.log` and please try again") "`tail /var/log/wo/wordops.log` and please try again")
if self.app.pargs.letsencrypt == "on": if self.app.pargs.letsencrypt == "on":
if self.app.pargs.hsts: data['letsencrypt'] = True
data['letsencrypt'] = True letsencrypt = True
letsencrypt = True
data['hsts'] = True
hsts = True
else:
data['letsencrypt'] = True
letsencrypt = True
data['hsts'] = False
hsts = False
if data['letsencrypt'] is True: if data['letsencrypt'] is True:
setupLetsEncrypt(self, wo_domain) setupLetsEncrypt(self, wo_domain)
httpsRedirect(self, wo_domain) httpsRedirect(self, wo_domain)
if data['hsts'] is True: if self.app.pargs.hsts:
setupHsts(self, wo_domain) setupHsts(self, wo_domain)
if not WOService.reload_service(self, 'nginx'): if not WOService.reload_service(self, 'nginx'):
@@ -713,15 +705,11 @@ class WOSiteCreateController(CementBaseController):
data['letsencrypt'] = True data['letsencrypt'] = True
letsencrypt = True letsencrypt = True
if self.app.pargs.hsts == 'on':
data['hsts'] = True
hsts = True
if data['letsencrypt'] is True: if data['letsencrypt'] is True:
setupLetsEncryptSubdomain(self, wo_domain) setupLetsEncryptSubdomain(self, wo_domain)
httpsRedirect(self, wo_domain) httpsRedirect(self, wo_domain)
if data['hsts'] is True: if self.app.pargs.hsts:
setupHsts(self, wo_domain) setupHsts(self, wo_domain)
if not WOService.reload_service(self, 'nginx'): if not WOService.reload_service(self, 'nginx'):
@@ -902,7 +890,8 @@ class WOSiteUpdateController(CementBaseController):
if (pargs.hsts and not (pargs.html or if (pargs.hsts and not (pargs.html or
pargs.php or pargs.php73 or pargs.mysql or pargs.php or pargs.php73 or pargs.mysql or
pargs.wp or pargs.wpfc or pargs.wpsc or pargs.wp or pargs.wpfc or pargs.wpsc or
pargs.wpsubdir or pargs.wpsubdomain)): pargs.wpsubdir or pargs.wpsubdomain or
pargs.password)):
try: try:
setupHsts(self, wo_domain) setupHsts(self, wo_domain)
except SiteError as e: except SiteError as e:
@@ -918,8 +907,8 @@ class WOSiteUpdateController(CementBaseController):
'proxy', 'wp', 'php73']) or 'proxy', 'wp', 'php73']) or
(stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or
(stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or
(stype == oldsitetype and cache == oldcachetype) and (stype == oldsitetype and cache == oldcachetype) and not
not pargs.php73 or pargs.hsts): (pargs.php73 or pargs.hsts or pargs.letsencrypt)):
Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}".
format(oldsitetype, oldcachetype, stype, cache)) format(oldsitetype, oldcachetype, stype, cache))
return 1 return 1

View File

@@ -68,6 +68,8 @@ class WOStackController(CementBaseController):
(['--netdata'], (['--netdata'],
dict(help='Install Netdata monitoring suite', dict(help='Install Netdata monitoring suite',
action='store_true')), action='store_true')),
(['--dashboard'],
dict(help='Install WordOps dashboard', action='store_true')),
(['--adminer'], (['--adminer'],
dict(help='Install Adminer stack', action='store_true')), dict(help='Install Adminer stack', action='store_true')),
(['--utils'], (['--utils'],
@@ -519,7 +521,8 @@ class WOStackController(CementBaseController):
else: else:
self.msg = (self.msg + ["HTTP Auth User " self.msg = (self.msg + ["HTTP Auth User "
"Name: WordOps"] + "Name: WordOps"] +
["HTTP Auth Password : {0}".format(passwd)]) ["HTTP Auth Password : {0}"
.format(passwd)])
else: else:
WOService.restart_service(self, 'nginx') WOService.restart_service(self, 'nginx')
@@ -1014,7 +1017,8 @@ class WOStackController(CementBaseController):
if len(packages): if len(packages):
if any('/usr/local/bin/wp' == x[1] for x in packages): if any('/usr/local/bin/wp' == x[1] for x in packages):
Log.debug(self, "Setting Privileges to /usr/local/bin/wp file ") Log.debug(self, "Setting Privileges"
" to /usr/local/bin/wp file ")
WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775) WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
if any('/tmp/pma.tar.gz' == x[1] if any('/tmp/pma.tar.gz' == x[1]
@@ -1029,8 +1033,7 @@ class WOStackController(CementBaseController):
.format(WOVariables.wo_webroot)) .format(WOVariables.wo_webroot))
os.makedirs('{0}22222/htdocs/db' os.makedirs('{0}22222/htdocs/db'
.format(WOVariables.wo_webroot)) .format(WOVariables.wo_webroot))
if not os.path.exists('{0}22222/htdocs/db/' if not os.path.exists('{0}22222/htdocs/db/pma/'
'pma/phpmyadmin-STABLE'
.format(WOVariables.wo_webroot)): .format(WOVariables.wo_webroot)):
shutil.move('/tmp/phpmyadmin-STABLE/', shutil.move('/tmp/phpmyadmin-STABLE/',
'{0}22222/htdocs/db/pma/' '{0}22222/htdocs/db/pma/'
@@ -1069,13 +1072,12 @@ class WOStackController(CementBaseController):
"[\'Servers\'][$i][\'host\'] = \'{0}\';" "[\'Servers\'][$i][\'host\'] = \'{0}\';"
.format(WOVariables.wo_mysql_host)) .format(WOVariables.wo_mysql_host))
Log.debug(self, 'Setting Privileges of webroot permission to ' Log.debug(self, 'Setting Privileges of webroot permission to '
'{0}22222/htdocs/db/pma file ' '{0}22222/htdocs/db/pma file '.format(WOVariables.wo_webroot))
.format(WOVariables.wo_webroot)) WOFileUtils.chown(self, '{0}22222'.format(WOVariables.wo_webroot),
WOFileUtils.chown(self, '{0}22222'
.format(WOVariables.wo_webroot),
WOVariables.wo_php_user, WOVariables.wo_php_user,
WOVariables.wo_php_user, WOVariables.wo_php_user,
recursive=True) recursive=True)
# composer install and phpmyadmin update # composer install and phpmyadmin update
if any('/tmp/composer-install' == x[1] if any('/tmp/composer-install' == x[1]
for x in packages): for x in packages):
@@ -1092,16 +1094,85 @@ class WOStackController(CementBaseController):
# netdata install # netdata install
if any('/tmp/kickstart.sh' == x[1] if any('/tmp/kickstart.sh' == x[1]
for x in packages): for x in packages):
if not os.path.exists('/etc/netdata'): if ((not os.path.exists('/opt/netdata')) and
(not os.path.exists('/etc/netdata'))):
Log.info(self, "Installing Netdata, please wait...") Log.info(self, "Installing Netdata, please wait...")
WOShellExec.cmd_exec(self, "bash /tmp/kickstart.sh " WOShellExec.cmd_exec(self, "bash /tmp/kickstart.sh "
"--dont-wait --no-updates") "--dont-wait")
WOFileUtils.searchreplace(self, "/usr/lib/netdata/conf.d/" # disable mail notifications
"health_alarm_notify.conf", WOFileUtils.searchreplace(self, "/opt/netdata/usr/"
'SEND_EMAIL="YES"', "lib/netdata/conf.d/"
'SEND_EMAIL="NO"') "health_alarm_notify.conf",
WOService.restart_service(self, 'netdata') 'SEND_EMAIL="YES"',
'SEND_EMAIL="NO"')
# check if mysql credentials are available
if os.path.isfile('/etc/mysql/conf.d/my.cnf'):
try:
WOMysql.execute(self,
"create user "
"'netdata'@'localhost';",
log=False)
WOMysql.execute(self,
"grant usage on *.* to "
"'netdata'@'localhost';",
log=False)
WOMysql.execute(self,
"flush privileges;",
log=False)
except StatementExcecutionError as e:
Log.info(
self, "fail to setup mysql user for netdata")
WOService.restart_service(self, 'netdata')
# WordOps Dashboard
if any('/tmp/wo-dashboard.tar.gz' == x[1]
for x in packages):
if not os.path.isfile('{0}22222/htdocs/index.php'
.format(WOVariables.wo_webroot)):
Log.debug(self, "Extracting wo-dashboard.tar.gz "
"to location {0}22222/htdocs/"
.format(WOVariables.wo_webroot))
WOExtract.extract(self, '/tmp/wo-dashboard.tar.gz',
'{0}22222/htdocs'
.format(WOVariables.wo_webroot))
if WOVariables.wo_wan_interface != 'eth0':
WOFileUtils.searchreplace(self, "{0}22222/htdocs/index.php"
.format(WOVariables.wo_webroot),
"eth0",
"{0}".format(WOVariables.wo_wan_interface))
Log.debug(self, "Setting Privileges to "
"{0}22222/htdocs"
.format(WOVariables.wo_webroot))
WOFileUtils.chown(self, '{0}22222'
.format(WOVariables.wo_webroot),
WOVariables.wo_php_user,
WOVariables.wo_php_user,
recursive=True)
# Extplorer FileManager
if any('/tmp/extplorer.tar.gz' == x[1]
for x in packages):
if not os.path.exists('{0}22222/htdocs/files'
.format(WOVariables.wo_webroot)):
Log.debug(self, "Extracting explorer.tar.gz "
"to location {0}22222/htdocs/files"
.format(WOVariables.wo_webroot))
WOExtract.extract(self, '/tmp/extplorer.tar.gz',
'/tmp/')
shutil.move('/tmp/extplorer-2.1.11/',
'{0}22222/htdocs/files'
.format(WOVariables.wo_webroot))
Log.debug(self, "Setting Privileges to "
"{0}22222/htdocs/files"
.format(WOVariables.wo_webroot))
WOFileUtils.chown(self, '{0}22222'
.format(WOVariables.wo_webroot),
WOVariables.wo_php_user,
WOVariables.wo_php_user,
recursive=True)
# phpmemcachedadmin
if any('/tmp/memcached.tar.gz' == x[1] if any('/tmp/memcached.tar.gz' == x[1]
for x in packages): for x in packages):
Log.debug(self, "Extracting memcached.tar.gz to location" Log.debug(self, "Extracting memcached.tar.gz to location"
@@ -1188,7 +1259,8 @@ class WOStackController(CementBaseController):
' *.* to \'anemometer\'' ' *.* to \'anemometer\''
'@\'{0}\' IDENTIFIED' '@\'{0}\' IDENTIFIED'
' BY \'{1}\''.format(self.app.config.get ' BY \'{1}\''.format(self.app.config.get
('mysql', 'grant-host'), ('mysql',
'grant-host'),
chars)) chars))
Log.debug(self, "grant all on slow-query-log.*" Log.debug(self, "grant all on slow-query-log.*"
" to anemometer@root_user" " to anemometer@root_user"
@@ -1216,7 +1288,7 @@ class WOStackController(CementBaseController):
if any('/usr/bin/pt-query-advisor' == x[1] if any('/usr/bin/pt-query-advisor' == x[1]
for x in packages): for x in packages):
WOFileUtils.chmod(self, "/usr/bin/pt-query-advisor", 0o775) WOFileUtils.chmod(self, "/usr/bin/pt-query-advisor", 0o775)
# ph
if any('/tmp/pra.tar.gz' == x[1] if any('/tmp/pra.tar.gz' == x[1]
for x in packages): for x in packages):
if not os.path.exists('{0}22222/htdocs/cache/redis' if not os.path.exists('{0}22222/htdocs/cache/redis'
@@ -1254,6 +1326,7 @@ class WOStackController(CementBaseController):
(not self.app.pargs.phpmyadmin) and (not self.app.pargs.phpmyadmin) and
(not self.app.pargs.composer) and (not self.app.pargs.composer) and
(not self.app.pargs.netdata) and (not self.app.pargs.netdata) and
(not self.app.pargs.dashboard) and
(not self.app.pargs.adminer) and (not self.app.pargs.utils) and (not self.app.pargs.adminer) and (not self.app.pargs.utils) and
(not self.app.pargs.redis) and (not self.app.pargs.redis) and
(not self.app.pargs.phpredisadmin) and (not self.app.pargs.phpredisadmin) and
@@ -1280,7 +1353,9 @@ class WOStackController(CementBaseController):
self.app.pargs.composer = True self.app.pargs.composer = True
self.app.pargs.utils = True self.app.pargs.utils = True
self.app.pargs.netdata = True self.app.pargs.netdata = True
self.app.pargs.dashboard = True
# Redis
if self.app.pargs.redis: if self.app.pargs.redis:
if not WOAptGet.is_installed(self, 'redis-server'): if not WOAptGet.is_installed(self, 'redis-server'):
apt_packages = apt_packages + WOVariables.wo_redis apt_packages = apt_packages + WOVariables.wo_redis
@@ -1288,6 +1363,7 @@ class WOStackController(CementBaseController):
else: else:
Log.info(self, "Redis already installed") Log.info(self, "Redis already installed")
# Nginx
if self.app.pargs.nginx: if self.app.pargs.nginx:
Log.debug(self, "Setting apt_packages variable for Nginx") Log.debug(self, "Setting apt_packages variable for Nginx")
@@ -1369,11 +1445,16 @@ class WOStackController(CementBaseController):
# PHPMYADMIN # PHPMYADMIN
if self.app.pargs.phpmyadmin: if self.app.pargs.phpmyadmin:
Log.debug(self, "Setting packages variable for phpMyAdmin ") Log.debug(self, "Setting packages variable for phpMyAdmin ")
packages = packages + [["https://github.com/phpmyadmin/" if (not self.app.pargs.composer):
"phpmyadmin/archive/STABLE.tar.gz", packages = packages + [["https://github.com/phpmyadmin/"
"/tmp/pma.tar.gz", "phpMyAdmin"], "phpmyadmin/archive/STABLE.tar.gz",
["https://getcomposer.org/installer", "/tmp/pma.tar.gz", "phpMyAdmin"],
"/tmp/composer-install", "Composer"]] ["https://getcomposer.org/installer",
"/tmp/composer-install", "Composer"]]
else:
packages = packages + [["https://github.com/phpmyadmin/"
"phpmyadmin/archive/STABLE.tar.gz",
"/tmp/pma.tar.gz", "phpMyAdmin"]]
# Composer # Composer
if self.app.pargs.composer: if self.app.pargs.composer:
Log.debug(self, "Setting packages variable for Composer ") Log.debug(self, "Setting packages variable for Composer ")
@@ -1411,10 +1492,24 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting packages variable for Netdata") Log.debug(self, "Setting packages variable for Netdata")
if not os.path.exists('/opt/netdata'): if not os.path.exists('/opt/netdata'):
packages = packages + [['https://my-netdata.io/' packages = packages + [['https://my-netdata.io/'
'kickstart.sh', 'kickstart-static64.sh',
'/tmp/kickstart.sh', '/tmp/kickstart.sh',
'Netdata']] 'Netdata']]
# WordOps Dashboard
if self.app.pargs.dashboard:
Log.debug(self, "Setting packages variable for WO-Dashboard")
packages = packages + \
[["https://github.com/WordOps/"
"wordops-dashboard/releases/"
"download/v1.0/wo-dashboard.tar.gz",
"/tmp/wo-dashboard.tar.gz",
"WordOps Dashboard"],
["https://github.com/soerennb/"
"extplorer/archive/v2.1.11.tar.gz",
"/tmp/extplorer.tar.gz",
"eXtplorer"]]
# UTILS # UTILS
if self.app.pargs.utils: if self.app.pargs.utils:
Log.debug(self, "Setting packages variable for utils") Log.debug(self, "Setting packages variable for utils")
@@ -1706,7 +1801,8 @@ class WOStackController(CementBaseController):
Log.debug(self, "Purge apt_packages variable of Nginx") Log.debug(self, "Purge apt_packages variable of Nginx")
apt_packages = apt_packages + WOVariables.wo_nginx apt_packages = apt_packages + WOVariables.wo_nginx
else: else:
Log.error(self, "Cannot Purge! Nginx Stable version not found.") Log.error(self, "Cannot Purge! "
"Nginx Stable version not found.")
# PHP # PHP
if self.app.pargs.php: if self.app.pargs.php:

View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
# Kernel tweak script launched by kerneltweak systemd service
# script path after installation /opt/kerneltweaks.sh
echo 1 >/sys/kernel/mm/ksm/run
echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs
echo never > /sys/kernel/mm/transparent_hugepage/enabled

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Linux kernel tweaks
# append here other services you want netdata to wait for them to start
After=network.target
[Service]
Type=simple
User=root
ExecStart=/opt/kerneltweaks.sh
[Install]
WantedBy=multi-user.target

View File

@@ -19,6 +19,7 @@ map $http_cookie $cookie_no_cache {
"~*woocommerce_cart_hash" 1; "~*woocommerce_cart_hash" 1;
"~*wptouch_switch_toogle" 1; "~*wptouch_switch_toogle" 1;
"~*comment_author_email_" 1; "~*comment_author_email_" 1;
"~*edd" 1;
} }
# do not cache the following uri # do not cache the following uri
@@ -33,6 +34,16 @@ map $request_uri $uri_no_cache {
"~*/wp-comments-popup.php" 1; "~*/wp-comments-popup.php" 1;
"~*/wp-links-opml.php" 1; "~*/wp-links-opml.php" 1;
"~*/xmlrpc.php" 1; "~*/xmlrpc.php" 1;
"~*/checkout" 1;
"~*/edd_action" 1;
"~*/add_to_cart/" 1;
"~*/cart/" 1;
"~*/my-account/" 1;
"~*/checkout/" 1;
"~*/addons/" 1;
"~*/wc-api/*" 1;
"~*/logout/" 1;
"~*/lost-password/" 1;
} }
# do not cache requests with query strings # do not cache requests with query strings
@@ -49,6 +60,6 @@ map $http_request_no_cache$cookie_no_cache$uri_no_cache$query_no_cache $skip_cac
# map $skip_cache with $cache_uri for --wpsc stack # map $skip_cache with $cache_uri for --wpsc stack
map $skip_cache $cache_uri { map $skip_cache $cache_uri {
default 'null cache';
0 $request_uri; 0 $request_uri;
default 'null cache';
} }

View File

@@ -22,6 +22,13 @@ class WOVariables():
if wo_wpcli_path == '': if wo_wpcli_path == '':
wo_wpcli_path = '/usr/local/bin/wp ' wo_wpcli_path = '/usr/local/bin/wp '
# get wan network interface name
wo_wan_interface = os.popen("ip -4 route get 8.8.8.8 | "
"grep -oP \"dev [^[:space:]]+ \" "
"| cut -d ' ' -f 2").read()
if wo_wan_interface == '':
wo_wan_interface = 'eth0'
# Current date and time of System # Current date and time of System
wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S') wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S')