Improve stack install and add extra directive for wp

This commit is contained in:
VirtuBox
2019-07-19 17:42:57 +02:00
parent 91212b7e82
commit aafc0092ab
4 changed files with 115 additions and 20 deletions

View File

@@ -32,7 +32,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 --help && sudo wo stack install && sudo stack install --proftpd
- sudo wo stack upgrade --netdata --no-prompt - sudo wo stack upgrade --netdata --no-prompt
- sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql && sudo wo site create proxy.com --proxy=127.0.0.1:3000 - sudo wo site create html.net --html && sudo wo site create php.com --php && sudo wo site create mysql.com --mysql && sudo wo site create proxy.com --proxy=127.0.0.1:3000
- sudo wo site create wp1.com --wp && sudo wo site create wpsc1.net --wpsc && sudo wo site create wpfc1.com --wpfc - sudo wo site create wp1.com --wp && sudo wo site create wpsc1.net --wpsc && sudo wo site create wpfc1.com --wpfc
@@ -48,5 +48,7 @@ script:
- sudo wp --allow-root --info - sudo wp --allow-root --info
- sudo wo info - sudo wo info
- sudo tree -L 2 /etc/nginx - sudo tree -L 2 /etc/nginx
- sudo cat /var/www/wp1.com/wp-config.php
- sudo wo update --travis - sudo wo update --travis
- sudo wo stack remove --netdata --proftpd --
- sudo wo stack status - sudo wo stack status

View File

@@ -18,8 +18,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Support for Debian 10 buster (testing - not ready for production) - Support for Debian 10 buster (testing - not ready for production)
- Fail2ban with custom jails to secure WordPress & SSH - Fail2ban with custom jails to secure WordPress & SSH
- Variable `keylength` in /etc/wo/wo.conf to define letsencrypt certificate keylenght - Variable `keylength` in /etc/wo/wo.conf to define letsencrypt certificate keylenght
- ProFTPd stack with UFW & Fail2ban configuration - ProFTPd stack with UFW & Fail2ban configurationz
- Beta branch and command `wo update --beta` for beta releases - Beta branch and command `wo update --beta` for beta releases
- Extra directives in wp-config.php (limit posts revisions, set max_memory, enable auto-update for minor-releases)
#### Fixed #### Fixed

View File

@@ -327,11 +327,44 @@ def setupwordpress(self, data):
raise SiteError("generate wp-config failed for wp single site") raise SiteError("generate wp-config failed for wp single site")
except CommandExecutionError as e: except CommandExecutionError as e:
raise SiteError("generate wp-config failed for wp single site") raise SiteError("generate wp-config failed for wp single site")
try:
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root " WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) + .format(WOVariables.wo_wpcli_path) +
"config set WP_CACHE_KEY_SALT " "config set WP_CACHE_KEY_SALT "
"\'{0}:\'\"".format(wo_domain_name)) "\'{0}:\'\"".format(wo_domain_name))
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_MEMORY_LIMIT "
"\'128M\'\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_MAX_MEMORY_LIMIT "
"\'256M\'\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set CONCATENATE_SCRIPTS "
"false\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_POST_REVISIONS "
"\'10\'\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set MEDIA_TRASH "
"true\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set EMPTY_TRASH_DAYS "
"\'15\'\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_AUTO_UPDATE_CORE "
"minor\"")
except CommandExecutionError as e:
Log.error(self, "Unable to define extra variable in wp-config.php")
else: else:
Log.debug(self, "Generating wp-config for WordPress multisite") Log.debug(self, "Generating wp-config for WordPress multisite")
@@ -373,10 +406,44 @@ def setupwordpress(self, data):
except CommandExecutionError as e: except CommandExecutionError as e:
raise SiteError("generate wp-config failed for wp multi site") raise SiteError("generate wp-config failed for wp multi site")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root " try:
.format(WOVariables.wo_wpcli_path) +
"config set WP_CACHE_KEY_SALT " WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
"\'{0}:\'\"".format(wo_domain_name)) .format(WOVariables.wo_wpcli_path) +
"config set WP_CACHE_KEY_SALT "
"\'{0}:\'\"".format(wo_domain_name))
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_MEMORY_LIMIT "
"\'128M\'\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_MAX_MEMORY_LIMIT "
"\'256M\'\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set CONCATENATE_SCRIPTS "
"false\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_POST_REVISIONS "
"\'10\'\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set MEDIA_TRASH "
"true\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set EMPTY_TRASH_DAYS "
"\'15\'\"")
WOShellExec.cmd_exec(self, "bash -c \"php {0} --allow-root "
.format(WOVariables.wo_wpcli_path) +
"config set WP_AUTO_UPDATE_CORE "
"minor\"")
except CommandExecutionError as e:
Log.error(self, "Unable to define extra variable in wp-config.php")
# WOFileUtils.mvfile(self, os.getcwd()+'/wp-config.php', # WOFileUtils.mvfile(self, os.getcwd()+'/wp-config.php',
# os.path.abspath(os.path.join(os.getcwd(), os.pardir))) # os.path.abspath(os.path.join(os.getcwd(), os.pardir)))

View File

@@ -1613,12 +1613,22 @@ class WOStackController(CementBaseController):
"phpmyadmin/archive/STABLE.tar.gz", "phpmyadmin/archive/STABLE.tar.gz",
"/var/lib/wo/tmp/pma.tar.gz", "/var/lib/wo/tmp/pma.tar.gz",
"phpMyAdmin"]] "phpMyAdmin"]]
else:
Log.debug(self, "phpMyAdmin already installed")
Log.info(self, "phpMyAdmin already installed")
# Composer # Composer
if self.app.pargs.composer: if self.app.pargs.composer:
Log.debug(self, "Setting packages variable for Composer ") if not os.path.isfile('/usr/local/bin/composer'):
packages = packages + [["https://getcomposer.org/installer", Log.debug(self, "Setting packages variable for Composer ")
"/var/lib/wo/tmp/composer-install", packages = packages + [["https://getcomposer.org/"
"Composer"]] "installer",
"/var/lib/wo/tmp/composer-install",
"Composer"]]
else:
Log.debug(self, "Composer already installed")
Log.info(self, "Composer already installed")
# PHPREDISADMIN # PHPREDISADMIN
if self.app.pargs.phpredisadmin: if self.app.pargs.phpredisadmin:
if not os.path.isdir('/var/www/22222/htdocs/cache/redis'): if not os.path.isdir('/var/www/22222/htdocs/cache/redis'):
@@ -1631,11 +1641,17 @@ class WOStackController(CementBaseController):
"/v1.11.3.tar.gz", "/v1.11.3.tar.gz",
"/var/lib/wo/tmp/pra.tar.gz", "/var/lib/wo/tmp/pra.tar.gz",
"phpRedisAdmin"]] "phpRedisAdmin"]]
else:
Log.debug(self, "phpRedisAdmin already installed")
Log.info(self, "phpRedisAdmin already installed")
# ADMINER # ADMINER
if self.app.pargs.adminer: if self.app.pargs.adminer:
Log.debug(self, "Setting packages variable for Adminer ") if not os.path.isdir('{0}22222/htdocs/db/adminer'
packages = packages + [["https://github.com/vrana/adminer/" .format(WOVariables.wo_webroot)):
"releases/download/v{0}" Log.debug(self, "Setting packages variable for Adminer ")
packages = packages + [["https://github.com/vrana/adminer/"
"releases/download/v{0}"
"/adminer-{0}.php" "/adminer-{0}.php"
.format(WOVariables.wo_adminer), .format(WOVariables.wo_adminer),
"{0}22222/" "{0}22222/"
@@ -1646,9 +1662,12 @@ class WOStackController(CementBaseController):
"/vrana/adminer/master/designs/" "/vrana/adminer/master/designs/"
"pepa-linha/adminer.css", "pepa-linha/adminer.css",
"{0}22222/" "{0}22222/"
"htdocs/db/adminer/adminer.css" "htdocs/db/adminer/adminer.css"
.format(WOVariables.wo_webroot), .format(WOVariables.wo_webroot),
"Adminer theme"]] "Adminer theme"]]
else:
Log.debug(self, "Adminer already installed")
Log.info(self, "Adminer already installed")
# Netdata # Netdata
if self.app.pargs.netdata: if self.app.pargs.netdata:
@@ -1658,6 +1677,9 @@ class WOStackController(CementBaseController):
'kickstart-static64.sh', 'kickstart-static64.sh',
'/var/lib/wo/tmp/kickstart.sh', '/var/lib/wo/tmp/kickstart.sh',
'Netdata']] 'Netdata']]
else:
Log.debug(self, "Netdata already installed")
Log.info(self, "Netdata already installed")
# WordOps Dashboard # WordOps Dashboard
if self.app.pargs.dashboard: if self.app.pargs.dashboard:
@@ -1674,6 +1696,9 @@ class WOStackController(CementBaseController):
"extplorer/archive/v2.1.11.tar.gz", "extplorer/archive/v2.1.11.tar.gz",
"/var/lib/wo/tmp/extplorer.tar.gz", "/var/lib/wo/tmp/extplorer.tar.gz",
"eXtplorer"]] "eXtplorer"]]
else:
Log.debug(self, "WordOps dashboard already installed")
Log.info(self, "WordOps dashboard already installed")
# UTILS # UTILS
if self.app.pargs.utils: if self.app.pargs.utils: