Merge pull request #132 from WordOps/updating-configuration

Updating configuration
This commit is contained in:
VirtuBox
2019-08-31 15:36:25 +02:00
committed by GitHub
8 changed files with 366 additions and 287 deletions

View File

@@ -8,6 +8,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### v3.9.x - [Unreleased] ### v3.9.x - [Unreleased]
### v3.9.8.7 - 2019-08-31
#### Changed
- WordPress default permalinks structure from `/%year%/%monthnum%/%day%/%postname%/` -> `/%postname%/`
#### Fixed
- Error with `wo stack upgrade --nginx`
- Install/update script version check
- clamAV stack install
### v3.9.8.6 - 2019-08-30 ### v3.9.8.6 - 2019-08-30
#### Added #### Added

View File

@@ -811,12 +811,12 @@ if [ "$wo_purge" = "y" ]; then
else else
# 1 - WO already installed # 1 - WO already installed
if [ -x /usr/local/bin/wo ]; then if [ -x /usr/local/bin/wo ]; then
if { if [ -z "$wo_force_install" ]; then
wo -v 2>&1 | grep -q "$wo_version_new" if { wo -v 2>&1 | grep -q "$wo_version_new"; }; then
} && [ -z "$wo_force_install" ]; then
wo_lib_error "You already have WordOps $wo_version_new" wo_lib_error "You already have WordOps $wo_version_new"
exit 1 exit 1
fi fi
fi
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
wo_install_dep | tee -ai $wo_install_log wo_install_dep | tee -ai $wo_install_log
wo_timesync | tee -ai $wo_install_log wo_timesync | tee -ai $wo_install_log
@@ -960,7 +960,7 @@ else
wo_lib_echo_info "wo stack upgrade --nginx" wo_lib_echo_info "wo stack upgrade --nginx"
echo echo
wo_lib_echo "To update other packages use the command:" wo_lib_echo "To update other packages use the command:"
wo_lib_echo_info "wo stack maintenance" wo_lib_echo_info "wo maintenance"
else else
wo_lib_echo "WordOps (wo) installed successfully" wo_lib_echo "WordOps (wo) installed successfully"
echo echo

View File

@@ -57,7 +57,7 @@ if not os.path.isfile('/root/.gitconfig'):
shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig') shutil.copy2(os.path.expanduser("~")+'/.gitconfig', '/root/.gitconfig')
setup(name='wo', setup(name='wo',
version='3.9.8.6', version='3.9.8.7',
description=long_description, description=long_description,
long_description=long_description, long_description=long_description,
classifiers=[], classifiers=[],

View File

@@ -3,43 +3,118 @@
# WordOps travis testing script # WordOps travis testing script
# #
# #
# Colors
CSI='\033[' CSI='\033['
CEND="${CSI}0m" CRED="${CSI}1;31m"
CGREEN="${CSI}1;32m" CGREEN="${CSI}1;32m"
CEND="${CSI}0m"
exit_script() { exit_script() {
tar -I pigz -cf wordops.tar.gz /var/log/wo tar -I pigz -cf wordops.tar.gz /var/log/wo
curl --progress-bar --upload-file wordops.tar.gz https://transfer.vtbox.net/$(basename "wordops.tar.gz") && echo "" | sudo tee -a $HOME/.transfer.log && echo "" curl --progress-bar --upload-file wordops.tar.gz https://transfer.vtbox.net/"$(basename wordops.tar.gz)" && echo "" | sudo tee -a $HOME/.transfer.log && echo ""
exit 1 exit 1
} }
if ! {
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"
echo -e ' stack install ' echo -e ' stack install '
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"
wo --help && wo stack install && wo stack install --proftpd stack_list='nginx php php73 mysql redis fail2ban clamav proftpd admin'
}; then for stack in $stack_list; do
echo -ne " Installing $stack [..]\r"
if {
wo stack install --${stack}
} >> /var/log/wo/test.log; then
echo -ne " Installing $stack [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
echo -e " Installing $stack [${CRED}FAIL${CEND}]"
echo -ne '\n'
exit_script exit_script
fi fi
if ! { done
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"
echo -e ' Simple site create ' echo -e ' Simple site create '
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"
wo site create html.net --html && wo site create php.com --php && wo site create mysql.com --mysql && wo site create proxy.com --proxy=127.0.0.1:3000 site_types='html php php73 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir'
wo site create wp1.com --wp && wo site create wpsc1.net --wpsc && wo site create wpfc1.com --wpfc for site in $site_types; do
wo site create wpsc-php73.net --wpsc --php73 && wo site create wpfc-php73.net --wpfc --php73 echo -ne " Creating $site [..]\r"
wo site create wprocket.net --wprocket && wo site create wprocket-php73.net --wprocket --php73 if {
wo site create wpce.net --wpce && wo site create wpce-php73.net --wpce --php73 wo site create ${site}.net --${site}
wo site create wpredis.net --wpredis && wo site create wpredis-php73.net --wpredis --php73 } >> /var/log/wo/test.log; then
echo -ne " Creating $site [${CGREEN}OK${CEND}]\\r"
}; then echo -ne '\n'
else
echo -e " Creating $site [${CRED}FAIL${CEND}]"
echo -ne '\n'
exit_script exit_script
fi fi
done
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' wo site update --php73 '
echo -e "${CGREEN}#############################################${CEND}"
other_site_types='html mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir'
for site in $other_site_types; do
echo -ne " Updating site to $site php73 [..]\r"
if {
wo site update ${site}.net --php73
} >> /var/log/wo/test.log; then
echo -ne " Updating site to $site php73 [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
echo -e " Updating site to $site php73 [${CRED}FAIL${CEND}]"
echo -ne '\n'
exit_script
fi
done
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' wo site update WP '
echo -e "${CGREEN}#############################################${CEND}"
wp_site_types='wpfc wpsc wpce wprocket wpredis'
wo site create wp.io --wp >> /dev/null 2>&1
for site in $wp_site_types; do
echo -ne " Updating WP to $site [..]\r"
if {
wo site update wp.io --${site}
} >> /var/log/wo/test.log; then
echo -ne " Updating WP to $site [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
echo -e " Updating WP to $site [${CRED}FAIL${CEND}]"
echo -ne '\n'
exit_script
fi
done
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' wo stack upgrade '
echo -e "${CGREEN}#############################################${CEND}"
stack_upgrade='nginx php mysql redis netdata dashboard phpmyadmin'
for stack in $stack_upgrade; do
echo -ne " Upgrading $stack [..]\r"
if {
wo stack upgrade --${stack} --force
} >> /var/log/wo/test.log; then
echo -ne " Upgrading $stack [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
echo -e " Upgrading $stack [${CRED}FAIL${CEND}]"
echo -ne '\n'
exit_script
fi
done
if ! { if ! {
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"
echo -e ' Multi-site create ' echo -e ' Multi-site create '
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"
wo site create wpsubdir1.com --wpsubdir && wo site create wpsubdir-php73.com --wpsubdir --php73
wo site create wpsubdirwpsc1.com --wpsubdir --wpsc && wo site create wpsubdirwpsc2.com --wpsubdir --wpfc && wo site create wpsubdirwpsc1-php73.com --wpsubdir --wpsc --php73 && wo site create wpsubdirwpsc2-php73.com --wpsubdir --wpfc --php73 wo site create wpsubdirwpsc1.com --wpsubdir --wpsc && wo site create wpsubdirwpsc2.com --wpsubdir --wpfc && wo site create wpsubdirwpsc1-php73.com --wpsubdir --wpsc --php73 && wo site create wpsubdirwpsc2-php73.com --wpsubdir --wpfc --php73
wo site create wpsubdomain1.com --wpsubdomain && wo site create wpsubdomain1-php73.com --wpsubdomain --php73 && wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc && wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc && wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain wo site create wpsubdomain1.com --wpsubdomain && wo site create wpsubdomain1-php73.com --wpsubdomain --php73 && wo site create wpsubdomainwpsc.org --wpsubdomain --wpsc && wo site create wpsubdomainwpfc.org --wpsubdomain --wpfc && wo site create wpsubdomainwpfc2.in --wpfc --wpsubdomain
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"
@@ -51,19 +126,7 @@ if ! {
}; then }; then
exit_script exit_script
fi fi
if ! {
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' wo stack upgrade '
echo -e "${CGREEN}#############################################${CEND}"
wo stack upgrade --force
wo stack upgrade --php --force
wo stack upgrade --netdata --force
wo stack upgrade --phpmyadmin --force
wo stack upgrade --composer --force
wo stack upgrade --dashboard --force
}; then
exit_script
fi
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"
echo -e ' various informations ' echo -e ' various informations '
echo -e "${CGREEN}#############################################${CEND}" echo -e "${CGREEN}#############################################${CEND}"

View File

@@ -519,7 +519,7 @@ def setupwordpress(self, data, vhostonly=False):
WOShellExec.cmd_exec(self, " {0} --allow-root " WOShellExec.cmd_exec(self, " {0} --allow-root "
.format(WOVariables.wo_wpcli_path) + .format(WOVariables.wo_wpcli_path) +
"rewrite structure " "rewrite structure "
"/%year%/%monthnum%/%day%/%postname%/") "/%postname%/")
except CommandExecutionError as e: except CommandExecutionError as e:
Log.debug(self, str(e)) Log.debug(self, str(e))
raise SiteError("Update wordpress permalinks failed") raise SiteError("Update wordpress permalinks failed")

View File

@@ -265,7 +265,7 @@ class WOStackController(CementBaseController):
if pargs.clamav: if pargs.clamav:
Log.debug(self, "Setting apt_packages variable for ClamAV") Log.debug(self, "Setting apt_packages variable for ClamAV")
if not WOAptGet.is_installed(self, 'clamav'): if not WOAptGet.is_installed(self, 'clamav'):
apt_packages = apt_packages + ["clamav"] apt_packages = apt_packages + WOVariables.wo_clamav
else: else:
Log.debug(self, "ClamAV already installed") Log.debug(self, "ClamAV already installed")
Log.info(self, "ClamAV already installed") Log.info(self, "ClamAV already installed")
@@ -473,7 +473,7 @@ class WOStackController(CementBaseController):
WOAptGet.install(self, apt_packages) WOAptGet.install(self, apt_packages)
post_pref(self, apt_packages, empty_packages) post_pref(self, apt_packages, empty_packages)
if (packages): if (packages):
Log.debug(self, "Downloading following: {0}".format(packages)) Log.info(self, "Downloading following: {0}".format(packages))
WODownload.download(self, packages) WODownload.download(self, packages)
Log.debug(self, "Calling post_pref") Log.debug(self, "Calling post_pref")
post_pref(self, empty_packages, packages) post_pref(self, empty_packages, packages)
@@ -587,7 +587,7 @@ class WOStackController(CementBaseController):
if pargs.clamav: if pargs.clamav:
Log.debug(self, "Setting apt_packages variable for ClamAV") Log.debug(self, "Setting apt_packages variable for ClamAV")
if WOAptGet.is_installed(self, 'clamav'): if WOAptGet.is_installed(self, 'clamav'):
apt_packages = apt_packages + ["clamav"] apt_packages = apt_packages + WOVariables.wo_clamav
# proftpd # proftpd
if pargs.proftpd: if pargs.proftpd:
@@ -793,7 +793,7 @@ class WOStackController(CementBaseController):
if pargs.clamav: if pargs.clamav:
Log.debug(self, "Setting apt_packages variable for ClamAV") Log.debug(self, "Setting apt_packages variable for ClamAV")
if WOAptGet.is_installed(self, 'clamav'): if WOAptGet.is_installed(self, 'clamav'):
apt_packages = apt_packages + ["clamav"] apt_packages = apt_packages + WOVariables.wo_clamav
# proftpd # proftpd
if pargs.proftpd: if pargs.proftpd:

View File

@@ -330,7 +330,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
"/redis.conf")): "/redis.conf")):
with open("/etc/nginx/conf.d/" with open("/etc/nginx/conf.d/"
"redis.conf", "a") as redis_file: "redis.conf", "a") as redis_file:
redis_file.write("# Log format Settings\n" redis_file.write(
"# Log format Settings\n"
"log_format rt_cache_redis " "log_format rt_cache_redis "
"'$remote_addr " "'$remote_addr "
"$upstream_response_time " "$upstream_response_time "
@@ -356,14 +357,17 @@ def post_pref(self, apt_packages, packages, upgrade=False):
# 22222 port settings # 22222 port settings
if not os.path.isfile('/etc/nginx/sites-available/22222'): if not os.path.isfile('/etc/nginx/sites-available/22222'):
WOTemplate.render(self, data = dict(webroot=ngxroot)
WOTemplate.render(
self,
'/etc/nginx/sites-available/22222', '/etc/nginx/sites-available/22222',
'22222.mustache', data, overwrite=False) '22222.mustache', data, overwrite=False)
passwd = ''.join([random.choice passwd = ''.join([random.choice
(string.ascii_letters + string.digits) (string.ascii_letters + string.digits)
for n in range(24)]) for n in range(24)])
try: try:
WOShellExec.cmd_exec(self, "printf \"WordOps:" WOShellExec.cmd_exec(
self, "printf \"WordOps:"
"$(openssl passwd -crypt " "$(openssl passwd -crypt "
"{password} 2> /dev/null)\n\"" "{password} 2> /dev/null)\n\""
"> /etc/nginx/htpasswd-wo " "> /etc/nginx/htpasswd-wo "
@@ -374,7 +378,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
Log.error(self, "Failed to save HTTP Auth") Log.error(self, "Failed to save HTTP Auth")
# Create Symbolic link for 22222 # Create Symbolic link for 22222
WOFileUtils.create_symlink(self, ['/etc/nginx/' WOFileUtils.create_symlink(
self, ['/etc/nginx/'
'sites-available/' 'sites-available/'
'22222', '22222',
'/etc/nginx/' '/etc/nginx/'
@@ -405,7 +410,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
os.makedirs('{0}22222/conf/nginx' os.makedirs('{0}22222/conf/nginx'
.format(ngxroot)) .format(ngxroot))
WOFileUtils.create_symlink(self, WOFileUtils.create_symlink(
self,
['/var/log/nginx/' ['/var/log/nginx/'
'22222.access.log', '22222.access.log',
'{0}22222/' '{0}22222/'
@@ -413,7 +419,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
.format(ngxroot)] .format(ngxroot)]
) )
WOFileUtils.create_symlink(self, WOFileUtils.create_symlink(
self,
['/var/log/nginx/' ['/var/log/nginx/'
'22222.error.log', '22222.error.log',
'{0}22222/' '{0}22222/'
@@ -422,29 +429,34 @@ def post_pref(self, apt_packages, packages, upgrade=False):
) )
try: try:
WOShellExec.cmd_exec(self, "openssl genrsa -out " WOShellExec.cmd_exec(
self, "openssl genrsa -out "
"{0}22222/cert/22222.key 2048" "{0}22222/cert/22222.key 2048"
.format(ngxroot)) .format(ngxroot))
WOShellExec.cmd_exec(self, "openssl req -new -batch " WOShellExec.cmd_exec(
self, "openssl req -new -batch "
"-subj /commonName=localhost/ " "-subj /commonName=localhost/ "
"-key {0}22222/cert/22222.key " "-key {0}22222/cert/22222.key "
"-out {0}22222/cert/" "-out {0}22222/cert/"
"22222.csr" "22222.csr"
.format(ngxroot)) .format(ngxroot))
WOFileUtils.mvfile(self, "{0}22222/cert/22222.key" WOFileUtils.mvfile(
self, "{0}22222/cert/22222.key"
.format(ngxroot), .format(ngxroot),
"{0}22222/cert/" "{0}22222/cert/"
"22222.key.org" "22222.key.org"
.format(ngxroot)) .format(ngxroot))
WOShellExec.cmd_exec(self, "openssl rsa -in " WOShellExec.cmd_exec(
self, "openssl rsa -in "
"{0}22222/cert/" "{0}22222/cert/"
"22222.key.org -out " "22222.key.org -out "
"{0}22222/cert/22222.key" "{0}22222/cert/22222.key"
.format(ngxroot)) .format(ngxroot))
WOShellExec.cmd_exec(self, "openssl x509 -req -days " WOShellExec.cmd_exec(
self, "openssl x509 -req -days "
"3652 -in {0}22222/cert/" "3652 -in {0}22222/cert/"
"22222.csr -signkey {0}" "22222.csr -signkey {0}"
"22222/cert/22222.key -out " "22222/cert/22222.key -out "
@@ -486,6 +498,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
WOVariables.wo_fqdn)]) WOVariables.wo_fqdn)])
if not os.path.isfile("/opt/cf-update.sh"): if not os.path.isfile("/opt/cf-update.sh"):
data = dict()
WOTemplate.render(self, '/opt/cf-update.sh', WOTemplate.render(self, '/opt/cf-update.sh',
'cf-update.mustache', 'cf-update.mustache',
data, overwrite=False) data, overwrite=False)
@@ -1113,8 +1126,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
Log.debug(self, "Enabling redis systemd service") Log.debug(self, "Enabling redis systemd service")
WOShellExec.cmd_exec(self, "systemctl enable redis-server") WOShellExec.cmd_exec(self, "systemctl enable redis-server")
if (os.path.isfile("/etc/redis/redis.conf") and if (os.path.isfile("/etc/redis/redis.conf") and
not WOFileUtils.grep(self, "/etc/redis/redis.conf", (not WOFileUtils.grep(self, "/etc/redis/redis.conf",
"WordOps")): "WordOps"))):
Log.info(self, "Tuning Redis configuration") Log.info(self, "Tuning Redis configuration")
with open("/etc/redis/redis.conf", with open("/etc/redis/redis.conf",
"a") as redis_file: "a") as redis_file:
@@ -1162,9 +1175,11 @@ def post_pref(self, apt_packages, packages, upgrade=False):
'redis', 'redis', recursive=False) 'redis', 'redis', recursive=False)
WOService.restart_service(self, 'redis-server') WOService.restart_service(self, 'redis-server')
# Redis configuration # ClamAV configuration
if set(["clamav"]).issubset(set(apt_packages)): if set(WOVariables.wo_clamav).issubset(set(apt_packages)):
Log.debug("Setting up freshclam cronjob") Log.debug(self, "Setting up freshclam cronjob")
if not os.path.isfile("/opt/freshclam.sh"):
data = dict()
WOTemplate.render(self, '/opt/freshclam.sh', WOTemplate.render(self, '/opt/freshclam.sh',
'freshclam.mustache', 'freshclam.mustache',
data, overwrite=False) data, overwrite=False)
@@ -1253,16 +1268,33 @@ def post_pref(self, apt_packages, packages, upgrade=False):
shutil.copyfile('/var/lib/wo/tmp/composer.phar', shutil.copyfile('/var/lib/wo/tmp/composer.phar',
'/usr/local/bin/composer') '/usr/local/bin/composer')
WOFileUtils.chmod(self, "/usr/local/bin/composer", 0o775) WOFileUtils.chmod(self, "/usr/local/bin/composer", 0o775)
if os.path.isdir("/var/www/22222/htdocs/db/pma"):
Log.info(self, "Updating phpMyAdmin, please wait...") Log.info(self, "Updating phpMyAdmin, please wait...")
WOShellExec.cmd_exec(self, "/usr/local/bin/composer update " WOShellExec.cmd_exec(
self, "/usr/local/bin/composer update "
"--no-plugins --no-scripts " "--no-plugins --no-scripts "
"-n --no-dev -d " "-n --no-dev -d "
"/var/www/22222/htdocs/db/pma/") "/var/www/22222/htdocs/db/pma/")
WOFileUtils.chown(self, '{0}22222/htdocs/db/pma' WOFileUtils.chown(
self, '{0}22222/htdocs/db/pma'
.format(WOVariables.wo_webroot), .format(WOVariables.wo_webroot),
'www-data', 'www-data',
'www-data', 'www-data',
recursive=True) recursive=True)
if not os.path.exists('{0}22222/htdocs/cache/'
'redis/phpRedisAdmin'
.format(WOVariables.wo_webroot)):
Log.debug(self, "Creating new directory "
"{0}22222/htdocs/cache/redis"
.format(WOVariables.wo_webroot))
os.makedirs('{0}22222/htdocs/cache/redis/phpRedisAdmin'
.format(WOVariables.wo_webroot))
WOFileUtils.chown(self, '{0}22222/htdocs'
.format(WOVariables.wo_webroot),
'www-data',
'www-data',
recursive=True)
# MySQLtuner # MySQLtuner
if any('/usr/bin/mysqltuner' == x[1] if any('/usr/bin/mysqltuner' == x[1]
for x in packages): for x in packages):
@@ -1283,33 +1315,32 @@ def post_pref(self, apt_packages, packages, upgrade=False):
else: else:
wo_netdata = "/opt/netdata/" wo_netdata = "/opt/netdata/"
# disable mail notifications # disable mail notifications
WOFileUtils.searchreplace(self, "{0}usr/" WOFileUtils.searchreplace(
"lib/netdata/conf.d/" self, "{0}usr/"
"health_alarm_notify.conf" "lib/netdata/conf.d/health_alarm_notify.conf"
.format(wo_netdata), .format(wo_netdata),
'SEND_EMAIL="YES"', 'SEND_EMAIL="YES"',
'SEND_EMAIL="NO"') 'SEND_EMAIL="NO"')
# make changes persistant # make changes persistant
WOFileUtils.copyfile(self, "{0}usr/" WOFileUtils.copyfile(
"lib/netdata/conf.d/" self, "{0}usr/lib/netdata/conf.d/"
"health_alarm_notify.conf" "health_alarm_notify.conf"
.format(wo_netdata), .format(wo_netdata),
"{0}etc/netdata/" "{0}etc/netdata/health_alarm_notify.conf"
"health_alarm_notify.conf"
.format(wo_netdata)) .format(wo_netdata))
# check if mysql credentials are available # check if mysql credentials are available
if os.path.isfile('/etc/mysql/conf.d/my.cnf'): if os.path.isfile('/etc/mysql/conf.d/my.cnf'):
try: try:
WOMysql.execute(self, WOMysql.execute(
"create user " self,
"'netdata'@'localhost';", "create user 'netdata'@'localhost';",
log=False) log=False)
WOMysql.execute(self, WOMysql.execute(
"grant usage on *.* to " self,
"'netdata'@'localhost';", "grant usage on *.* to 'netdata'@'localhost';",
log=False) log=False)
WOMysql.execute(self, WOMysql.execute(
"flush privileges;", self, "flush privileges;",
log=False) log=False)
except CommandExecutionError as e: except CommandExecutionError as e:
Log.debug(self, "{0}".format(e)) Log.debug(self, "{0}".format(e))
@@ -1396,17 +1427,20 @@ def post_pref(self, apt_packages, packages, upgrade=False):
'{0}22222/htdocs/php/webgrind' '{0}22222/htdocs/php/webgrind'
.format(WOVariables.wo_webroot)) .format(WOVariables.wo_webroot))
WOFileUtils.searchreplace(self, "{0}22222/htdocs/php/webgrind/" WOFileUtils.searchreplace(
self, "{0}22222/htdocs/php/webgrind/"
"config.php" "config.php"
.format(WOVariables.wo_webroot), .format(WOVariables.wo_webroot),
"/usr/local/bin/dot", "/usr/bin/dot") "/usr/local/bin/dot", "/usr/bin/dot")
WOFileUtils.searchreplace(self, "{0}22222/htdocs/php/webgrind/" WOFileUtils.searchreplace(
self, "{0}22222/htdocs/php/webgrind/"
"config.php" "config.php"
.format(WOVariables.wo_webroot), .format(WOVariables.wo_webroot),
"Europe/Copenhagen", "Europe/Copenhagen",
WOVariables.wo_timezone) WOVariables.wo_timezone)
WOFileUtils.searchreplace(self, "{0}22222/htdocs/php/webgrind/" WOFileUtils.searchreplace(
self, "{0}22222/htdocs/php/webgrind/"
"config.php" "config.php"
.format(WOVariables.wo_webroot), .format(WOVariables.wo_webroot),
"90", "100") "90", "100")
@@ -1456,7 +1490,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
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"
" IDENTIFIED BY password ") " IDENTIFIED BY password ")
WOMysql.execute(self, 'grant all on slow_query_log.* to' WOMysql.execute(
self, 'grant all on slow_query_log.* to'
'\'anemometer\'@\'{0}\' IDENTIFIED' '\'anemometer\'@\'{0}\' IDENTIFIED'
' BY \'{1}\''.format(self.app.config.get( ' BY \'{1}\''.format(self.app.config.get(
'mysql', 'grant-host'), 'mysql', 'grant-host'),
@@ -1480,35 +1515,3 @@ def post_pref(self, apt_packages, packages, upgrade=False):
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)
# phpredisadmin
if any('/var/lib/wo/tmp/pra.tar.gz' == x[1]
for x in packages):
if not os.path.exists('{0}22222/htdocs/cache/'
'redis/phpRedisAdmin'
.format(WOVariables.wo_webroot)):
Log.debug(self, "Creating new directory "
"{0}22222/htdocs/cache/redis"
.format(WOVariables.wo_webroot))
os.makedirs('{0}22222/htdocs/cache/redis/phpRedisAdmin'
.format(WOVariables.wo_webroot))
WOFileUtils.chown(self, '{0}22222/htdocs'
.format(WOVariables.wo_webroot),
'www-data',
'www-data',
recursive=True)
if os.path.isfile("/usr/local/bin/composer"):
WOShellExec.cmd_exec(self, "/usr/local/bin/composer"
"create-project --no-plugins "
"--no-scripts -n -s dev "
"erik-dubbelboer/php-redis-admin "
"/var/www/22222/htdocs/cache"
"/redis/phpRedisAdmin ")
Log.debug(self, 'Setting Privileges of webroot permission to '
'{0}22222/htdocs/cache/redis'
.format(WOVariables.wo_webroot))
WOFileUtils.chown(self, '{0}22222/htdocs'
.format(WOVariables.wo_webroot),
'www-data',
'www-data',
recursive=True)

View File

@@ -10,7 +10,7 @@ class WOVariables():
"""Intialization of core variables""" """Intialization of core variables"""
# WordOps version # WordOps version
wo_version = "3.9.8.6" wo_version = "3.9.8.7"
# WordOps packages versions # WordOps packages versions
wo_wp_cli = "2.2.0" wo_wp_cli = "2.2.0"
wo_adminer = "4.7.2" wo_adminer = "4.7.2"
@@ -160,6 +160,7 @@ class WOVariables():
wo_mysql_client = ["mariadb-client", "python3-mysql.connector"] wo_mysql_client = ["mariadb-client", "python3-mysql.connector"]
wo_fail2ban = ["fail2ban"] wo_fail2ban = ["fail2ban"]
wo_clamav = ["clamav", "clamav-freshclam"]
# Redis repo details # Redis repo details
if wo_distro == 'ubuntu': if wo_distro == 'ubuntu':