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 apt-get install -y --force-yes git python3-setuptools python3-dev python3-apt ccze tree
- 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 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 1.com --html || 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 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 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 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 ls /var/www/
- sudo ls /var/www/22222/htdocs/
- sudo wp --allow-root --info
- sudo wo info || sudo tail -n50 /var/log/wo/wordops.log
- 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
- Theme for adminer
- 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
@@ -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
- Nginx locations template is the same for php7.2 & 7.3
- 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
@@ -59,6 +66,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- command "wo clean --memcached"
- phpredisadmin setup
- --hsts flag with basic html site
- hsts flag on site not secure with letsencrypt
### 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
- **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
- **Powerful** : Optimized Nginx configurations with multiple cache backends support
- **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)
- 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.
- 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
- 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)
Shipped with WordOps
Apps & Tools shipped with WordOps
- Acme client : [Acme.sh](https://github.com/Neilpang/acme.sh)
- WordPress deployment : [WP-CLI](https://github.com/wp-cli/wp-cli)
- Monitoring : [Netdata](https://github.com/netdata/netdata)
- [Acme.sh](https://github.com/Neilpang/acme.sh)
- [WP-CLI](https://github.com/wp-cli/wp-cli)
- [Netdata](https://github.com/netdata/netdata)
- [phpMyAdmin](https://www.phpmyadmin.net/)
- [Composer](https://github.com/composer/composer)
- [Adminer](https://www.adminer.org/)
- [phpRedisAdmin](https://github.com/erikdubbelboer/phpRedisAdmin)
- [PHPMemcachedAdmin](https://github.com/elijaa/phpmemcachedadmin)
- [opcacheGUI](https://github.com/amnuts/opcache-gui)
- [eXtplorer](https://github.com/soerennb/extplorer)
## License

View File

@@ -7,10 +7,10 @@
# Copyright (c) 2019 - WordOps
# 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_new="3.9.4.5"
readonly wo_version_new="3.9.4.6"
# CONTENTS
# ---
# 1. VARIABLES AND DECLARATIONS
@@ -93,8 +93,8 @@ echo ""
# 1- Update the apt sewers with fresh info
###
[ -z "$wo_travis" ] && {
wo_lib_echo "Updating apt-get repository info"
apt-get update -qq
wo_lib_echo "Updating apt-get repository info"
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]*$",
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: ")
os.system("git config --global user.name {0}".format(wo_user))

View File

@@ -50,7 +50,7 @@ class WOSecureController(CementBaseController):
"""This function secures authentication"""
passwd = ''.join([random.choice
(string.ascii_letters + string.digits)
for n in range(16)])
for n in range(24)])
if not self.app.pargs.user_input:
username = input("Provide HTTP authentication user "
"name [{0}] :".format(WOVariables.wo_user))
@@ -93,16 +93,10 @@ class WOSecureController(CementBaseController):
Log.info(self, "Please Enter valid port number :")
port = input("WordOps admin port [22222]:")
self.app.pargs.user_input = port
if WOVariables.wo_platform_distro == 'ubuntu':
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))
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))
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"],
msg="Adding changed secure port into Git")
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")
if self.app.pargs.letsencrypt == "on":
if self.app.pargs.hsts:
data['letsencrypt'] = True
letsencrypt = True
data['hsts'] = True
hsts = True
else:
data['letsencrypt'] = True
letsencrypt = True
data['hsts'] = False
hsts = False
data['letsencrypt'] = True
letsencrypt = True
if data['letsencrypt'] is True:
setupLetsEncrypt(self, wo_domain)
httpsRedirect(self, wo_domain)
if data['hsts'] is True:
if self.app.pargs.hsts:
setupHsts(self, wo_domain)
if not WOService.reload_service(self, 'nginx'):
@@ -713,15 +705,11 @@ class WOSiteCreateController(CementBaseController):
data['letsencrypt'] = True
letsencrypt = True
if self.app.pargs.hsts == 'on':
data['hsts'] = True
hsts = True
if data['letsencrypt'] is True:
setupLetsEncryptSubdomain(self, wo_domain)
httpsRedirect(self, wo_domain)
if data['hsts'] is True:
if self.app.pargs.hsts:
setupHsts(self, wo_domain)
if not WOService.reload_service(self, 'nginx'):
@@ -902,7 +890,8 @@ class WOSiteUpdateController(CementBaseController):
if (pargs.hsts and not (pargs.html or
pargs.php or pargs.php73 or pargs.mysql or
pargs.wp or pargs.wpfc or pargs.wpsc or
pargs.wpsubdir or pargs.wpsubdomain)):
pargs.wpsubdir or pargs.wpsubdomain or
pargs.password)):
try:
setupHsts(self, wo_domain)
except SiteError as e:
@@ -918,8 +907,8 @@ class WOSiteUpdateController(CementBaseController):
'proxy', 'wp', 'php73']) or
(stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or
(stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or
(stype == oldsitetype and cache == oldcachetype) and
not pargs.php73 or pargs.hsts):
(stype == oldsitetype and cache == oldcachetype) and not
(pargs.php73 or pargs.hsts or pargs.letsencrypt)):
Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}".
format(oldsitetype, oldcachetype, stype, cache))
return 1

View File

@@ -68,6 +68,8 @@ class WOStackController(CementBaseController):
(['--netdata'],
dict(help='Install Netdata monitoring suite',
action='store_true')),
(['--dashboard'],
dict(help='Install WordOps dashboard', action='store_true')),
(['--adminer'],
dict(help='Install Adminer stack', action='store_true')),
(['--utils'],
@@ -519,7 +521,8 @@ class WOStackController(CementBaseController):
else:
self.msg = (self.msg + ["HTTP Auth User "
"Name: WordOps"] +
["HTTP Auth Password : {0}".format(passwd)])
["HTTP Auth Password : {0}"
.format(passwd)])
else:
WOService.restart_service(self, 'nginx')
@@ -1014,7 +1017,8 @@ class WOStackController(CementBaseController):
if len(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)
if any('/tmp/pma.tar.gz' == x[1]
@@ -1029,8 +1033,7 @@ class WOStackController(CementBaseController):
.format(WOVariables.wo_webroot))
os.makedirs('{0}22222/htdocs/db'
.format(WOVariables.wo_webroot))
if not os.path.exists('{0}22222/htdocs/db/'
'pma/phpmyadmin-STABLE'
if not os.path.exists('{0}22222/htdocs/db/pma/'
.format(WOVariables.wo_webroot)):
shutil.move('/tmp/phpmyadmin-STABLE/',
'{0}22222/htdocs/db/pma/'
@@ -1069,13 +1072,12 @@ class WOStackController(CementBaseController):
"[\'Servers\'][$i][\'host\'] = \'{0}\';"
.format(WOVariables.wo_mysql_host))
Log.debug(self, 'Setting Privileges of webroot permission to '
'{0}22222/htdocs/db/pma file '
.format(WOVariables.wo_webroot))
WOFileUtils.chown(self, '{0}22222'
.format(WOVariables.wo_webroot),
'{0}22222/htdocs/db/pma file '.format(WOVariables.wo_webroot))
WOFileUtils.chown(self, '{0}22222'.format(WOVariables.wo_webroot),
WOVariables.wo_php_user,
WOVariables.wo_php_user,
recursive=True)
# composer install and phpmyadmin update
if any('/tmp/composer-install' == x[1]
for x in packages):
@@ -1092,16 +1094,85 @@ class WOStackController(CementBaseController):
# netdata install
if any('/tmp/kickstart.sh' == x[1]
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...")
WOShellExec.cmd_exec(self, "bash /tmp/kickstart.sh "
"--dont-wait --no-updates")
WOFileUtils.searchreplace(self, "/usr/lib/netdata/conf.d/"
"health_alarm_notify.conf",
'SEND_EMAIL="YES"',
'SEND_EMAIL="NO"')
WOService.restart_service(self, 'netdata')
"--dont-wait")
# disable mail notifications
WOFileUtils.searchreplace(self, "/opt/netdata/usr/"
"lib/netdata/conf.d/"
"health_alarm_notify.conf",
'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]
for x in packages):
Log.debug(self, "Extracting memcached.tar.gz to location"
@@ -1188,7 +1259,8 @@ class WOStackController(CementBaseController):
' *.* to \'anemometer\''
'@\'{0}\' IDENTIFIED'
' BY \'{1}\''.format(self.app.config.get
('mysql', 'grant-host'),
('mysql',
'grant-host'),
chars))
Log.debug(self, "grant all on slow-query-log.*"
" to anemometer@root_user"
@@ -1216,7 +1288,7 @@ class WOStackController(CementBaseController):
if any('/usr/bin/pt-query-advisor' == x[1]
for x in packages):
WOFileUtils.chmod(self, "/usr/bin/pt-query-advisor", 0o775)
# ph
if any('/tmp/pra.tar.gz' == x[1]
for x in packages):
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.composer) 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.redis) and
(not self.app.pargs.phpredisadmin) and
@@ -1280,7 +1353,9 @@ class WOStackController(CementBaseController):
self.app.pargs.composer = True
self.app.pargs.utils = True
self.app.pargs.netdata = True
self.app.pargs.dashboard = True
# Redis
if self.app.pargs.redis:
if not WOAptGet.is_installed(self, 'redis-server'):
apt_packages = apt_packages + WOVariables.wo_redis
@@ -1288,6 +1363,7 @@ class WOStackController(CementBaseController):
else:
Log.info(self, "Redis already installed")
# Nginx
if self.app.pargs.nginx:
Log.debug(self, "Setting apt_packages variable for Nginx")
@@ -1369,11 +1445,16 @@ class WOStackController(CementBaseController):
# PHPMYADMIN
if self.app.pargs.phpmyadmin:
Log.debug(self, "Setting packages variable for phpMyAdmin ")
packages = packages + [["https://github.com/phpmyadmin/"
"phpmyadmin/archive/STABLE.tar.gz",
"/tmp/pma.tar.gz", "phpMyAdmin"],
["https://getcomposer.org/installer",
"/tmp/composer-install", "Composer"]]
if (not self.app.pargs.composer):
packages = packages + [["https://github.com/phpmyadmin/"
"phpmyadmin/archive/STABLE.tar.gz",
"/tmp/pma.tar.gz", "phpMyAdmin"],
["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
if self.app.pargs.composer:
Log.debug(self, "Setting packages variable for Composer ")
@@ -1411,10 +1492,24 @@ class WOStackController(CementBaseController):
Log.debug(self, "Setting packages variable for Netdata")
if not os.path.exists('/opt/netdata'):
packages = packages + [['https://my-netdata.io/'
'kickstart.sh',
'kickstart-static64.sh',
'/tmp/kickstart.sh',
'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
if self.app.pargs.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")
apt_packages = apt_packages + WOVariables.wo_nginx
else:
Log.error(self, "Cannot Purge! Nginx Stable version not found.")
Log.error(self, "Cannot Purge! "
"Nginx Stable version not found.")
# 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;
"~*wptouch_switch_toogle" 1;
"~*comment_author_email_" 1;
"~*edd" 1;
}
# do not cache the following uri
@@ -33,6 +34,16 @@ map $request_uri $uri_no_cache {
"~*/wp-comments-popup.php" 1;
"~*/wp-links-opml.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
@@ -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 $cache_uri {
default 'null cache';
0 $request_uri;
default 'null cache';
}

View File

@@ -22,6 +22,13 @@ class WOVariables():
if wo_wpcli_path == '':
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
wo_date = datetime.datetime.now().strftime('%d%b%Y%H%M%S')