Merge pull request #129 from WordOps/updating-configuration
Updating configuration
This commit is contained in:
15
CHANGELOG.md
15
CHANGELOG.md
@@ -8,6 +8,21 @@ 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.5 - 2019-08-30
|
||||||
|
|
||||||
|
#### Changed
|
||||||
|
|
||||||
|
- updated OpCache Control Panel to v0.2.0
|
||||||
|
|
||||||
|
#### Fixed
|
||||||
|
|
||||||
|
- Fix Netdata install on Raspbian 9/10
|
||||||
|
- `wo stack remove/purge` confirmation
|
||||||
|
- Nginx error after removing a SSL certificate used to secure WordOps backend
|
||||||
|
- `wo stack install --all`
|
||||||
|
- ProFTPd fail2ban rules set twice if removed and reinstalled
|
||||||
|
- `wo site update`
|
||||||
|
|
||||||
### v3.9.8.4 - 2019-08-28
|
### v3.9.8.4 - 2019-08-28
|
||||||
|
|
||||||
#### Added
|
#### Added
|
||||||
|
|||||||
@@ -168,6 +168,10 @@ Apps & Tools shipped with WordOps :
|
|||||||
- [MySQLTuner](https://github.com/major/MySQLTuner-perl/)
|
- [MySQLTuner](https://github.com/major/MySQLTuner-perl/)
|
||||||
- [Webgrind](https://github.com/jokkedk/webgrind)
|
- [Webgrind](https://github.com/jokkedk/webgrind)
|
||||||
- [MySQLTuner](https://github.com/major/MySQLTuner-perl)
|
- [MySQLTuner](https://github.com/major/MySQLTuner-perl)
|
||||||
|
- [Fail2Ban](https://github.com/fail2ban/fail2ban)
|
||||||
|
- [ClamAV](https://github.com/Cisco-Talos/clamav-devel)
|
||||||
|
- [cheat.sh](https://github.com/chubin/cheat.sh)
|
||||||
|
- [ProFTPd](https://github.com/proftpd/proftpd)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -159,13 +159,13 @@ _wo_complete()
|
|||||||
|
|
||||||
"create")
|
"create")
|
||||||
COMPREPLY=( $(compgen \
|
COMPREPLY=( $(compgen \
|
||||||
-W "--user --pass --email --html --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --proxy= --wpredis --wprocket --wpce --letsencrypt --letsencrypt=subdomain --letsencrypt=wildcard -le -le=subdomain -le=wildcard --dns --dns=dns_cf --dns=dns_do" \
|
-W "--user --pass --email --html --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --proxy= --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard -le=wildcard --dns --dns=dns_cf --dns=dns_do" \
|
||||||
-- $cur) )
|
-- $cur) )
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"update")
|
"update")
|
||||||
COMPREPLY=( $(compgen \
|
COMPREPLY=( $(compgen \
|
||||||
-W "--password --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --letsencrypt --letsencrypt=subdomain --letsencrypt=off --letsencrypt=renew --letsencrypt=clean -le -le=subdomain -le=wildcard --dns --dns=dns_cf --dns=dns_do" \
|
-W "--password --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=off --letsencrypt=clean -le=wildcard --dns --dns=dns_cf --dns=dns_do" \
|
||||||
-- $cur) )
|
-- $cur) )
|
||||||
;;
|
;;
|
||||||
"delete")
|
"delete")
|
||||||
@@ -211,9 +211,9 @@ _wo_complete()
|
|||||||
"--wp")
|
"--wp")
|
||||||
if [ ${COMP_WORDS[1]} != "debug" ]; then
|
if [ ${COMP_WORDS[1]} != "debug" ]; then
|
||||||
if [ ${COMP_WORDS[2]} == "create" ]; then
|
if [ ${COMP_WORDS[2]} == "create" ]; then
|
||||||
retlist="--wp --wpsc --wpfc --user --email --pass --wpredis --wprocket --wpce --letsencrypt -le --letsencrypt=subdomain --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_do --php73"
|
retlist="--wp --wpsc --wpfc --user --email --pass --wpredis --wprocket --wpce --letsencrypt -le --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_do --php73"
|
||||||
elif [ ${COMP_WORDS[2]} == "update" ]; then
|
elif [ ${COMP_WORDS[2]} == "update" ]; then
|
||||||
retlist="--wp --wpfc --wpsc --php73 --php73=off --wpredis --wprocket --wpce --letsencrypt --letsencrypt=subdomain --letsencrypt=wildcard --letsencrypt=off --letsencrypt=renew --letsencrypt=clean -le -le=off -le=wildcard --dns --dns=dns_cf --dns=dns_do"
|
retlist="--wp --wpfc --wpsc --php73 --php73=off --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard --letsencrypt=off --letsencrypt=clean -le=off -le=wildcard --dns --dns=dns_cf --dns=dns_do"
|
||||||
else
|
else
|
||||||
retlist=""
|
retlist=""
|
||||||
fi
|
fi
|
||||||
@@ -230,9 +230,9 @@ _wo_complete()
|
|||||||
"--wpsubdir" | "--wpsubdomain")
|
"--wpsubdir" | "--wpsubdomain")
|
||||||
if [ ${COMP_WORDS[1]} != "debug" ]; then
|
if [ ${COMP_WORDS[1]} != "debug" ]; then
|
||||||
if [ ${COMP_WORDS[2]} == "create" ]; then
|
if [ ${COMP_WORDS[2]} == "create" ]; then
|
||||||
retlist="--wpsc --wpfc --user --email --pass --wpredis --wprocket --wpce --letsencrypt --letsencrypt=subdomain --letsencrypt=wildcard -le --php73 --dns --dns=dns_cf --dns=dns_do"
|
retlist="--wpsc --wpfc --user --email --pass --wpredis --wprocket --wpce --letsencrypt --letsencrypt=wildcard -le --php73 --dns --dns=dns_cf --dns=dns_do"
|
||||||
elif [ ${COMP_WORDS[2]} == "update" ]; then
|
elif [ ${COMP_WORDS[2]} == "update" ]; then
|
||||||
retlist="--wpfc --wpsc --php73 --php73=off --wpredis --wprocket --wpce --letsencrypt --letsencrypt=subdomain --letsencrypt=wildcard --letsencrypt=off --letsencrypt=renew --letsencrypt=clean -le --dns --dns=dns_cf --dns=dns_do"
|
retlist="--wpfc --wpsc --php73 --php73=off --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard --letsencrypt=off --letsencrypt=clean --dns --dns=dns_cf --dns=dns_do"
|
||||||
else
|
else
|
||||||
retlist=""
|
retlist=""
|
||||||
fi
|
fi
|
||||||
@@ -248,7 +248,7 @@ _wo_complete()
|
|||||||
|
|
||||||
"--wpredis --wprocket --wpce" | "--wpfc" | "--wpsc" | "--wpsubdir" | "--wpsubdomain" | "--user" | "--pass" | "--email" | "--wp")
|
"--wpredis --wprocket --wpce" | "--wpfc" | "--wpsc" | "--wpsubdir" | "--wpsubdomain" | "--user" | "--pass" | "--email" | "--wp")
|
||||||
if [ ${COMP_WORDS[2]} == "create" ]; then
|
if [ ${COMP_WORDS[2]} == "create" ]; then
|
||||||
retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --php73 --letsencrypt --letsencrypt=subdomain --letsencrypt=wildcard -le --dns --dns=dns_cf --dns=dns_do"
|
retlist="--user --pass --email --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --php73 -le --letsencrypt --letsencrypt=wildcard --dns --dns=dns_cf --dns=dns_do"
|
||||||
else
|
else
|
||||||
retlist=""
|
retlist=""
|
||||||
fi
|
fi
|
||||||
@@ -261,7 +261,7 @@ _wo_complete()
|
|||||||
|
|
||||||
"--wpredis --wprocket --wpce" | "--wpfc")
|
"--wpredis --wprocket --wpce" | "--wpfc")
|
||||||
if [ ${COMP_WORDS[2]} == "update" ]; then
|
if [ ${COMP_WORDS[2]} == "update" ]; then
|
||||||
retlist="--password --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --letsencrypt --letsencrypt=subdomain --letsencrypt=off --letsencrypt=renew --letsencrypt=clean -le --dns --dns=dns_cf --dns=dns_do"
|
retlist="--password --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=off --letsencrypt=clean --dns --dns=dns_cf --dns=dns_do"
|
||||||
else
|
else
|
||||||
retlist=""
|
retlist=""
|
||||||
fi
|
fi
|
||||||
@@ -314,7 +314,7 @@ _wo_complete()
|
|||||||
elif [ ${COMP_WORDS[2]} == "delete" ]; then
|
elif [ ${COMP_WORDS[2]} == "delete" ]; then
|
||||||
retlist="--db --files --force"
|
retlist="--db --files --force"
|
||||||
elif [ ${COMP_WORDS[2]} == "update" ]; then
|
elif [ ${COMP_WORDS[2]} == "update" ]; then
|
||||||
retlist="--password --php --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --letsencrypt --letsencrypt=subdomain --letsencrypt=off --letsencrypt=renew"
|
retlist="--password --php --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --letsencrypt --letsencrypt=off "
|
||||||
else
|
else
|
||||||
retlist=""
|
retlist=""
|
||||||
fi
|
fi
|
||||||
@@ -363,7 +363,7 @@ _wo_complete()
|
|||||||
case "$mprev" in
|
case "$mprev" in
|
||||||
"--user" | "--email" | "--pass")
|
"--user" | "--email" | "--pass")
|
||||||
if [ ${COMP_WORDS[2]} == "create" ]; then
|
if [ ${COMP_WORDS[2]} == "create" ]; then
|
||||||
retlist="--user --pass --email --html --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --letsencrypt --letsencrypt=subdomain --letsencrypt=wildcard -le --dns --dns=dns_cf --dns=dns_do"
|
retlist="--user --pass --email --html --php --php73 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --letsencrypt --letsencrypt=wildcard -le --dns --dns=dns_cf --dns=dns_do"
|
||||||
fi
|
fi
|
||||||
ret="${retlist[@]/$prev}"
|
ret="${retlist[@]/$prev}"
|
||||||
COMPREPLY=( $(compgen \
|
COMPREPLY=( $(compgen \
|
||||||
|
|||||||
222
install
222
install
@@ -9,7 +9,7 @@
|
|||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# wget -qO wo wops.cc && sudo bash wo
|
# wget -qO wo wops.cc && sudo bash wo
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Version 3.9.8.4 - 2019-08-28
|
# Version 3.9.8.5 - 2019-08-28
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
# CONTENTS
|
# CONTENTS
|
||||||
@@ -103,7 +103,11 @@ export DEBIAN_FRONTEND=noninteractive
|
|||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$(command -v curl)" ]; then
|
command_exists() {
|
||||||
|
command -v "$@" > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! command_exists curl; then
|
||||||
apt-get -y install curl -qq
|
apt-get -y install curl -qq
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -120,9 +124,9 @@ echo ""
|
|||||||
###
|
###
|
||||||
# 1- Check whether lsb_release is installed, and if not, install it
|
# 1- Check whether lsb_release is installed, and if not, install it
|
||||||
###
|
###
|
||||||
if [ -z "$(command -v lsb_release)" ]; then
|
if ! command_exists lsb_release; then
|
||||||
wo_lib_echo "Installing lsb-release, please wait..."
|
wo_lib_echo "Installing lsb-release, please wait..."
|
||||||
apt-get -y install lsb-release -qq
|
apt-get install lsb-release -qq
|
||||||
fi
|
fi
|
||||||
|
|
||||||
###
|
###
|
||||||
@@ -191,11 +195,9 @@ fi
|
|||||||
####
|
####
|
||||||
|
|
||||||
wo_dist_upgrade() {
|
wo_dist_upgrade() {
|
||||||
[ -z "$wo_travis" ] && {
|
# update server packages
|
||||||
# update server packages
|
apt-get dist-upgrade --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet
|
||||||
apt-get dist-upgrade --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet
|
} >> "$wo_install_log" 2>&1
|
||||||
} >> "$wo_install_log" 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
wo_install_dep() {
|
wo_install_dep() {
|
||||||
|
|
||||||
@@ -223,17 +225,19 @@ wo_install_dep() {
|
|||||||
if [ ! -f /etc/apt/apt.conf.d/20auto-upgrades ]; then
|
if [ ! -f /etc/apt/apt.conf.d/20auto-upgrades ]; then
|
||||||
cp /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades
|
cp /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades
|
||||||
fi
|
fi
|
||||||
# set default ntp pools
|
|
||||||
if ! grep -q "time.cloudflare.com" /etc/systemd/timesyncd.conf; then
|
|
||||||
sed -e 's/^#NTP=/NTP=time.cloudflare.com 0.ubuntu.pool.ntp.org 1.ubuntu.pool.ntp.org 2.ubuntu.pool.ntp.org 3.ubuntu.pool.ntp.org/' -i /etc/systemd/timesyncd.conf
|
|
||||||
# enable ntp
|
|
||||||
timedatectl set-ntp 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
} >> "$wo_install_log" 2>&1
|
} >> "$wo_install_log" 2>&1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wo_timesync() {
|
||||||
|
# set default ntp pools
|
||||||
|
if ! grep -q "time.cloudflare.com" /etc/systemd/timesyncd.conf; then
|
||||||
|
sed -e 's/^#NTP=/NTP=time.cloudflare.com 0.ubuntu.pool.ntp.org 1.ubuntu.pool.ntp.org 2.ubuntu.pool.ntp.org 3.ubuntu.pool.ntp.org/' -i /etc/systemd/timesyncd.conf
|
||||||
|
# enable ntp
|
||||||
|
timedatectl set-ntp 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
# 3 - Create/migrate the essentials
|
# 3 - Create/migrate the essentials
|
||||||
###
|
###
|
||||||
@@ -499,7 +503,7 @@ wo_upgrade_nginx() {
|
|||||||
service nginx stop
|
service nginx stop
|
||||||
# remove previous package
|
# remove previous package
|
||||||
apt-mark unhold nginx-ee nginx-common nginx-custom
|
apt-mark unhold nginx-ee nginx-common nginx-custom
|
||||||
apt-get --assume-yes purge nginx-ee nginx-common nginx-custom --allow-change-held-packages
|
apt-get autoremove nginx-ee nginx-common nginx-custom --allow-change-held-packages --purge -qq
|
||||||
# remove previous php-fpm pool configuration
|
# remove previous php-fpm pool configuration
|
||||||
if [ -n "$CHECK_PHP72" ]; then
|
if [ -n "$CHECK_PHP72" ]; then
|
||||||
apt-get purge php7.2-fpm -y -qq
|
apt-get purge php7.2-fpm -y -qq
|
||||||
@@ -511,13 +515,11 @@ wo_upgrade_nginx() {
|
|||||||
/usr/local/bin/wo stack install --nginx --php
|
/usr/local/bin/wo stack install --nginx --php
|
||||||
rm -f /etc/nginx/common/acl.conf /etc/nginx/htpasswd-wo
|
rm -f /etc/nginx/common/acl.conf /etc/nginx/htpasswd-wo
|
||||||
/usr/bin/rsync -au --noatime /var/lib/wo-backup/nginx/ /etc/nginx/
|
/usr/bin/rsync -au --noatime /var/lib/wo-backup/nginx/ /etc/nginx/
|
||||||
|
/usr/local/bin/wo stack upgrade --nginx --force
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
/usr/local/bin/wo stack upgrade --nginx --force
|
|
||||||
fi
|
fi
|
||||||
# restore sites and configuration
|
# restore sites and configuration
|
||||||
[ -f /etc/nginx/htpasswd-ee ] && { mv /etc/nginx/htpasswd-ee /etc/nginx/htpasswd-wo; }
|
[ -f /etc/nginx/htpasswd-ee ] && { cp -f /etc/nginx/htpasswd-ee /etc/nginx/htpasswd-wo; }
|
||||||
sed -i "s/locations.conf/locations-wo.conf/" /etc/nginx/sites-available/*
|
sed -i "s/locations.conf/locations-wo.conf/" /etc/nginx/sites-available/*
|
||||||
sed -i "s/locations-php7.conf/locations-wo.conf/" /etc/nginx/sites-available/*
|
sed -i "s/locations-php7.conf/locations-wo.conf/" /etc/nginx/sites-available/*
|
||||||
sed -i "s/locations-php71.conf/locations-wo.conf/" /etc/nginx/sites-available/*
|
sed -i "s/locations-php71.conf/locations-wo.conf/" /etc/nginx/sites-available/*
|
||||||
@@ -695,14 +697,14 @@ wo_mariadb_tweak() {
|
|||||||
wo_nginx_tweak() {
|
wo_nginx_tweak() {
|
||||||
# increase nginx open_files_limit
|
# increase nginx open_files_limit
|
||||||
{
|
{
|
||||||
if [ ! -d /etc/systemd/system/nginx.service.d ]; then
|
if [ ! -d /etc/systemd/system/nginx.service.d ]; then
|
||||||
mkdir -p /etc/systemd/system/nginx.service.d
|
mkdir -p /etc/systemd/system/nginx.service.d
|
||||||
if [ ! -f /etc/systemd/system/nginx.service.d/limits.conf ]; then
|
if [ ! -f /etc/systemd/system/nginx.service.d/limits.conf ]; then
|
||||||
echo -e '[Service]\nLimitNOFILE=500000' > /etc/systemd/system/nginx.service.d/limits.conf
|
echo -e '[Service]\nLimitNOFILE=500000' > /etc/systemd/system/nginx.service.d/limits.conf
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
nginx -t && service nginx restart
|
nginx -t && service nginx restart
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
} >> /var/log/wo/install.log 2>&1
|
} >> /var/log/wo/install.log 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -714,6 +716,12 @@ wo_uninstall() {
|
|||||||
rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates >> /var/log/wo/install.log 2>&1
|
rm -rf /usr/local/lib/python3.*/dist-packages/{pystache-*,cement-2.*,wo-*} /usr/local/bin/wo /etc/bash_completion.d/wo_auto.rc /var/lib/wo /etc/wo /usr/lib/wo/templates >> /var/log/wo/install.log 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wo_cheat_alias() {
|
||||||
|
if ! grep -q "cheat" "$HOME/.bashrc"; then
|
||||||
|
echo "alias cheat='/usr/local/bin/cht.sh'" >> "$HOME/.bashrc"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
wo_ufw_setup() {
|
wo_ufw_setup() {
|
||||||
|
|
||||||
# get custom ssh port
|
# get custom ssh port
|
||||||
@@ -792,37 +800,90 @@ 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 {
|
||||||
wo -v 2>&1 | grep -q "$wo_version_new"
|
wo -v 2>&1 | grep -q "$wo_version_new"
|
||||||
} || [ "$wo_force_install" = "y" ]; then
|
} && [ -z "$wo_force_install" ]; then
|
||||||
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
|
wo_lib_error "You already have WordOps $wo_version_new"
|
||||||
wo_install_dep | tee -ai $wo_install_log
|
exit 1
|
||||||
wo_lib_echo "Backing-up WO install" | tee -ai $wo_install_log
|
fi
|
||||||
wo_backup_wo | tee -ai $wo_install_log
|
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
|
||||||
secure_wo_db | tee -ai $wo_install_log
|
wo_install_dep | tee -ai $wo_install_log
|
||||||
wo_lib_echo "Installing WordOps " | tee -ai $wo_install_log
|
wo_timesync | tee -ai $wo_install_log
|
||||||
wo_clean | tee -ai $wo_install_log
|
wo_lib_echo "Backing-up WO install" | tee -ai $wo_install_log
|
||||||
if [ "$wo_travis" = "y" ]; then
|
wo_backup_wo | tee -ai $wo_install_log
|
||||||
wo_install_travis | tee -ai $wo_install_log
|
secure_wo_db | tee -ai $wo_install_log
|
||||||
|
wo_lib_echo "Installing WordOps " | tee -ai $wo_install_log
|
||||||
|
wo_clean | tee -ai $wo_install_log
|
||||||
|
if [ "$wo_travis" = "y" ]; then
|
||||||
|
wo_install_travis | tee -ai $wo_install_log
|
||||||
|
else
|
||||||
|
if [ -f "$HOME/.gitconfig" ]; then
|
||||||
|
wo_install >> $wo_install_log 2>&1
|
||||||
else
|
else
|
||||||
if [ -f "$HOME/.gitconfig" ]; then
|
wo_install | tee -ai $wo_install_log
|
||||||
wo_install >> $wo_install_log 2>&1
|
fi
|
||||||
else
|
fi
|
||||||
wo_install | tee -ai $wo_install_log
|
wo_update_latest | tee -ai $wo_install_log
|
||||||
|
if [ ! -d /opt/acme/.sh ]; then
|
||||||
|
wo_lib_echo "Updating acme.sh" | tee -ai $wo_install_log
|
||||||
|
wo_install_acme_sh | tee -ai $wo_install_log
|
||||||
|
fi
|
||||||
|
wo_lib_echo "Applying Kernel tweaks" | tee -ai $wo_install_log
|
||||||
|
wo_tweak_kernel | tee -ai $wo_install_log
|
||||||
|
if [ ! -f /opt/wo-kernel.sh ]; then
|
||||||
|
wo_lib_echo "Adding systemd service tweak" | tee -ai $wo_install_log
|
||||||
|
wo_systemd_tweak | tee -ai $wo_install_log
|
||||||
|
fi
|
||||||
|
if [ -x /usr/sbin/nginx ]; then
|
||||||
|
wo_nginx_tweak | tee -ai $wo_install_log
|
||||||
|
fi
|
||||||
|
if [ -d /etc/systemd/system/mariadb.service.d ]; then
|
||||||
|
wo_mariadb_tweak | tee -ai $wo_install_log
|
||||||
|
fi
|
||||||
|
wo_cheat_alias | tee -ai $wo_install_log
|
||||||
|
wo_domain_suffix | tee -ai $wo_install_log
|
||||||
|
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
||||||
|
wo_update_wp_cli | tee -ai $wo_install_log
|
||||||
|
else
|
||||||
|
# 2 - Migration from EEv3
|
||||||
|
if [ -x /usr/local/bin/ee ]; then
|
||||||
|
if [ -z "$wo_force_install" ]; then
|
||||||
|
echo -e "Migrate from EasyEngine to WordOps (y/n): " && read -r WO_ANSWER
|
||||||
|
if [ "$WO_ANSWER" != "y" ] && [ "$WO_ANSWER" != "Y" ]; then
|
||||||
|
wo_lib_error "Not installing WordOps, exit status = " 1
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
wo_update_latest | tee -ai $wo_install_log
|
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
|
||||||
if [ ! -d /opt/acme/.sh ]; then
|
wo_install_dep | tee -ai $wo_install_log
|
||||||
wo_lib_echo "Updating acme.sh" | tee -ai $wo_install_log
|
wo_timesync | tee -ai $wo_install_log
|
||||||
wo_install_acme_sh | tee -ai $wo_install_log
|
wo_lib_echo "Backing-up EE install" | tee -ai $wo_install_log
|
||||||
|
wo_backup_ee | tee -ai $wo_install_log
|
||||||
|
wo_lib_echo "Removing EasyEngine cronjob" | tee -ai $wo_install_log
|
||||||
|
wo_remove_ee_cron | tee -ai $wo_install_log
|
||||||
|
wo_lib_echo "Syncing WO database" | tee -ai $wo_install_log
|
||||||
|
wo_sync_db | tee -ai $wo_install_log
|
||||||
|
secure_wo_db | tee -ai $wo_install_log
|
||||||
|
wo_lib_echo "Installing WordOps " | tee -ai $wo_install_log
|
||||||
|
if [ -f "$HOME/.gitconfig" ]; then
|
||||||
|
wo_install >> $wo_install_log 2>&1
|
||||||
|
else
|
||||||
|
wo_install | tee -ai $wo_install_log
|
||||||
fi
|
fi
|
||||||
|
if command_exists nginx; then
|
||||||
|
wo_lib_echo "Upgrading Nginx" | tee -ai $wo_install_log
|
||||||
|
wo_upgrade_nginx | tee -ai $wo_install_log
|
||||||
|
fi
|
||||||
|
wo_update_latest | tee -ai $wo_install_log
|
||||||
|
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
|
||||||
|
wo_install_acme_sh | tee -ai $wo_install_log
|
||||||
wo_lib_echo "Applying Kernel tweaks" | tee -ai $wo_install_log
|
wo_lib_echo "Applying Kernel tweaks" | tee -ai $wo_install_log
|
||||||
wo_tweak_kernel | tee -ai $wo_install_log
|
wo_tweak_kernel | tee -ai $wo_install_log
|
||||||
if [ ! -f /opt/wo-kernel.sh ]; then
|
if [ ! -f /opt/wo-kernel.sh ]; then
|
||||||
wo_lib_echo "Adding systemd service tweak" | tee -ai $wo_install_log
|
wo_lib_echo "Adding systemd service tweak" | tee -ai $wo_install_log
|
||||||
wo_systemd_tweak | tee -ai $wo_install_log
|
wo_systemd_tweak | tee -ai $wo_install_log
|
||||||
fi
|
fi
|
||||||
if [ -x /usr/sbin/nginx ]; then
|
if command_exists nginx; then
|
||||||
wo_nginx_tweak | tee -ai $wo_install_log
|
wo_nginx_tweak | tee -ai $wo_install_log
|
||||||
fi
|
fi
|
||||||
if [ -d /etc/systemd/system/mariadb.service.d ]; then
|
if [ -d /etc/systemd/system/mariadb.service.d ]; then
|
||||||
@@ -830,67 +891,19 @@ else
|
|||||||
fi
|
fi
|
||||||
wo_domain_suffix | tee -ai $wo_install_log
|
wo_domain_suffix | tee -ai $wo_install_log
|
||||||
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
||||||
|
wo_git_init | tee -ai $wo_install_log
|
||||||
wo_update_wp_cli | tee -ai $wo_install_log
|
wo_update_wp_cli | tee -ai $wo_install_log
|
||||||
else
|
wo_cheat_alias | tee -ai $wo_install_log
|
||||||
wo_lib_error "You already have WordOps $wo_version_new, exit status = " 1
|
wo_lib_echo "Cleaning-up EE previous install" | tee -ai $wo_install_log
|
||||||
fi
|
wo_clean_ee | tee -ai $wo_install_log
|
||||||
else
|
|
||||||
# 2 - Migration from EEv3
|
|
||||||
if [ -x /usr/local/bin/ee ]; then
|
|
||||||
if [ -z "$wo_force_install" ]; then
|
|
||||||
echo -e "Migrate from EasyEngine to WordOps (y/n): " && read -r WO_ANSWER
|
|
||||||
else
|
|
||||||
WO_ANSWER="y"
|
|
||||||
fi
|
|
||||||
if [ "$WO_ANSWER" = "y" ] || [ "$WO_ANSWER" = "Y" ]; then
|
|
||||||
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
|
|
||||||
wo_install_dep | tee -ai $wo_install_log
|
|
||||||
wo_lib_echo "Backing-up EE install" | tee -ai $wo_install_log
|
|
||||||
wo_backup_ee | tee -ai $wo_install_log
|
|
||||||
wo_lib_echo "Removing EasyEngine cronjob" | tee -ai $wo_install_log
|
|
||||||
wo_remove_ee_cron | tee -ai $wo_install_log
|
|
||||||
wo_lib_echo "Syncing WO database" | tee -ai $wo_install_log
|
|
||||||
wo_sync_db | tee -ai $wo_install_log
|
|
||||||
secure_wo_db | tee -ai $wo_install_log
|
|
||||||
wo_lib_echo "Installing WordOps " | tee -ai $wo_install_log
|
|
||||||
if [ -f "$HOME/.gitconfig" ]; then
|
|
||||||
wo_install >> $wo_install_log 2>&1
|
|
||||||
else
|
|
||||||
wo_install | tee -ai $wo_install_log
|
|
||||||
fi
|
|
||||||
if [ -n "$(command -v nginx)" ]; then
|
|
||||||
wo_lib_echo "Upgrading Nginx" | tee -ai $wo_install_log
|
|
||||||
wo_upgrade_nginx | tee -ai $wo_install_log
|
|
||||||
fi
|
|
||||||
wo_update_latest | tee -ai $wo_install_log
|
|
||||||
wo_lib_echo "Installing acme.sh" | tee -ai $wo_install_log
|
|
||||||
wo_install_acme_sh | tee -ai $wo_install_log
|
|
||||||
wo_lib_echo "Applying Kernel tweaks" | tee -ai $wo_install_log
|
|
||||||
wo_tweak_kernel | tee -ai $wo_install_log
|
|
||||||
if [ ! -f /opt/wo-kernel.sh ]; then
|
|
||||||
wo_lib_echo "Adding systemd service tweak" | tee -ai $wo_install_log
|
|
||||||
wo_systemd_tweak | tee -ai $wo_install_log
|
|
||||||
fi
|
|
||||||
if [ -x /usr/sbin/nginx ]; then
|
|
||||||
wo_nginx_tweak | tee -ai $wo_install_log
|
|
||||||
fi
|
|
||||||
if [ -d /etc/systemd/system/mariadb.service.d ]; then
|
|
||||||
wo_mariadb_tweak | tee -ai $wo_install_log
|
|
||||||
fi
|
|
||||||
wo_domain_suffix | tee -ai $wo_install_log
|
|
||||||
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
|
||||||
wo_git_init | tee -ai $wo_install_log
|
|
||||||
wo_update_wp_cli | tee -ai $wo_install_log
|
|
||||||
wo_lib_echo "Cleaning-up EE previous install" | tee -ai $wo_install_log
|
|
||||||
wo_clean_ee | tee -ai $wo_install_log
|
|
||||||
else
|
|
||||||
wo_lib_error "Not installing WordOps, exit status = " 1
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
# 3 - Fresh WO setup
|
# 3 - Fresh WO setup
|
||||||
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
|
wo_lib_echo "Installing wo dependencies " | tee -ai $wo_install_log
|
||||||
wo_dist_upgrade | tee -ai $wo_install_log
|
[ -z "$wo_travis" ] && {
|
||||||
|
wo_dist_upgrade | 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_lib_echo "Installing WordOps " | tee -ai $wo_install_log
|
wo_lib_echo "Installing WordOps " | tee -ai $wo_install_log
|
||||||
if [ "$wo_travis" = "y" ]; then
|
if [ "$wo_travis" = "y" ]; then
|
||||||
wo_install_travis | tee -ai $wo_install_log
|
wo_install_travis | tee -ai $wo_install_log
|
||||||
@@ -915,6 +928,7 @@ else
|
|||||||
wo_install_acme_sh | tee -ai $wo_install_log
|
wo_install_acme_sh | tee -ai $wo_install_log
|
||||||
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
wo_lib_echo "Running post-install steps " | tee -ai $wo_install_log
|
||||||
secure_wo_db | tee -ai $wo_install_log
|
secure_wo_db | tee -ai $wo_install_log
|
||||||
|
wo_cheat_alias | tee -ai $wo_install_log
|
||||||
wo_domain_suffix | tee -ai $wo_install_log
|
wo_domain_suffix | tee -ai $wo_install_log
|
||||||
wo_git_init | tee -ai $wo_install_log
|
wo_git_init | tee -ai $wo_install_log
|
||||||
wo_update_wp_cli | tee -ai $wo_install_log
|
wo_update_wp_cli | tee -ai $wo_install_log
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -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.4',
|
version='3.9.8.5',
|
||||||
description=long_description,
|
description=long_description,
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
classifiers=[],
|
classifiers=[],
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ exit_script() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ! {
|
if ! {
|
||||||
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
|
echo -e ' stack install '
|
||||||
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
wo --help && wo stack install && wo stack install --proftpd
|
wo --help && wo stack install && wo stack install --proftpd
|
||||||
}; then
|
}; then
|
||||||
exit_script
|
exit_script
|
||||||
@@ -43,7 +46,8 @@ if ! {
|
|||||||
echo -e ' wo site update '
|
echo -e ' wo site update '
|
||||||
echo -e "${CGREEN}#############################################${CEND}"
|
echo -e "${CGREEN}#############################################${CEND}"
|
||||||
wo site create 1.com --html && wo site create 2.com --php && wo site create 3.com --mysql
|
wo site create 1.com --html && wo site create 2.com --php && wo site create 3.com --mysql
|
||||||
wo site update 1.com --wp && wo site update 2.com --php73 && wo site update 3.com --php73 && wo site update 1.com --wpfc && wo site update 1.com --wpsc && wo site update 1.com --wpredis
|
wo site update 1.com --wp && wo site update 2.com --php73 && wo site update 3.com --php73
|
||||||
|
wo site update 1.com --wp && wo site update 1.com --wpfc && wo site update 1.com --wpsc && wo site update 1.com --wpredis && wo site update 1.com --wpce && wo site update 1.com --wprocket && wo site update 1.com --php73=off
|
||||||
}; then
|
}; then
|
||||||
exit_script
|
exit_script
|
||||||
fi
|
fi
|
||||||
@@ -60,9 +64,9 @@ if ! {
|
|||||||
}; then
|
}; then
|
||||||
exit_script
|
exit_script
|
||||||
fi
|
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}"
|
||||||
wp --allow-root --info
|
wp --allow-root --info
|
||||||
cat /etc/nginx/nginx.conf
|
cat /etc/nginx/nginx.conf
|
||||||
wo site info wp1.com
|
wo site info wp1.com
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class WOCleanController(CementBaseController):
|
|||||||
stacked_on = 'base'
|
stacked_on = 'base'
|
||||||
stacked_type = 'nested'
|
stacked_type = 'nested'
|
||||||
description = (
|
description = (
|
||||||
'Clean NGINX FastCGI cache, Opcache, Memcached, Redis Cache')
|
'Clean NGINX FastCGI cache, Opcache, Redis Cache')
|
||||||
arguments = [
|
arguments = [
|
||||||
(['--all'],
|
(['--all'],
|
||||||
dict(help='Clean all cache', action='store_true')),
|
dict(help='Clean all cache', action='store_true')),
|
||||||
|
|||||||
@@ -957,10 +957,9 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
Log.error(self, 'Unable to input site name, Please try again!')
|
Log.error(self, 'Unable to input site name, Please try again!')
|
||||||
|
|
||||||
pargs.site_name = pargs.site_name.strip()
|
pargs.site_name = pargs.site_name.strip()
|
||||||
(wo_domain,
|
(wo_domain, wo_www_domain) = ValidateDomain(pargs.site_name)
|
||||||
wo_www_domain, ) = ValidateDomain(pargs.site_name)
|
|
||||||
wo_site_webroot = WOVariables.wo_webroot + wo_domain
|
wo_site_webroot = WOVariables.wo_webroot + wo_domain
|
||||||
wo_domain_type, wo_root_domain = GetDomainlevel(wo_domain)
|
(wo_domain_type, wo_root_domain) = GetDomainlevel(wo_domain)
|
||||||
check_site = getSiteInfo(self, wo_domain)
|
check_site = getSiteInfo(self, wo_domain)
|
||||||
|
|
||||||
if check_site is None:
|
if check_site is None:
|
||||||
@@ -1198,14 +1197,14 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
return 0
|
return 0
|
||||||
min_expiry_days = 45
|
min_expiry_days = 45
|
||||||
if (expiry_days <= min_expiry_days):
|
if (expiry_days <= min_expiry_days):
|
||||||
renewLetsEncrypt(self, ee_domain)
|
renewLetsEncrypt(self, wo_domain)
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
Log.error(self, "service nginx reload failed. "
|
Log.error(self, "service nginx reload failed. "
|
||||||
"check issues with `nginx -t` command")
|
"check issues with `nginx -t` command")
|
||||||
Log.info(self, "SUCCESS: Certificate was successfully "
|
Log.info(self, "SUCCESS: Certificate was successfully "
|
||||||
"renewed For https://{0}".format(wo_domain))
|
"renewed For https://{0}".format(wo_domain))
|
||||||
elif pargs.force:
|
elif pargs.force:
|
||||||
renewLetsEncrypt(self, ee_domain)
|
renewLetsEncrypt(self, wo_domain)
|
||||||
Log.info(self, "Certificate was successfully renewed")
|
Log.info(self, "Certificate was successfully renewed")
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
Log.error(self, "service nginx reload failed. "
|
Log.error(self, "service nginx reload failed. "
|
||||||
|
|||||||
@@ -989,8 +989,6 @@ def display_cache_settings(self, data):
|
|||||||
"page=nginx".format(data['site_name']))
|
"page=nginx".format(data['site_name']))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def logwatch(self, logfiles):
|
def logwatch(self, logfiles):
|
||||||
import zlib
|
import zlib
|
||||||
import base64
|
import base64
|
||||||
@@ -1012,8 +1010,8 @@ def logwatch(self, logfiles):
|
|||||||
'caught exception rendering a new log line in %s'
|
'caught exception rendering a new log line in %s'
|
||||||
% filename)
|
% filename)
|
||||||
|
|
||||||
l = logwatch.LogWatcher(logfiles, callback)
|
logl = logwatch.LogWatcher(logfiles, callback)
|
||||||
l.loop()
|
logl.loop()
|
||||||
|
|
||||||
|
|
||||||
def detSitePar(opts):
|
def detSitePar(opts):
|
||||||
@@ -1243,10 +1241,19 @@ def removeAcmeConf(self, domain):
|
|||||||
.format(domain))
|
.format(domain))
|
||||||
WOFileUtils.rm(self, '/etc/nginx/conf.d/force-ssl-{0}.conf.disabled'
|
WOFileUtils.rm(self, '/etc/nginx/conf.d/force-ssl-{0}.conf.disabled'
|
||||||
.format(domain))
|
.format(domain))
|
||||||
|
if WOFileUtils.grepcheck(self, '/var/www/22222/conf/nginx/ssl.conf',
|
||||||
WOGit.add(self, ["/etc/letsencrypt"],
|
'{0}'.format(domain)):
|
||||||
msg="Deleted {0} "
|
Log.info(self, "Setting back default certificate for WordOps backend")
|
||||||
.format(domain))
|
with open("/var/www/22222/conf/nginx/"
|
||||||
|
"ssl.conf", "w") as ssl_conf_file:
|
||||||
|
ssl_conf_file.write("ssl_certificate "
|
||||||
|
"/var/www/22222/cert/22222.crt;\n"
|
||||||
|
"ssl_certificate_key "
|
||||||
|
"/var/www/22222/cert/22222.key;\n")
|
||||||
|
WOGit.add(self, ["/etc/letsencrypt"],
|
||||||
|
msg="Deleted {0} "
|
||||||
|
.format(domain))
|
||||||
|
WOService.restart_service(self, "nginx")
|
||||||
|
|
||||||
|
|
||||||
def site_url_https(self, domain):
|
def site_url_https(self, domain):
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import re
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
# from pynginxconfig import NginxConfig
|
# from pynginxconfig import NginxConfig
|
||||||
from wo.cli.plugins.site_functions import *
|
from wo.cli.plugins.site_functions import *
|
||||||
from wo.cli.plugins.sitedb import *
|
from wo.cli.plugins.sitedb import *
|
||||||
@@ -91,7 +92,7 @@ class WOStackController(CementBaseController):
|
|||||||
(['--utils'],
|
(['--utils'],
|
||||||
dict(help='Install Utils stack', action='store_true')),
|
dict(help='Install Utils stack', action='store_true')),
|
||||||
(['--cheat'],
|
(['--cheat'],
|
||||||
dict(help='Install cht.sh stack', action='store_true')),
|
dict(help='Install cheat.sh stack', action='store_true')),
|
||||||
(['--redis'],
|
(['--redis'],
|
||||||
dict(help='Install Redis', action='store_true')),
|
dict(help='Install Redis', action='store_true')),
|
||||||
(['--phpredisadmin'],
|
(['--phpredisadmin'],
|
||||||
@@ -114,6 +115,7 @@ class WOStackController(CementBaseController):
|
|||||||
"""Start installation of packages"""
|
"""Start installation of packages"""
|
||||||
self.msg = []
|
self.msg = []
|
||||||
empty_packages = []
|
empty_packages = []
|
||||||
|
wo_webroot = "/var/www/"
|
||||||
pargs = self.app.pargs
|
pargs = self.app.pargs
|
||||||
try:
|
try:
|
||||||
# Default action for stack installation
|
# Default action for stack installation
|
||||||
@@ -122,8 +124,8 @@ class WOStackController(CementBaseController):
|
|||||||
(not pargs.mysql) and (not pargs.wpcli) and
|
(not pargs.mysql) and (not pargs.wpcli) and
|
||||||
(not pargs.phpmyadmin) and (not pargs.composer) and
|
(not pargs.phpmyadmin) and (not pargs.composer) and
|
||||||
(not pargs.netdata) and (not pargs.dashboard) and
|
(not pargs.netdata) and (not pargs.dashboard) and
|
||||||
(not pargs.fail2ban) and (not pargs.security)
|
(not pargs.fail2ban) and (not pargs.security) and
|
||||||
and (not pargs.mysqlclient) and (not pargs.mysqltuner) and
|
(not pargs.mysqlclient) and (not pargs.mysqltuner) and
|
||||||
(not pargs.adminer) and (not pargs.utils) and
|
(not pargs.adminer) and (not pargs.utils) and
|
||||||
(not pargs.redis) and (not pargs.proftpd) and
|
(not pargs.redis) and (not pargs.proftpd) and
|
||||||
(not pargs.extplorer) and
|
(not pargs.extplorer) and
|
||||||
@@ -140,7 +142,7 @@ class WOStackController(CementBaseController):
|
|||||||
pargs.php73 = True
|
pargs.php73 = True
|
||||||
pargs.redis = True
|
pargs.redis = True
|
||||||
pargs.proftpd = True
|
pargs.proftpd = True
|
||||||
pargs.clamav = True
|
pargs.security = True
|
||||||
|
|
||||||
if pargs.web:
|
if pargs.web:
|
||||||
pargs.nginx = True
|
pargs.nginx = True
|
||||||
@@ -149,9 +151,9 @@ class WOStackController(CementBaseController):
|
|||||||
pargs.wpcli = True
|
pargs.wpcli = True
|
||||||
|
|
||||||
if pargs.admin:
|
if pargs.admin:
|
||||||
pargs.web = True
|
|
||||||
pargs.adminer = True
|
pargs.adminer = True
|
||||||
pargs.phpmyadmin = True
|
pargs.phpmyadmin = True
|
||||||
|
pargs.composer = True
|
||||||
pargs.utils = True
|
pargs.utils = True
|
||||||
pargs.netdata = True
|
pargs.netdata = True
|
||||||
pargs.dashboard = True
|
pargs.dashboard = True
|
||||||
@@ -163,14 +165,6 @@ class WOStackController(CementBaseController):
|
|||||||
pargs.fail2ban = True
|
pargs.fail2ban = True
|
||||||
pargs.clamav = True
|
pargs.clamav = True
|
||||||
|
|
||||||
# Redis
|
|
||||||
if pargs.redis:
|
|
||||||
if not WOAptGet.is_installed(self, 'redis-server'):
|
|
||||||
apt_packages = apt_packages + WOVariables.wo_redis
|
|
||||||
pargs.php = True
|
|
||||||
else:
|
|
||||||
Log.info(self, "Redis already installed")
|
|
||||||
|
|
||||||
# Nginx
|
# Nginx
|
||||||
if pargs.nginx:
|
if pargs.nginx:
|
||||||
Log.debug(self, "Setting apt_packages variable for Nginx")
|
Log.debug(self, "Setting apt_packages variable for Nginx")
|
||||||
@@ -194,6 +188,14 @@ class WOStackController(CementBaseController):
|
|||||||
else:
|
else:
|
||||||
Log.debug(self, "Nginx Stable already installed")
|
Log.debug(self, "Nginx Stable already installed")
|
||||||
|
|
||||||
|
# Redis
|
||||||
|
if pargs.redis:
|
||||||
|
if not WOAptGet.is_installed(self, 'redis-server'):
|
||||||
|
apt_packages = apt_packages + WOVariables.wo_redis
|
||||||
|
pargs.php = True
|
||||||
|
else:
|
||||||
|
Log.info(self, "Redis already installed")
|
||||||
|
|
||||||
# PHP 7.2
|
# PHP 7.2
|
||||||
if pargs.php:
|
if pargs.php:
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
||||||
@@ -226,17 +228,25 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "Setting apt_packages variable for MySQL")
|
Log.debug(self, "Setting apt_packages variable for MySQL")
|
||||||
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
apt_packages = apt_packages + WOVariables.wo_mysql
|
apt_packages = apt_packages + WOVariables.wo_mysql
|
||||||
|
else:
|
||||||
|
Log.debug(self, "MySQL already installed and alive")
|
||||||
|
Log.info(self, "MySQL already installed and alive")
|
||||||
|
|
||||||
# mysqlclient
|
# mysqlclient
|
||||||
if pargs.mysqlclient:
|
if pargs.mysqlclient:
|
||||||
Log.debug(self, "Setting apt_packages variable "
|
Log.debug(self, "Setting apt_packages variable "
|
||||||
"for MySQL Client")
|
"for MySQL Client")
|
||||||
apt_packages = apt_packages + WOVariables.wo_mysql_client
|
if not WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
|
apt_packages = apt_packages + WOVariables.wo_mysql_client
|
||||||
|
else:
|
||||||
|
Log.debug(self, "MySQL already installed and alive")
|
||||||
|
Log.info(self, "MySQL already installed and alive")
|
||||||
|
|
||||||
# WP-CLI
|
# WP-CLI
|
||||||
if pargs.wpcli:
|
if pargs.wpcli:
|
||||||
Log.debug(self, "Setting packages variable for WP-CLI")
|
Log.debug(self, "Setting packages variable for WP-CLI")
|
||||||
if not WOShellExec.cmd_exec(self, "command -v wp"):
|
if (not os.path.isfile("/usr/local/bin/wp") and not
|
||||||
|
os.path.isfile("/usr/bin/wp")):
|
||||||
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
packages = packages + [["https://github.com/wp-cli/wp-cli/"
|
||||||
"releases/download/v{0}/"
|
"releases/download/v{0}/"
|
||||||
"wp-cli-{0}.phar"
|
"wp-cli-{0}.phar"
|
||||||
@@ -276,10 +286,10 @@ class WOStackController(CementBaseController):
|
|||||||
|
|
||||||
# PHPMYADMIN
|
# PHPMYADMIN
|
||||||
if pargs.phpmyadmin:
|
if pargs.phpmyadmin:
|
||||||
|
pargs.composer = True
|
||||||
if not os.path.isdir('/var/www/22222/htdocs/db/pma'):
|
if not os.path.isdir('/var/www/22222/htdocs/db/pma'):
|
||||||
Log.debug(self, "Setting packages variable "
|
Log.debug(self, "Setting packages variable "
|
||||||
"for phpMyAdmin ")
|
"for phpMyAdmin ")
|
||||||
pargs.composer = True
|
|
||||||
packages = packages + [["https://github.com/phpmyadmin/"
|
packages = packages + [["https://github.com/phpmyadmin/"
|
||||||
"phpmyadmin/archive/STABLE.tar.gz",
|
"phpmyadmin/archive/STABLE.tar.gz",
|
||||||
"/var/lib/wo/tmp/pma.tar.gz",
|
"/var/lib/wo/tmp/pma.tar.gz",
|
||||||
@@ -288,6 +298,23 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "phpMyAdmin already installed")
|
Log.debug(self, "phpMyAdmin already installed")
|
||||||
Log.info(self, "phpMyAdmin already installed")
|
Log.info(self, "phpMyAdmin already installed")
|
||||||
|
|
||||||
|
# PHPREDISADMIN
|
||||||
|
if pargs.phpredisadmin:
|
||||||
|
pargs.composer = True
|
||||||
|
if not os.path.isdir('/var/www/22222/htdocs/'
|
||||||
|
'cache/redis/phpRedisAdmin'):
|
||||||
|
Log.debug(
|
||||||
|
self, "Setting packages variable for phpRedisAdmin")
|
||||||
|
packages = packages + [["https://github.com/"
|
||||||
|
"erikdubbelboer/"
|
||||||
|
"phpRedisAdmin/archive"
|
||||||
|
"/v1.11.3.tar.gz",
|
||||||
|
"/var/lib/wo/tmp/pra.tar.gz",
|
||||||
|
"phpRedisAdmin"]]
|
||||||
|
else:
|
||||||
|
Log.debug(self, "phpRedisAdmin already installed")
|
||||||
|
Log.info(self, "phpRedisAdmin already installed")
|
||||||
|
|
||||||
# Composer
|
# Composer
|
||||||
if pargs.composer:
|
if pargs.composer:
|
||||||
if not os.path.isfile('/usr/local/bin/composer'):
|
if not os.path.isfile('/usr/local/bin/composer'):
|
||||||
@@ -300,59 +327,62 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "Composer already installed")
|
Log.debug(self, "Composer already installed")
|
||||||
Log.info(self, "Composer already installed")
|
Log.info(self, "Composer already installed")
|
||||||
|
|
||||||
# PHPREDISADMIN
|
|
||||||
if pargs.phpredisadmin:
|
|
||||||
if not os.path.isdir('/var/www/22222/htdocs/'
|
|
||||||
'cache/redis/phpRedisAdmin'):
|
|
||||||
Log.debug(
|
|
||||||
self, "Setting packages variable for phpRedisAdmin")
|
|
||||||
pargs.composer = True
|
|
||||||
packages = packages + [["https://github.com/"
|
|
||||||
"erikdubbelboer/"
|
|
||||||
"phpRedisAdmin/archive"
|
|
||||||
"/v1.11.3.tar.gz",
|
|
||||||
"/var/lib/wo/tmp/pra.tar.gz",
|
|
||||||
"phpRedisAdmin"]]
|
|
||||||
else:
|
|
||||||
Log.debug(self, "phpRedisAdmin already installed")
|
|
||||||
Log.info(self, "phpRedisAdmin already installed")
|
|
||||||
|
|
||||||
# ADMINER
|
# ADMINER
|
||||||
if pargs.adminer:
|
if pargs.adminer:
|
||||||
Log.debug(self, "Setting packages variable for Adminer ")
|
if not os.path.isfile("{0}22222/htdocs/db/"
|
||||||
packages = packages + [["https://github.com/vrana/adminer/"
|
"adminer/index.php"
|
||||||
"releases/download/v{0}"
|
.format(wo_webroot)):
|
||||||
"/adminer-{0}.php"
|
Log.debug(self, "Setting packages variable for Adminer ")
|
||||||
.format(WOVariables.wo_adminer),
|
packages = packages + [["https://github.com/vrana/adminer/"
|
||||||
"{0}22222/"
|
"releases/download/v{0}"
|
||||||
"htdocs/db/adminer/index.php"
|
"/adminer-{0}.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVariables.wo_adminer),
|
||||||
"Adminer"],
|
"{0}22222/"
|
||||||
["https://raw.githubusercontent.com"
|
"htdocs/db/adminer/index.php"
|
||||||
"/vrana/adminer/master/designs/"
|
.format(WOVariables.wo_webroot),
|
||||||
"pepa-linha/adminer.css",
|
"Adminer"],
|
||||||
"{0}22222/"
|
["https://raw.githubusercontent.com"
|
||||||
"htdocs/db/adminer/adminer.css"
|
"/vrana/adminer/master/designs/"
|
||||||
.format(WOVariables.wo_webroot),
|
"pepa-linha/adminer.css",
|
||||||
"Adminer theme"]]
|
"{0}22222/"
|
||||||
|
"htdocs/db/adminer/adminer.css"
|
||||||
|
.format(WOVariables.wo_webroot),
|
||||||
|
"Adminer theme"]]
|
||||||
|
else:
|
||||||
|
Log.debug(self, "Adminer already installed")
|
||||||
|
Log.info(self, "Adminer already installed")
|
||||||
|
|
||||||
# mysqltuner
|
# mysqltuner
|
||||||
if pargs.mysqltuner:
|
if pargs.mysqltuner:
|
||||||
Log.debug(self, "Setting packages variable for MySQLTuner ")
|
if not os.path.isfile("/usr/bin/mysqltuner"):
|
||||||
packages = packages + [["https://raw."
|
Log.debug(self, "Setting packages variable "
|
||||||
"githubusercontent.com/"
|
"for MySQLTuner ")
|
||||||
"major/MySQLTuner-perl"
|
packages = packages + [["https://raw."
|
||||||
"/master/mysqltuner.pl",
|
"githubusercontent.com/"
|
||||||
"/usr/bin/mysqltuner",
|
"major/MySQLTuner-perl"
|
||||||
"MySQLTuner"]]
|
"/master/mysqltuner.pl",
|
||||||
|
"/usr/bin/mysqltuner",
|
||||||
|
"MySQLTuner"]]
|
||||||
|
else:
|
||||||
|
Log.debug(self, "MySQLtuner already installed")
|
||||||
|
Log.info(self, "MySQLtuner already installed")
|
||||||
|
|
||||||
# Netdata
|
# Netdata
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
Log.debug(self, "Setting packages variable for Netdata")
|
if (not os.path.isdir('/opt/netdata') and not
|
||||||
if not os.path.exists('/opt/netdata'):
|
os.path.isdir("/etc/netdata")):
|
||||||
packages = packages + [['https://my-netdata.io/'
|
Log.debug(
|
||||||
'kickstart-static64.sh',
|
self, "Setting packages variable for Netdata")
|
||||||
'/var/lib/wo/tmp/kickstart.sh',
|
if WOVariables.wo_distro == 'raspbian':
|
||||||
'Netdata']]
|
packages = packages + [['https://my-netdata.io/'
|
||||||
|
'kickstart.sh',
|
||||||
|
'/var/lib/wo/tmp/kickstart.sh',
|
||||||
|
'Netdata']]
|
||||||
|
else:
|
||||||
|
packages = packages + [['https://my-netdata.io/'
|
||||||
|
'kickstart-static64.sh',
|
||||||
|
'/var/lib/wo/tmp/kickstart.sh',
|
||||||
|
'Netdata']]
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "Netdata already installed")
|
Log.debug(self, "Netdata already installed")
|
||||||
Log.info(self, "Netdata already installed")
|
Log.info(self, "Netdata already installed")
|
||||||
@@ -360,14 +390,16 @@ class WOStackController(CementBaseController):
|
|||||||
# WordOps Dashboard
|
# WordOps Dashboard
|
||||||
if pargs.dashboard:
|
if pargs.dashboard:
|
||||||
if not os.path.isfile('/var/www/22222/htdocs/index.php'):
|
if not os.path.isfile('/var/www/22222/htdocs/index.php'):
|
||||||
Log.debug(
|
Log.debug(self,
|
||||||
self, "Setting packages variable for WO-Dashboard")
|
"Setting packages variable for WO-Dashboard")
|
||||||
packages = packages + \
|
packages = \
|
||||||
[["https://github.com/WordOps/wordops-dashboard/"
|
packages + [["https://github.com/WordOps"
|
||||||
"releases/download/v{0}/wordops-dashboard.tar.gz"
|
"/wordops-dashboard/"
|
||||||
.format(WOVariables.wo_dashboard),
|
"releases/download/v{0}/"
|
||||||
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
"wordops-dashboard.tar.gz"
|
||||||
"WordOps Dashboard"]]
|
.format(WOVariables.wo_dashboard),
|
||||||
|
"/var/lib/wo/tmp/wo-dashboard.tar.gz",
|
||||||
|
"WordOps Dashboard"]]
|
||||||
else:
|
else:
|
||||||
Log.debug(self, "WordOps dashboard already installed")
|
Log.debug(self, "WordOps dashboard already installed")
|
||||||
Log.info(self, "WordOps dashboard already installed")
|
Log.info(self, "WordOps dashboard already installed")
|
||||||
@@ -386,6 +418,17 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "eXtplorer is already installed")
|
Log.debug(self, "eXtplorer is already installed")
|
||||||
Log.info(self, "eXtplorer is already installed")
|
Log.info(self, "eXtplorer is already installed")
|
||||||
|
|
||||||
|
# cheat.sh
|
||||||
|
if pargs.cheat:
|
||||||
|
if not os.path.isfile('/usr/local/bin/cht.sh'):
|
||||||
|
Log.debug(self, "Setting packages variable for cht.sh")
|
||||||
|
packages = packages + [["https://cht.sh/:cht.sh",
|
||||||
|
"/usr/local/bin/cht.sh",
|
||||||
|
"cheat.sh"]]
|
||||||
|
else:
|
||||||
|
Log.debug(self, "cheat.sh is already installed")
|
||||||
|
Log.info(self, "cheat.sh is already installed")
|
||||||
|
|
||||||
# UTILS
|
# UTILS
|
||||||
if pargs.utils:
|
if pargs.utils:
|
||||||
Log.debug(self, "Setting packages variable for utils")
|
Log.debug(self, "Setting packages variable for utils")
|
||||||
@@ -408,9 +451,8 @@ class WOStackController(CementBaseController):
|
|||||||
"cache/opcache/opgui.php"
|
"cache/opcache/opgui.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVariables.wo_webroot),
|
||||||
"Opgui"],
|
"Opgui"],
|
||||||
["https://gist.github.com/ck-on/4959032"
|
["https://raw.githubusercontent.com/"
|
||||||
"/raw/0b871b345fd6cfcd6d2be030c1f33d1"
|
"mlazarov/ocp/master/ocp.php",
|
||||||
"ad6a475cb/ocp.php",
|
|
||||||
"{0}22222/htdocs/cache/"
|
"{0}22222/htdocs/cache/"
|
||||||
"opcache/ocp.php"
|
"opcache/ocp.php"
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVariables.wo_webroot),
|
||||||
@@ -426,41 +468,31 @@ class WOStackController(CementBaseController):
|
|||||||
["https://github.com/box/Anemometer/"
|
["https://github.com/box/Anemometer/"
|
||||||
"archive/master.tar.gz",
|
"archive/master.tar.gz",
|
||||||
'/var/lib/wo/tmp/anemometer.tar.gz',
|
'/var/lib/wo/tmp/anemometer.tar.gz',
|
||||||
'Anemometer']
|
'Anemometer']]
|
||||||
]
|
|
||||||
if pargs.cheat:
|
|
||||||
if (not os.path.isfile('/usr/local/bin/cht.sh') and
|
|
||||||
not os.path.isfile('/usr/bin/cht.sh')):
|
|
||||||
Log.debug(self, "Setting packages variable for cht.sh")
|
|
||||||
packages = packages + [["https://cht.sh/:cht.sh",
|
|
||||||
"/usr/local/bin/cht.sh",
|
|
||||||
"cht.sh"]]
|
|
||||||
else:
|
|
||||||
Log.debug(self, "cht.sh is already installed")
|
|
||||||
Log.info(self, "cht.sh is already installed")
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
|
|
||||||
if (apt_packages):
|
if (apt_packages) or (packages):
|
||||||
Log.debug(self, "Calling pre_pref")
|
if (apt_packages):
|
||||||
pre_pref(self, apt_packages)
|
Log.debug(self, "Calling pre_pref")
|
||||||
# meminfo = (os.popen('/bin/cat /proc/meminfo '
|
pre_pref(self, apt_packages)
|
||||||
# '| grep MemTotal').read()).split(":")
|
# meminfo = (os.popen('/bin/cat /proc/meminfo '
|
||||||
# memsplit = re.split(" kB", meminfo[1])
|
# '| grep MemTotal').read()).split(":")
|
||||||
# wo_mem = int(memsplit[0])
|
# memsplit = re.split(" kB", meminfo[1])
|
||||||
# if (wo_mem < 4000000):
|
# wo_mem = int(memsplit[0])
|
||||||
# WOSwap.add(self)
|
# if (wo_mem < 4000000):
|
||||||
Log.info(self, "Updating apt-cache, please wait...")
|
# WOSwap.add(self)
|
||||||
WOAptGet.update(self)
|
Log.info(self, "Updating apt-cache, please wait...")
|
||||||
Log.info(self, "Installing packages, please wait...")
|
WOAptGet.update(self)
|
||||||
WOAptGet.install(self, apt_packages)
|
Log.info(self, "Installing packages, please wait...")
|
||||||
post_pref(self, apt_packages, empty_packages)
|
WOAptGet.install(self, apt_packages)
|
||||||
if (packages):
|
post_pref(self, apt_packages, empty_packages)
|
||||||
Log.debug(self, "Downloading following: {0}".format(packages))
|
if (packages):
|
||||||
WODownload.download(self, packages)
|
Log.debug(self, "Downloading following: {0}".format(packages))
|
||||||
Log.debug(self, "Calling post_pref")
|
WODownload.download(self, packages)
|
||||||
post_pref(self, empty_packages, packages)
|
Log.debug(self, "Calling post_pref")
|
||||||
|
post_pref(self, empty_packages, packages)
|
||||||
|
|
||||||
if disp_msg:
|
if disp_msg:
|
||||||
if (self.msg):
|
if (self.msg):
|
||||||
@@ -478,15 +510,17 @@ class WOStackController(CementBaseController):
|
|||||||
pargs = self.app.pargs
|
pargs = self.app.pargs
|
||||||
if ((not pargs.web) and (not pargs.admin) and
|
if ((not pargs.web) and (not pargs.admin) and
|
||||||
(not pargs.nginx) and (not pargs.php) and
|
(not pargs.nginx) and (not pargs.php) and
|
||||||
(not pargs.php73) and (not pargs.mysql) and
|
(not pargs.mysql) and (not pargs.wpcli) and
|
||||||
(not pargs.wpcli) and (not pargs.phpmyadmin) and
|
(not pargs.phpmyadmin) and (not pargs.composer) and
|
||||||
(not pargs.adminer) and (not pargs.utils) and
|
(not pargs.netdata) and (not pargs.dashboard) and
|
||||||
(not pargs.composer) and (not pargs.netdata) and
|
(not pargs.fail2ban) and (not pargs.security) and
|
||||||
(not pargs.fail2ban) and (not pargs.proftpd) and
|
(not pargs.mysqlclient) and (not pargs.mysqltuner) and
|
||||||
(not pargs.security) and (not pargs.mysqltuner) and
|
(not pargs.adminer) and (not pargs.utils) and
|
||||||
(not pargs.mysqlclient) and
|
(not pargs.redis) and (not pargs.proftpd) and
|
||||||
(not pargs.all) and (not pargs.redis) and
|
(not pargs.extplorer) and
|
||||||
(not pargs.phpredisadmin)):
|
(not pargs.cheat) and (not pargs.clamav) and
|
||||||
|
(not pargs.phpredisadmin) and
|
||||||
|
(not pargs.php73)):
|
||||||
pargs.web = True
|
pargs.web = True
|
||||||
pargs.admin = True
|
pargs.admin = True
|
||||||
pargs.security = True
|
pargs.security = True
|
||||||
@@ -499,8 +533,7 @@ class WOStackController(CementBaseController):
|
|||||||
pargs.proftpd = True
|
pargs.proftpd = True
|
||||||
pargs.utils = True
|
pargs.utils = True
|
||||||
pargs.redis = True
|
pargs.redis = True
|
||||||
packages = \
|
packages = packages + ['/var/www/22222/htdocs/*']
|
||||||
packages + ['/var/www/22222/htdocs/*']
|
|
||||||
|
|
||||||
if pargs.web:
|
if pargs.web:
|
||||||
pargs.nginx = True
|
pargs.nginx = True
|
||||||
@@ -516,6 +549,7 @@ class WOStackController(CementBaseController):
|
|||||||
|
|
||||||
if pargs.security:
|
if pargs.security:
|
||||||
pargs.fail2ban = True
|
pargs.fail2ban = True
|
||||||
|
pargs.clamav = True
|
||||||
|
|
||||||
# NGINX
|
# NGINX
|
||||||
if pargs.nginx:
|
if pargs.nginx:
|
||||||
@@ -553,12 +587,25 @@ class WOStackController(CementBaseController):
|
|||||||
Log.debug(self, "Removing apt_packages variable of MySQL")
|
Log.debug(self, "Removing apt_packages variable of MySQL")
|
||||||
apt_packages = apt_packages + WOVariables.wo_mysql
|
apt_packages = apt_packages + WOVariables.wo_mysql
|
||||||
|
|
||||||
|
# mysqlclient
|
||||||
|
if pargs.mysqlclient:
|
||||||
|
Log.debug(self, "Removing apt_packages variable "
|
||||||
|
"for MySQL Client")
|
||||||
|
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
|
apt_packages = apt_packages + WOVariables.wo_mysql_client
|
||||||
|
|
||||||
# fail2ban
|
# fail2ban
|
||||||
if pargs.fail2ban:
|
if pargs.fail2ban:
|
||||||
if WOAptGet.is_installed(self, 'fail2ban'):
|
if WOAptGet.is_installed(self, 'fail2ban'):
|
||||||
Log.debug(self, "Remove apt_packages variable of Fail2ban")
|
Log.debug(self, "Remove apt_packages variable of Fail2ban")
|
||||||
apt_packages = apt_packages + WOVariables.wo_fail2ban
|
apt_packages = apt_packages + WOVariables.wo_fail2ban
|
||||||
|
|
||||||
|
# ClamAV
|
||||||
|
if pargs.clamav:
|
||||||
|
Log.debug(self, "Setting apt_packages variable for ClamAV")
|
||||||
|
if WOAptGet.is_installed(self, 'clamav'):
|
||||||
|
apt_packages = apt_packages + ["clamav"]
|
||||||
|
|
||||||
# proftpd
|
# proftpd
|
||||||
if pargs.proftpd:
|
if pargs.proftpd:
|
||||||
if WOAptGet.is_installed(self, 'proftpd-basic'):
|
if WOAptGet.is_installed(self, 'proftpd-basic'):
|
||||||
@@ -592,7 +639,7 @@ class WOStackController(CementBaseController):
|
|||||||
if os.path.isdir('{0}22222/htdocs/cache/redis'
|
if os.path.isdir('{0}22222/htdocs/cache/redis'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVariables.wo_webroot)):
|
||||||
packages = packages + ['{0}22222/htdocs/'
|
packages = packages + ['{0}22222/htdocs/'
|
||||||
'cache/redis/phpRedisAdmin'
|
'cache/redis'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVariables.wo_webroot)]
|
||||||
# ADMINER
|
# ADMINER
|
||||||
if pargs.adminer:
|
if pargs.adminer:
|
||||||
@@ -625,16 +672,14 @@ class WOStackController(CementBaseController):
|
|||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVariables.wo_webroot)]
|
||||||
|
|
||||||
if (packages) or (apt_packages):
|
if (packages) or (apt_packages):
|
||||||
if not pargs.force:
|
if (not pargs.force):
|
||||||
wo_prompt = input('Are you sure you to want to'
|
start_remove = input('Are you sure you to want to'
|
||||||
' remove from server.'
|
' remove from server.'
|
||||||
'\nPackage configuration will remain'
|
'\nPackage configuration will remain'
|
||||||
' on server after this operation.\n'
|
' on server after this operation.\n'
|
||||||
'Any answer other than '
|
'Remove stacks [y/N]?')
|
||||||
'"yes" will be stop this'
|
if start_remove != "Y" and start_remove != "y":
|
||||||
' operation : ')
|
Log.error(self, "Not starting stack removal")
|
||||||
if (wo_prompt != 'YES' or wo_prompt != 'yes'):
|
|
||||||
Log.error(self, "Not removing packages")
|
|
||||||
|
|
||||||
if (set(["nginx-custom"]).issubset(set(apt_packages))):
|
if (set(["nginx-custom"]).issubset(set(apt_packages))):
|
||||||
WOService.stop_service(self, 'nginx')
|
WOService.stop_service(self, 'nginx')
|
||||||
@@ -642,17 +687,22 @@ class WOStackController(CementBaseController):
|
|||||||
# Netdata uninstaller
|
# Netdata uninstaller
|
||||||
if (set(['/var/lib/wo/tmp/'
|
if (set(['/var/lib/wo/tmp/'
|
||||||
'kickstart.sh']).issubset(set(packages))):
|
'kickstart.sh']).issubset(set(packages))):
|
||||||
WOShellExec.cmd_exec(self, "bash /opt/netdata/usr/"
|
if WOVariables.wo_distro == 'Raspbian':
|
||||||
"libexec/netdata-"
|
WOShellExec.cmd_exec(self, "bash /usr/"
|
||||||
"uninstaller.sh -y -f")
|
"libexec/netdata-"
|
||||||
|
"uninstaller.sh -y -f")
|
||||||
|
else:
|
||||||
|
WOShellExec.cmd_exec(self, "bash /opt/netdata/usr/"
|
||||||
|
"libexec/netdata-"
|
||||||
|
"uninstaller.sh -y -f")
|
||||||
|
|
||||||
if (packages):
|
if (packages):
|
||||||
|
Log.info(self, "Removing packages, please wait...")
|
||||||
WOFileUtils.remove(self, packages)
|
WOFileUtils.remove(self, packages)
|
||||||
WOAptGet.auto_remove(self)
|
|
||||||
|
|
||||||
if (apt_packages):
|
if (apt_packages):
|
||||||
Log.debug(self, "Removing apt_packages")
|
Log.debug(self, "Removing apt_packages")
|
||||||
Log.info(self, "Removing packages, please wait...")
|
Log.info(self, "Removing apt packages, please wait...")
|
||||||
WOAptGet.remove(self, apt_packages)
|
WOAptGet.remove(self, apt_packages)
|
||||||
WOAptGet.auto_remove(self)
|
WOAptGet.auto_remove(self)
|
||||||
|
|
||||||
@@ -667,15 +717,17 @@ class WOStackController(CementBaseController):
|
|||||||
# Default action for stack purge
|
# Default action for stack purge
|
||||||
if ((not pargs.web) and (not pargs.admin) and
|
if ((not pargs.web) and (not pargs.admin) and
|
||||||
(not pargs.nginx) and (not pargs.php) and
|
(not pargs.nginx) and (not pargs.php) and
|
||||||
(not pargs.php73) and (not pargs.mysql) and
|
(not pargs.mysql) and (not pargs.wpcli) and
|
||||||
(not pargs.wpcli) and (not pargs.phpmyadmin) and
|
(not pargs.phpmyadmin) and (not pargs.composer) and
|
||||||
(not pargs.adminer) and (not pargs.utils) and
|
(not pargs.netdata) and (not pargs.dashboard) and
|
||||||
(not pargs.composer) and (not pargs.netdata) and
|
(not pargs.fail2ban) and (not pargs.security) and
|
||||||
(not pargs.fail2ban) and (not pargs.proftpd) and
|
(not pargs.mysqlclient) and (not pargs.mysqltuner) and
|
||||||
(not pargs.security) and (not pargs.mysqltuner) and
|
(not pargs.adminer) and (not pargs.utils) and
|
||||||
(not pargs.mysqlclient) and
|
(not pargs.redis) and (not pargs.proftpd) and
|
||||||
(not pargs.all) and (not pargs.redis) and
|
(not pargs.extplorer) and
|
||||||
(not pargs.phpredisadmin)):
|
(not pargs.cheat) and (not pargs.clamav) and
|
||||||
|
(not pargs.phpredisadmin) and
|
||||||
|
(not pargs.php73)):
|
||||||
pargs.web = True
|
pargs.web = True
|
||||||
pargs.admin = True
|
pargs.admin = True
|
||||||
pargs.security = True
|
pargs.security = True
|
||||||
@@ -688,8 +740,7 @@ class WOStackController(CementBaseController):
|
|||||||
pargs.proftpd = True
|
pargs.proftpd = True
|
||||||
pargs.utils = True
|
pargs.utils = True
|
||||||
pargs.redis = True
|
pargs.redis = True
|
||||||
packages = \
|
packages = packages + ['/var/www/22222/htdocs/*']
|
||||||
packages + ['/var/www/22222/htdocs/*']
|
|
||||||
|
|
||||||
if pargs.web:
|
if pargs.web:
|
||||||
pargs.nginx = True
|
pargs.nginx = True
|
||||||
@@ -702,9 +753,12 @@ class WOStackController(CementBaseController):
|
|||||||
pargs.composer = True
|
pargs.composer = True
|
||||||
pargs.netdata = True
|
pargs.netdata = True
|
||||||
pargs.mysqltuner = True
|
pargs.mysqltuner = True
|
||||||
|
pargs.cheat = True
|
||||||
|
|
||||||
if pargs.security:
|
if pargs.security:
|
||||||
pargs.fail2ban = True
|
pargs.fail2ban = True
|
||||||
|
pargs.clamav = True
|
||||||
|
|
||||||
# NGINX
|
# NGINX
|
||||||
if pargs.nginx:
|
if pargs.nginx:
|
||||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||||
@@ -731,12 +785,35 @@ class WOStackController(CementBaseController):
|
|||||||
else:
|
else:
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
apt_packages = apt_packages + WOVariables.wo_php73
|
||||||
|
|
||||||
|
# REDIS
|
||||||
|
if pargs.redis:
|
||||||
|
Log.debug(self, "Remove apt_packages variable of Redis")
|
||||||
|
apt_packages = apt_packages + WOVariables.wo_redis
|
||||||
|
|
||||||
|
# MariaDB
|
||||||
|
if pargs.mysql:
|
||||||
|
Log.debug(self, "Removing apt_packages variable of MySQL")
|
||||||
|
apt_packages = apt_packages + WOVariables.wo_mysql
|
||||||
|
|
||||||
|
# mysqlclient
|
||||||
|
if pargs.mysqlclient:
|
||||||
|
Log.debug(self, "Removing apt_packages variable "
|
||||||
|
"for MySQL Client")
|
||||||
|
if WOShellExec.cmd_exec(self, "mysqladmin ping"):
|
||||||
|
apt_packages = apt_packages + WOVariables.wo_mysql_client
|
||||||
|
|
||||||
# fail2ban
|
# fail2ban
|
||||||
if pargs.fail2ban:
|
if pargs.fail2ban:
|
||||||
if WOAptGet.is_installed(self, 'fail2ban'):
|
if WOAptGet.is_installed(self, 'fail2ban'):
|
||||||
Log.debug(self, "Purge apt_packages variable of Fail2ban")
|
Log.debug(self, "Remove apt_packages variable of Fail2ban")
|
||||||
apt_packages = apt_packages + WOVariables.wo_fail2ban
|
apt_packages = apt_packages + WOVariables.wo_fail2ban
|
||||||
|
|
||||||
|
# ClamAV
|
||||||
|
if pargs.clamav:
|
||||||
|
Log.debug(self, "Setting apt_packages variable for ClamAV")
|
||||||
|
if WOAptGet.is_installed(self, 'clamav'):
|
||||||
|
apt_packages = apt_packages + ["clamav"]
|
||||||
|
|
||||||
# proftpd
|
# proftpd
|
||||||
if pargs.proftpd:
|
if pargs.proftpd:
|
||||||
if WOAptGet.is_installed(self, 'proftpd-basic'):
|
if WOAptGet.is_installed(self, 'proftpd-basic'):
|
||||||
@@ -771,7 +848,7 @@ class WOStackController(CementBaseController):
|
|||||||
if os.path.isdir('{0}22222/htdocs/cache/redis'
|
if os.path.isdir('{0}22222/htdocs/cache/redis'
|
||||||
.format(WOVariables.wo_webroot)):
|
.format(WOVariables.wo_webroot)):
|
||||||
packages = packages + ['{0}22222/htdocs/'
|
packages = packages + ['{0}22222/htdocs/'
|
||||||
'cache/redis/phpRedisAdmin'
|
'cache/redis'
|
||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVariables.wo_webroot)]
|
||||||
# Adminer
|
# Adminer
|
||||||
if pargs.adminer:
|
if pargs.adminer:
|
||||||
@@ -806,35 +883,41 @@ class WOStackController(CementBaseController):
|
|||||||
.format(WOVariables.wo_webroot)]
|
.format(WOVariables.wo_webroot)]
|
||||||
|
|
||||||
if (packages) or (apt_packages):
|
if (packages) or (apt_packages):
|
||||||
if not pargs.force:
|
if (not pargs.force):
|
||||||
wo_prompt = input('Are you sure you to want to purge '
|
start_purge = input('Are you sure you to want to'
|
||||||
'from server '
|
' purge stacks from this server ?'
|
||||||
'along with their configuration'
|
'\nPackage configuration and data '
|
||||||
' packages,\nAny answer other than '
|
'will not remain'
|
||||||
'"yes" will be stop this '
|
' on this server after this operation.\n'
|
||||||
'operation :')
|
'Purge stacks [y/N]')
|
||||||
if (wo_prompt != 'YES' or wo_prompt != 'yes'):
|
if start_purge != "Y" and start_purge != "y":
|
||||||
Log.error(self, "Not purging packages")
|
Log.error(self, "Not starting stack purge")
|
||||||
|
|
||||||
if (set(["nginx-custom"]).issubset(set(apt_packages))):
|
if (set(["nginx-custom"]).issubset(set(apt_packages))):
|
||||||
WOService.stop_service(self, 'nginx')
|
WOService.stop_service(self, 'nginx')
|
||||||
|
|
||||||
# Netdata uninstaller
|
|
||||||
if (set(['/var/lib/wo/tmp/'
|
|
||||||
'kickstart.sh']).issubset(set(packages))):
|
|
||||||
WOShellExec.cmd_exec(self, "bash /opt/netdata/usr/"
|
|
||||||
"libexec/netdata-"
|
|
||||||
"uninstaller.sh -y -f")
|
|
||||||
|
|
||||||
if (set(["fail2ban"]).issubset(set(apt_packages))):
|
if (set(["fail2ban"]).issubset(set(apt_packages))):
|
||||||
WOService.stop_service(self, 'fail2ban')
|
WOService.stop_service(self, 'fail2ban')
|
||||||
|
|
||||||
|
# Netdata uninstaller
|
||||||
|
if (set(['/var/lib/wo/tmp/'
|
||||||
|
'kickstart.sh']).issubset(set(packages))):
|
||||||
|
if WOVariables.wo_distro == 'Raspbian':
|
||||||
|
WOShellExec.cmd_exec(self, "bash /usr/"
|
||||||
|
"libexec/netdata-"
|
||||||
|
"uninstaller.sh -y -f")
|
||||||
|
else:
|
||||||
|
WOShellExec.cmd_exec(self, "bash /opt/netdata/usr/"
|
||||||
|
"libexec/netdata-"
|
||||||
|
"uninstaller.sh -y -f")
|
||||||
|
|
||||||
if (apt_packages):
|
if (apt_packages):
|
||||||
Log.info(self, "Purging packages, please wait...")
|
Log.info(self, "Purging apt packages, please wait...")
|
||||||
WOAptGet.remove(self, apt_packages, purge=True)
|
WOAptGet.remove(self, apt_packages, purge=True)
|
||||||
WOAptGet.auto_remove(self)
|
WOAptGet.auto_remove(self)
|
||||||
|
|
||||||
if (packages):
|
if (packages):
|
||||||
|
Log.info(self, "Purging packages, please wait...")
|
||||||
WOFileUtils.remove(self, packages)
|
WOFileUtils.remove(self, packages)
|
||||||
WOAptGet.auto_remove(self)
|
WOAptGet.auto_remove(self)
|
||||||
|
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
if (apt_packages):
|
if (apt_packages):
|
||||||
# Nginx configuration
|
# Nginx configuration
|
||||||
if set(WOVariables.wo_nginx).issubset(set(apt_packages)):
|
if set(WOVariables.wo_nginx).issubset(set(apt_packages)):
|
||||||
|
Log.info(self, "Applying Nginx configuration templates")
|
||||||
# Nginx main configuration
|
# Nginx main configuration
|
||||||
ngxcnf = '/etc/nginx/conf.d'
|
ngxcnf = '/etc/nginx/conf.d'
|
||||||
ngxcom = '/etc/nginx/common'
|
ngxcom = '/etc/nginx/common'
|
||||||
@@ -459,23 +460,22 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
|
|
||||||
if not os.path.isfile('{0}22222/conf/nginx/ssl.conf'
|
if not os.path.isfile('{0}22222/conf/nginx/ssl.conf'
|
||||||
.format(ngxroot)):
|
.format(ngxroot)):
|
||||||
|
|
||||||
with open("/var/www/22222/conf/nginx/"
|
with open("/var/www/22222/conf/nginx/"
|
||||||
"ssl.conf", "a") as php_file:
|
"ssl.conf", "w") as php_file:
|
||||||
php_file.write("ssl_certificate "
|
php_file.write("ssl_certificate "
|
||||||
"/var/www/22222/cert/22222.crt;\n"
|
"/var/www/22222/cert/22222.crt;\n"
|
||||||
"ssl_certificate_key "
|
"ssl_certificate_key "
|
||||||
"/var/www/22222/cert/22222.key;\n")
|
"/var/www/22222/cert/22222.key;\n")
|
||||||
server_ip = requests.get('http://v4.wordops.eu')
|
server_ip = requests.get('http://v4.wordops.eu')
|
||||||
|
|
||||||
WOTemplate.render(self, '/opt/cf-update.sh',
|
if set(["nginx"]).issubset(set(apt_packages)):
|
||||||
'cf-update.mustache',
|
print("WordOps backend configuration was successful\n"
|
||||||
data, overwrite=False)
|
"You can access it on : https://{0}:22222"
|
||||||
WOFileUtils.chmod(self, "/opt/cf-update.sh", 0o775)
|
.format(server_ip))
|
||||||
WOCron.setcron_weekly(self, '/opt/cf-update.sh '
|
print("HTTP Auth User Name: WordOps" +
|
||||||
'> /dev/null 2>&1',
|
"\nHTTP Auth Password : {0}".format(passwd))
|
||||||
comment='Cloudflare IP refresh cronjob '
|
WOService.reload_service(self, 'nginx')
|
||||||
'added by WordOps')
|
else:
|
||||||
self.msg = (self.msg + ["HTTP Auth User "
|
self.msg = (self.msg + ["HTTP Auth User "
|
||||||
"Name: WordOps"] +
|
"Name: WordOps"] +
|
||||||
["HTTP Auth Password : {0}"
|
["HTTP Auth Password : {0}"
|
||||||
@@ -486,6 +486,16 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
.format(server_ip.text,
|
.format(server_ip.text,
|
||||||
WOVariables.wo_fqdn)])
|
WOVariables.wo_fqdn)])
|
||||||
|
|
||||||
|
if not os.path.isfile("/opt/cf-update.sh"):
|
||||||
|
WOTemplate.render(self, '/opt/cf-update.sh',
|
||||||
|
'cf-update.mustache',
|
||||||
|
data, overwrite=False)
|
||||||
|
WOFileUtils.chmod(self, "/opt/cf-update.sh", 0o775)
|
||||||
|
WOCron.setcron_weekly(self, '/opt/cf-update.sh '
|
||||||
|
'> /dev/null 2>&1',
|
||||||
|
comment='Cloudflare IP refresh cronjob '
|
||||||
|
'added by WordOps')
|
||||||
|
|
||||||
if upgrade:
|
if upgrade:
|
||||||
try:
|
try:
|
||||||
WOShellExec.cmd_exec(self, 'nginx -t')
|
WOShellExec.cmd_exec(self, 'nginx -t')
|
||||||
@@ -501,6 +511,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
WOService.restart_service(self, 'nginx')
|
WOService.restart_service(self, 'nginx')
|
||||||
|
|
||||||
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
if set(WOVariables.wo_php).issubset(set(apt_packages)):
|
||||||
|
Log.info(self, "Configuring php7.2-fpm")
|
||||||
ngxroot = '/var/www/'
|
ngxroot = '/var/www/'
|
||||||
# Create log directories
|
# Create log directories
|
||||||
if not os.path.exists('/var/log/php/7.2/'):
|
if not os.path.exists('/var/log/php/7.2/'):
|
||||||
@@ -673,6 +684,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
|
|
||||||
# PHP7.3 configuration
|
# PHP7.3 configuration
|
||||||
if set(WOVariables.wo_php73).issubset(set(apt_packages)):
|
if set(WOVariables.wo_php73).issubset(set(apt_packages)):
|
||||||
|
Log.info(self, "Configuring php7.3-fpm")
|
||||||
ngxroot = '/var/www/'
|
ngxroot = '/var/www/'
|
||||||
# Create log directories
|
# Create log directories
|
||||||
if not os.path.exists('/var/log/php/7.3/'):
|
if not os.path.exists('/var/log/php/7.3/'):
|
||||||
@@ -854,6 +866,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
config_file.write(config)
|
config_file.write(config)
|
||||||
config_file.close()
|
config_file.close()
|
||||||
elif (not WOFileUtils.grep(self, "/etc/mysql/my.cnf", "WordOps")):
|
elif (not WOFileUtils.grep(self, "/etc/mysql/my.cnf", "WordOps")):
|
||||||
|
Log.info(self, "Tuning MariaDB configuration")
|
||||||
with open("/etc/mysql/my.cnf",
|
with open("/etc/mysql/my.cnf",
|
||||||
"a") as mysql_file:
|
"a") as mysql_file:
|
||||||
mysql_file.write("\n# WordOps v3.9.8\n")
|
mysql_file.write("\n# WordOps v3.9.8\n")
|
||||||
@@ -963,6 +976,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
# create fail2ban configuration files
|
# create fail2ban configuration files
|
||||||
if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)):
|
if set(WOVariables.wo_fail2ban).issubset(set(apt_packages)):
|
||||||
if not os.path.isfile("/etc/fail2ban/jail.d/custom.conf"):
|
if not os.path.isfile("/etc/fail2ban/jail.d/custom.conf"):
|
||||||
|
Log.info(self, "Configuring Fail2Ban")
|
||||||
data = dict()
|
data = dict()
|
||||||
WOTemplate.render(self,
|
WOTemplate.render(self,
|
||||||
'/etc/fail2ban/jail.d/custom.conf',
|
'/etc/fail2ban/jail.d/custom.conf',
|
||||||
@@ -986,6 +1000,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
# Proftpd configuration
|
# Proftpd configuration
|
||||||
if set(["proftpd-basic"]).issubset(set(apt_packages)):
|
if set(["proftpd-basic"]).issubset(set(apt_packages)):
|
||||||
if os.path.isfile("/etc/proftpd/proftpd.conf"):
|
if os.path.isfile("/etc/proftpd/proftpd.conf"):
|
||||||
|
Log.info(self, "Configuring ProFTPd")
|
||||||
Log.debug(self, "Setting up Proftpd configuration")
|
Log.debug(self, "Setting up Proftpd configuration")
|
||||||
WOFileUtils.searchreplace(self, "/etc/proftpd/"
|
WOFileUtils.searchreplace(self, "/etc/proftpd/"
|
||||||
"proftpd.conf",
|
"proftpd.conf",
|
||||||
@@ -1053,7 +1068,9 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.error(self, "Unable to add UFW rule")
|
Log.error(self, "Unable to add UFW rule")
|
||||||
|
|
||||||
if os.path.isfile("/etc/fail2ban/jail.d/custom.conf"):
|
if ((os.path.isfile("/etc/fail2ban/jail.d/custom.conf")) and
|
||||||
|
(not WOFileUtils.grep(self, "/etc/fail2ban/jail.d/custom.conf",
|
||||||
|
"proftpd"))):
|
||||||
with open("/etc/fail2ban/jail.d/custom.conf",
|
with open("/etc/fail2ban/jail.d/custom.conf",
|
||||||
encoding='utf-8', mode='a') as f2bproftpd:
|
encoding='utf-8', mode='a') as f2bproftpd:
|
||||||
f2bproftpd.write("\n\n[proftpd]\nenabled = true\n")
|
f2bproftpd.write("\n\n[proftpd]\nenabled = true\n")
|
||||||
@@ -1098,6 +1115,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
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/mysql/my.cnf", "WordOps")):
|
not WOFileUtils.grep(self, "/etc/mysql/my.cnf", "WordOps")):
|
||||||
|
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:
|
||||||
redis_file.write("\n# WordOps v3.9.8\n")
|
redis_file.write("\n# WordOps v3.9.8\n")
|
||||||
@@ -1157,11 +1175,13 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
'added by WordOps')
|
'added by WordOps')
|
||||||
|
|
||||||
if (packages):
|
if (packages):
|
||||||
|
# WP-CLI
|
||||||
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"
|
Log.debug(self, "Setting Privileges"
|
||||||
" to /usr/local/bin/wp file ")
|
" to /usr/local/bin/wp file ")
|
||||||
WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
|
WOFileUtils.chmod(self, "/usr/local/bin/wp", 0o775)
|
||||||
|
|
||||||
|
# PHPMyAdmin
|
||||||
if any('/var/lib/wo/tmp/pma.tar.gz' == x[1]
|
if any('/var/lib/wo/tmp/pma.tar.gz' == x[1]
|
||||||
for x in packages):
|
for x in packages):
|
||||||
WOExtract.extract(
|
WOExtract.extract(
|
||||||
@@ -1243,7 +1263,7 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
'www-data',
|
'www-data',
|
||||||
'www-data',
|
'www-data',
|
||||||
recursive=True)
|
recursive=True)
|
||||||
|
# MySQLtuner
|
||||||
if any('/usr/bin/mysqltuner' == x[1]
|
if any('/usr/bin/mysqltuner' == x[1]
|
||||||
for x in packages):
|
for x in packages):
|
||||||
Log.debug(self, "CHMOD MySQLTuner in /usr/bin/mysqltuner")
|
Log.debug(self, "CHMOD MySQLTuner in /usr/bin/mysqltuner")
|
||||||
@@ -1258,18 +1278,25 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
WOShellExec.cmd_exec(self, "bash /var/lib/wo/tmp/"
|
WOShellExec.cmd_exec(self, "bash /var/lib/wo/tmp/"
|
||||||
"kickstart.sh "
|
"kickstart.sh "
|
||||||
"--dont-wait")
|
"--dont-wait")
|
||||||
|
if WOVariables.wo_distro == 'raspbian':
|
||||||
|
wo_netdata = "/"
|
||||||
|
else:
|
||||||
|
wo_netdata = "/opt/netdata/"
|
||||||
# disable mail notifications
|
# disable mail notifications
|
||||||
WOFileUtils.searchreplace(self, "/opt/netdata/usr/"
|
WOFileUtils.searchreplace(self, "{0}usr/"
|
||||||
"lib/netdata/conf.d/"
|
"lib/netdata/conf.d/"
|
||||||
"health_alarm_notify.conf",
|
"health_alarm_notify.conf"
|
||||||
|
.format(wo_netdata),
|
||||||
'SEND_EMAIL="YES"',
|
'SEND_EMAIL="YES"',
|
||||||
'SEND_EMAIL="NO"')
|
'SEND_EMAIL="NO"')
|
||||||
# make changes persistant
|
# make changes persistant
|
||||||
WOFileUtils.copyfile(self, "/opt/netdata/usr/"
|
WOFileUtils.copyfile(self, "{0}usr/"
|
||||||
"lib/netdata/conf.d/"
|
"lib/netdata/conf.d/"
|
||||||
"health_alarm_notify.conf",
|
"health_alarm_notify.conf"
|
||||||
"/opt/netdata/etc/netdata/"
|
.format(wo_netdata),
|
||||||
"health_alarm_notify.conf")
|
"{0}etc/netdata/"
|
||||||
|
"health_alarm_notify.conf"
|
||||||
|
.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:
|
||||||
@@ -1288,7 +1315,8 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.info(
|
Log.info(
|
||||||
self, "fail to setup mysql user for netdata")
|
self, "fail to setup mysql user for netdata")
|
||||||
WOFileUtils.chown(self, '/opt/netdata',
|
WOFileUtils.chown(self, '{0}etc/netdata'
|
||||||
|
.format(wo_netdata),
|
||||||
'netdata',
|
'netdata',
|
||||||
'netdata',
|
'netdata',
|
||||||
recursive=True)
|
recursive=True)
|
||||||
@@ -1457,10 +1485,6 @@ def post_pref(self, apt_packages, packages, upgrade=False):
|
|||||||
if any('/usr/local/bin/cht.sh' == x[1]
|
if any('/usr/local/bin/cht.sh' == x[1]
|
||||||
for x in packages):
|
for x in packages):
|
||||||
WOFileUtils.chmod(self, "/usr/local/bin/cht.sh", 0o775)
|
WOFileUtils.chmod(self, "/usr/local/bin/cht.sh", 0o775)
|
||||||
if not WOFileUtils.grep(self, "~/.bashrc", "cheat"):
|
|
||||||
with open("~/.bashrc",
|
|
||||||
"a") as wo_bashrc:
|
|
||||||
wo_bashrc.write("\nalias cheat='cht.sh'\n")
|
|
||||||
|
|
||||||
# phpredisadmin
|
# phpredisadmin
|
||||||
if any('/var/lib/wo/tmp/pra.tar.gz' == x[1]
|
if any('/var/lib/wo/tmp/pra.tar.gz' == x[1]
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
|
|
||||||
# netdata
|
# netdata
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
if os.path.isdir("/opt/netdata"):
|
if (os.path.isdir("/opt/netdata") or
|
||||||
|
os.path.isdir("/etc/netdata")):
|
||||||
services = services + ['netdata']
|
services = services + ['netdata']
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Netdata is not installed")
|
Log.info(self, "Netdata is not installed")
|
||||||
@@ -177,7 +178,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
|
|
||||||
# netdata
|
# netdata
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
if os.path.isdir("/opt/netdata"):
|
if (os.path.isdir("/opt/netdata") or
|
||||||
|
os.path.isdir("/etc/netdata")):
|
||||||
services = services + ['netdata']
|
services = services + ['netdata']
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Netdata is not installed")
|
Log.info(self, "Netdata is not installed")
|
||||||
@@ -261,7 +263,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
|
|
||||||
# netdata
|
# netdata
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
if os.path.isdir("/opt/netdata"):
|
if (os.path.isdir("/opt/netdata") or
|
||||||
|
os.path.isdir("/etc/netdata")):
|
||||||
services = services + ['netdata']
|
services = services + ['netdata']
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Netdata is not installed")
|
Log.info(self, "Netdata is not installed")
|
||||||
@@ -345,7 +348,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
|
|
||||||
# netdata
|
# netdata
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
if os.path.isdir("/opt/netdata"):
|
if (os.path.isdir("/opt/netdata") or
|
||||||
|
os.path.isdir("/etc/netdata")):
|
||||||
services = services + ['netdata']
|
services = services + ['netdata']
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Netdata is not installed")
|
Log.info(self, "Netdata is not installed")
|
||||||
@@ -429,7 +433,8 @@ class WOStackStatusController(CementBaseController):
|
|||||||
|
|
||||||
# netdata
|
# netdata
|
||||||
if pargs.netdata:
|
if pargs.netdata:
|
||||||
if os.path.isdir("/opt/netdata"):
|
if (os.path.isdir("/opt/netdata") or
|
||||||
|
os.path.isdir("/etc/netdata")):
|
||||||
services = services + ['netdata']
|
services = services + ['netdata']
|
||||||
else:
|
else:
|
||||||
Log.info(self, "Netdata is not installed")
|
Log.info(self, "Netdata is not installed")
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import shutil
|
|||||||
|
|
||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
from wo.core.apt_repo import WORepo
|
|
||||||
from wo.core.aptget import WOAptGet
|
from wo.core.aptget import WOAptGet
|
||||||
from wo.core.download import WODownload
|
from wo.core.download import WODownload
|
||||||
from wo.core.extract import WOExtract
|
from wo.core.extract import WOExtract
|
||||||
@@ -77,6 +76,13 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
|
|
||||||
if pargs.all:
|
if pargs.all:
|
||||||
pargs.web = True
|
pargs.web = True
|
||||||
|
pargs.netdata = True
|
||||||
|
pargs.composer = True
|
||||||
|
pargs.dashboard = True
|
||||||
|
pargs.phpmyadmin = True
|
||||||
|
pargs.redis = True
|
||||||
|
pargs.wpcli = True
|
||||||
|
pargs.php73 = True
|
||||||
|
|
||||||
if pargs.web:
|
if pargs.web:
|
||||||
if WOAptGet.is_installed(self, 'nginx-custom'):
|
if WOAptGet.is_installed(self, 'nginx-custom'):
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
from cement.core.controller import CementBaseController, expose
|
from cement.core.controller import CementBaseController, expose
|
||||||
from cement.core import handler, hook
|
from cement.core import handler, hook
|
||||||
from wo.core.fileutils import WOFileUtils
|
from wo.core.fileutils import WOFileUtils
|
||||||
from wo.cli.plugins.sitedb import *
|
from wo.cli.plugins.sitedb import updateSiteInfo, getAllsites
|
||||||
from wo.core.mysql import *
|
from wo.core.mysql import WOMysql, StatementExcecutionError
|
||||||
from wo.core.logging import Log
|
from wo.core.logging import Log
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
|
|||||||
@@ -148,14 +148,16 @@ class WOAptGet():
|
|||||||
try:
|
try:
|
||||||
with open('/var/log/wo/wordops.log', 'a') as f:
|
with open('/var/log/wo/wordops.log', 'a') as f:
|
||||||
if purge:
|
if purge:
|
||||||
proc = subprocess.Popen('apt-get autoremove --purge '
|
proc = subprocess.Popen('DEBIAN_FRONTEND=noninteractive '
|
||||||
'--assume-yes {0}'
|
'apt-get autoremove --purge '
|
||||||
|
'-qq {0}'
|
||||||
.format(all_packages), shell=True,
|
.format(all_packages), shell=True,
|
||||||
stdin=None, stdout=f, stderr=f,
|
stdin=None, stdout=f, stderr=f,
|
||||||
executable="/bin/bash")
|
executable="/bin/bash")
|
||||||
else:
|
else:
|
||||||
proc = subprocess.Popen('apt-get autoremove '
|
proc = subprocess.Popen('DEBIAN_FRONTEND=noninteractive '
|
||||||
'--assume-yes {0}'
|
'apt-get autoremove '
|
||||||
|
'-qq {0}'
|
||||||
.format(all_packages), shell=True,
|
.format(all_packages), shell=True,
|
||||||
stdin=None, stdout=f, stderr=f,
|
stdin=None, stdout=f, stderr=f,
|
||||||
executable="/bin/bash")
|
executable="/bin/bash")
|
||||||
|
|||||||
@@ -244,6 +244,22 @@ class WOFileUtils():
|
|||||||
Log.error(self, "Unable to Search string {0} in {1}"
|
Log.error(self, "Unable to Search string {0} in {1}"
|
||||||
.format(sstr, fnm))
|
.format(sstr, fnm))
|
||||||
|
|
||||||
|
def grepcheck(self, fnm, sstr):
|
||||||
|
"""
|
||||||
|
Searches for string in file and returns True or False.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
Log.debug(self, "Finding string {0} to file {1}"
|
||||||
|
.format(sstr, fnm))
|
||||||
|
for line in open(fnm, encoding='utf-8'):
|
||||||
|
if sstr in line:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
except OSError as e:
|
||||||
|
Log.debug(self, "{0}".format(e.strerror))
|
||||||
|
Log.error(self, "Unable to Search string {0} in {1}"
|
||||||
|
.format(sstr, fnm))
|
||||||
|
|
||||||
def rm(self, path):
|
def rm(self, path):
|
||||||
"""
|
"""
|
||||||
Remove files
|
Remove files
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ class WOVariables():
|
|||||||
"""Intialization of core variables"""
|
"""Intialization of core variables"""
|
||||||
|
|
||||||
# WordOps version
|
# WordOps version
|
||||||
wo_version = "3.9.8.4"
|
wo_version = "3.9.8.5"
|
||||||
# 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"
|
||||||
@@ -22,7 +22,7 @@ class WOVariables():
|
|||||||
wo_wpcli_path = '/usr/local/bin/wp'
|
wo_wpcli_path = '/usr/local/bin/wp'
|
||||||
|
|
||||||
# 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')
|
||||||
|
|
||||||
# WordOps core variables
|
# WordOps core variables
|
||||||
wo_distro = distro.linux_distribution(
|
wo_distro = distro.linux_distribution(
|
||||||
@@ -121,12 +121,12 @@ class WOVariables():
|
|||||||
|
|
||||||
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
|
wo_php = ["php7.2-fpm", "php7.2-curl", "php7.2-gd", "php7.2-imap",
|
||||||
"php7.2-readline", "php7.2-common", "php7.2-recode",
|
"php7.2-readline", "php7.2-common", "php7.2-recode",
|
||||||
"php7.2-cli", "php7.2-mbstring",
|
"php7.2-cli", "php7.2-mbstring", "php7.2-intl",
|
||||||
"php7.2-bcmath", "php7.2-mysql", "php7.2-opcache",
|
"php7.2-bcmath", "php7.2-mysql", "php7.2-opcache",
|
||||||
"php7.2-zip", "php7.2-xml", "php7.2-soap"]
|
"php7.2-zip", "php7.2-xml", "php7.2-soap"]
|
||||||
wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap",
|
wo_php73 = ["php7.3-fpm", "php7.3-curl", "php7.3-gd", "php7.3-imap",
|
||||||
"php7.3-readline", "php7.3-common", "php7.3-recode",
|
"php7.3-readline", "php7.3-common", "php7.3-recode",
|
||||||
"php7.3-cli", "php7.3-mbstring",
|
"php7.3-cli", "php7.3-mbstring", "php7.3-intl",
|
||||||
"php7.3-bcmath", "php7.3-mysql", "php7.3-opcache",
|
"php7.3-bcmath", "php7.3-mysql", "php7.3-opcache",
|
||||||
"php7.3-zip", "php7.3-xml", "php7.3-soap"]
|
"php7.3-zip", "php7.3-xml", "php7.3-soap"]
|
||||||
wo_php_extra = ["php-memcached", "php-imagick",
|
wo_php_extra = ["php-memcached", "php-imagick",
|
||||||
|
|||||||
Reference in New Issue
Block a user