From a0294576b70e853cb4cefca202997ea298653a5b Mon Sep 17 00:00:00 2001 From: VirtuBox Date: Sun, 10 Mar 2019 23:46:52 +0100 Subject: [PATCH] update upstream template * cleanup stack.py * replace nginx-ee by nginx-wo in install script --- install | 22 ++++---- wo/cli/plugins/stack.py | 30 ++++++---- wo/cli/templates/upstream.mustache | 91 ++++++++++++++++++------------ 3 files changed, 85 insertions(+), 58 deletions(-) diff --git a/install b/install index c3ed1c5..ab53e1f 100644 --- a/install +++ b/install @@ -415,21 +415,21 @@ wo_update_latest() wo_lib_echo "Updating Nginx configuration, please wait..." elif [ "$wo_distro_version" == "trusty" ]; then - grep -Hr 'http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/xUbuntu_14.04/ /' /etc/apt/sources.list.d/ &>> /dev/null + grep -Hr 'http://download.opensuse.org/repositories/home:/virtubox:/WordOps/xUbuntu_14.04/ /' /etc/apt/sources.list.d/ &>> /dev/null if [[ $? -ne 0 ]]; then if [ -f /etc/apt/sources.list.d/rtcamp-nginx-trusty.list ]; then rm -rf /etc/apt/sources.list.d/rtcamp-nginx-trusty.list fi - echo -e "\ndeb http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/xUbuntu_14.04/ /" >> /etc/apt/sources.list.d/wo-repo.list - gpg --keyserver "hkp://pgp.mit.edu" --recv-keys '3050AC3CD2AE6F03' - gpg -a --export --armor '3050AC3CD2AE6F03' | apt-key add - + echo -e "\ndeb http://download.opensuse.org/repositories/home:/virtubox:/WordOps/xUbuntu_14.04/ /" >> /etc/apt/sources.list.d/wo-repo.list + gpg --keyserver "hkp://pgp.mit.edu" --recv-keys '188C9FB063F0247A' + gpg -a --export --armor '188C9FB063F0247A' | apt-key add - if [ -f /etc/nginx/conf.d/ee-nginx.conf ]; then mv /etc/nginx/conf.d/ee-nginx.conf /etc/nginx/conf.d/wo-nginx.conf.old &>> /dev/null fi mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old &>> /dev/null apt-get update service nginx stop &>> /dev/null - DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom nginx-ee + DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install nginx-custom nginx-wo service nginx restart &>> /dev/null fi CHECK_NGINX_COMMON=$(dpkg --get-selections | grep -v deinstall | grep nginx-common) @@ -440,16 +440,16 @@ wo_update_latest() apt-get remove -y nginx-mainline fi service nginx stop &>> /dev/null - DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y --allow-unauthenticated install nginx-ee nginx-custom + DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y --allow-unauthenticated install nginx-wo nginx-custom service nginx restart &>> /dev/null fi elif [ "$wo_linux_distro" == "Debian" ]; then - grep -Hr 'http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/Debian_8.0/ /' /etc/apt/sources.list.d/ &>> /dev/null + grep -Hr 'http://download.opensuse.org/repositories/home:/virtubox:/WordOps/Debian_8.0/ /' /etc/apt/sources.list.d/ &>> /dev/null if [[ $? -ne 0 ]]; then - echo -e "deb http://download.opensuse.org/repositories/home:/rtCamp:/EasyEngine/Debian_8.0/ /" >> /etc/apt/sources.list.d/wo-repo.list - gpg --keyserver "hkp://pgp.mit.edu" --recv-keys '3050AC3CD2AE6F03' - gpg -a --export --armor '3050AC3CD2AE6F03' | apt-key add - + echo -e "deb http://download.opensuse.org/repositories/home:/virtubox:/WordOps/Debian_8.0/ /" >> /etc/apt/sources.list.d/wo-repo.list + gpg --keyserver "hkp://pgp.mit.edu" --recv-keys '188C9FB063F0247A' + gpg -a --export --armor '188C9FB063F0247A' | apt-key add - if [ -f /etc/nginx/conf.d/ee-nginx.conf ]; then mv /etc/nginx/conf.d/ee-nginx.conf /etc/nginx/conf.d/ee-nginx.conf.old &>> /dev/null fi @@ -468,7 +468,7 @@ wo_update_latest() apt-get remove -y nginx-mainline fi systemctl stop nginx &>> /dev/null - DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y --allow-unauthenticated install nginx-ee nginx-custom + DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y --allow-unauthenticated install nginx-wo nginx-custom systemctl restart nginx &>> /dev/null fi fi diff --git a/wo/cli/plugins/stack.py b/wo/cli/plugins/stack.py index 708bce3..3bd83fc 100644 --- a/wo/cli/plugins/stack.py +++ b/wo/cli/plugins/stack.py @@ -53,8 +53,6 @@ class WOStackController(CementBaseController): dict(help='Install admin tools stack', action='store_true')), (['--nginx'], dict(help='Install Nginx stack', action='store_true')), - # (['--nginxmainline'], - # dict(help='Install Nginx mainline stack', action='store_true')), (['--php'], dict(help='Install PHP 7.2 stack', action='store_true')), (['--php73'], @@ -181,11 +179,9 @@ class WOStackController(CementBaseController): WORepo.add_key(self, '89DF5277') if set(WOVariables.wo_hhvm).issubset(set(apt_packages)): - if (WOVariables.wo_platform_codename != 'xenial' or WOVariables.wo_platform_codename != 'bionic'): + if (WOVariables.wo_platform_codename != 'xenial' or + WOVariables.wo_platform_codename != 'bionic'): Log.info(self, "Adding repository for HHVM, please wait...") - if WOVariables.wo_platform_codename == 'precise': - Log.debug(self, 'Adding PPA for Boost') - WORepo.add(self, ppa=WOVariables.wo_boost_repo) Log.debug(self, 'Adding ppa repo for HHVM') WORepo.add(self, repo_url=WOVariables.wo_hhvm_repo) Log.debug(self, 'Adding HHVM GPG Key') @@ -282,8 +278,11 @@ class WOStackController(CementBaseController): self.app.render((data), 'fastcgi.mustache', out=wo_nginx) wo_nginx.close() - data = dict(php="9000", debug="9001", hhvm="8000", php73="9072", debug7="9172", - hhvmconf=False, php7conf=True if WOAptGet.is_installed(self, 'php7.3-fpm') else False) + data = dict(php="9000", debug="9001", hhvm="8000", + php7="9070", debug7="9170", + hhvmconf=False, php7conf=True if + WOAptGet.is_installed(self, 'php7.0-fpm') + else False) Log.debug(self, 'Writting the nginx configuration to ' 'file /etc/nginx/conf.d/upstream.conf') wo_nginx = open('/etc/nginx/conf.d/upstream.conf', @@ -793,9 +792,15 @@ class WOStackController(CementBaseController): if os.path.isfile("/etc/nginx/nginx.conf") and (not os.path.isfile("/etc/nginx/conf.d/redis.conf")): with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file: redis_file.write("# Log format Settings\n" - "log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n" - "'$http_host \"$request\" $status $body_bytes_sent '\n" - "'\"$http_referer\" \"$http_user_agent\"';\n") + "log_format rt_cache_redis " + ""'$remote_addr " + "$upstream_response_time " + "$srcache_fetch_status [$time_local]" + " '\n" '$http_host" + " \"$request\" " + "$status $body_bytes_sent '\n" + "'\"$http_referer\" " + "\"$http_user_agent\"';\n") if (WOVariables.wo_platform_distro == 'ubuntu'): # Create log directories @@ -819,7 +824,8 @@ class WOStackController(CementBaseController): config.write(configfile) # Parse /etc/php/7.2/fpm/php-fpm.conf - data = dict(pid="/run/php/php7.2-fpm.pid", error_log="/var/log/php/7.2/fpm.log", + data = dict(pid="/run/php/php7.2-fpm.pid", + error_log="/var/log/php/7.2/fpm.log", include="/etc/php/7.2/fpm/pool.d/*.conf") Log.debug(self, "writting php7.2 configuration into " "/etc/php/7.2/fpm/php-fpm.conf") diff --git a/wo/cli/templates/upstream.mustache b/wo/cli/templates/upstream.mustache index 89cb5b1..ca003cb 100644 --- a/wo/cli/templates/upstream.mustache +++ b/wo/cli/templates/upstream.mustache @@ -1,50 +1,29 @@ # Common upstream settings - -# PHP 5.6 upstream +#------------------------------- +# PHP 5.6 +#------------------------------- upstream php { -server 127.0.0.1:9000; +server 127.0.0.1:{{php}}; } upstream debug { -# Debug Pool -server 127.0.0.1:9001; -} - -# PHP 7.0 upstream -upstream php7 { -server 127.0.0.1:9070; -} - -# PHP 7.2 upstream with load-balancing on two unix sockets -upstream php72 { -server unix:/var/run/php/php72-fpm.sock; -} - -# PHP 7.2 debug -upstream debug72 { -# Debug Pool -server 127.0.0.1:9172; -} - -# PHP 7.3 upstream with load-balancing on two unix sockets -upstream php73 { -server unix:/var/run/php/php73-fpm.sock; +server 127.0.0.1:{{debug}}; } {{#php7conf}} -# PHP 7.3 debug -upstream debug73 { +#------------------------------- +# PHP 7.0 +#------------------------------- + +upstream php7 { +server 127.0.0.1:{{php7}}; +} +upstream debug7 { # Debug Pool -server 127.0.0.1:9173; +server 127.0.0.1:{{debug7}}; } {{/php7conf}} -# Netdata Monitoring Upstream -upstream netdata { - server 127.0.0.1:19999; - keepalive 64; -} - {{#hhvmconf}} upstream hhvm { # HHVM Pool @@ -52,3 +31,45 @@ server 127.0.0.1:{{hhvm}}; server 127.0.0.1:{{php}} backup; } {{/hhvmconf}} + + +#------------------------------- +# PHP 7.2 +#------------------------------- + +# PHP 7.2 upstream with load-balancing on two unix sockets +upstream php72 { + server unix:/var/run/php/php72-fpm.sock; +} + +# PHP 7.2 debug +upstream debug72 { +# Debug Pool +server 127.0.0.1:9172; +} + +#------------------------------- +# PHP 7.3 +#------------------------------- + +# PHP 7.3 upstream with load-balancing on two unix sockets +upstream php73 { + server unix:/var/run/php/php73-fpm.sock; +} + +# PHP 7.3 debug +upstream debug73 { +# Debug Pool + server 127.0.0.1:9173; +} + +#------------------------------- +# Netdata +#------------------------------- + +# Netdata Monitoring Upstream +upstream netdata { + server 127.0.0.1:19999; + keepalive 64; +} +