update upstream template

* cleanup stack.py
* replace nginx-ee by nginx-wo in install script
This commit is contained in:
VirtuBox
2019-03-10 23:46:52 +01:00
parent 759f265fc2
commit a0294576b7
3 changed files with 85 additions and 58 deletions

View File

@@ -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")

View File

@@ -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;
}