Add WOTemplate on other nginx config

This commit is contained in:
VirtuBox
2019-08-19 18:42:16 +02:00
parent c6904241d6
commit 0c5f86881d
2 changed files with 115 additions and 155 deletions

View File

@@ -50,6 +50,7 @@ script:
- sudo wo info - sudo wo info
- sudo cat /etc/nginx/nginx.conf - sudo cat /etc/nginx/nginx.conf
- sudo tree -L 2 /etc/nginx - sudo tree -L 2 /etc/nginx
- sudo tree -L 2 /var/www
- sudo cat /etc/mysql/my.cnf - sudo cat /etc/mysql/my.cnf
- sudo wo stack upgrade --nginx --force - sudo wo stack upgrade --nginx --force
- sudo wo stack upgrade --php --force - sudo wo stack upgrade --php --force

View File

@@ -253,81 +253,53 @@ def post_pref(self, apt_packages, packages):
.format(ngxcom), .format(ngxcom),
'wpsc.mustache', data) 'wpsc.mustache', data)
Log.debug(self, 'Writting the nginx configuration to ' WOTemplate.tmpl_render(self,
'file /etc/nginx/common/wprocket-php72.conf') '{0}/wprocket-php72.conf'
wo_nginx = open('/etc/nginx/common/wprocket-php72.conf', .format(ngxcom),
encoding='utf-8', mode='w') 'wprocket.mustache', data)
self.app.render((data), 'wprocket.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to ' WOTemplate.tmpl_render(self,
'file /etc/nginx/common/wpce-php72.conf') '{0}/wpce-php72.conf'
wo_nginx = open('/etc/nginx/common/wpce-php72.conf', .format(ngxcom),
encoding='utf-8', mode='w') 'wpce.mustache', data)
self.app.render((data), 'wpce.mustache',
out=wo_nginx)
wo_nginx.close()
# PHP 7.3 conf # PHP 7.3 conf
if os.path.isdir("/etc/nginx/common"): if os.path.isdir("/etc/nginx/common"):
data = dict(upstream="php73") data = dict(upstream="php73")
Log.debug(self, 'Writting the nginx configuration to ' WOTemplate.tmpl_render(self,
'file /etc/nginx/common/php73.conf') '{0}/php73.conf'
wo_nginx = open('/etc/nginx/common/php73.conf', .format(ngxcom),
encoding='utf-8', mode='w') 'php.mustache', data)
self.app.render((data), 'php.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to ' WOTemplate.tmpl_render(self,
'file /etc/nginx/common/wpcommon-php73.conf') '{0}/redis-php73.conf'
wo_nginx = open('/etc/nginx/common/wpcommon-php73.conf', .format(ngxcom),
encoding='utf-8', mode='w') 'redis.mustache', data)
self.app.render((data), 'wpcommon.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to ' WOTemplate.tmpl_render(self,
'file /etc/nginx/common/wpfc-php73.conf') '{0}/wpcommon-php73.conf'
wo_nginx = open('/etc/nginx/common/wpfc-php73.conf', .format(ngxcom),
encoding='utf-8', mode='w') 'wpcommon.mustache', data)
self.app.render((data), 'wpfc.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to ' WOTemplate.tmpl_render(self,
'file /etc/nginx/common/wpsc-php73.conf') '{0}/wpfc-php73.conf'
wo_nginx = open('/etc/nginx/common/wpsc-php73.conf', .format(ngxcom),
encoding='utf-8', mode='w') 'wpfc.mustache', data)
self.app.render((data), 'wpsc.mustache', WOTemplate.tmpl_render(self,
out=wo_nginx) '{0}/wpsc-php73.conf'
wo_nginx.close() .format(ngxcom),
'wpsc.mustache', data)
Log.debug(self, 'Writting the nginx configuration to ' WOTemplate.tmpl_render(self,
'file /etc/nginx/common/wprocket-php73.conf') '{0}/wprocket-php73.conf'
wo_nginx = open('/etc/nginx/common/wprocket-php73.conf', .format(ngxcom),
encoding='utf-8', mode='w') 'wprocket.mustache', data)
self.app.render((data), 'wprocket.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to ' WOTemplate.tmpl_render(self,
'file /etc/nginx/common/wpce-php73.conf') '{0}/wpce-php73.conf'
wo_nginx = open('/etc/nginx/common/wpce-php73.conf', .format(ngxcom),
encoding='utf-8', mode='w') 'wpce.mustache', data)
self.app.render((data), 'wpce.mustache',
out=wo_nginx)
wo_nginx.close()
Log.debug(self, 'Writting the nginx configuration to '
'file /etc/nginx/common/redis-php73.conf')
wo_nginx = open('/etc/nginx/common/redis-php73.conf',
encoding='utf-8', mode='w')
self.app.render((data), 'redis.mustache',
out=wo_nginx)
wo_nginx.close()
with open("/etc/nginx/common/release", with open("/etc/nginx/common/release",
"w") as release_file: "w") as release_file:
@@ -337,32 +309,19 @@ def post_pref(self, apt_packages, packages):
# Following files should not be overwrited # Following files should not be overwrited
if not os.path.isfile('/etc/nginx/common/acl.conf'): data = dict(webroot=ngxroot)
data = dict(webroot=ngxroot) WOTemplate.tmpl_render(self,
Log.debug(self, 'Writting the nginx configuration to ' '{0}/acl.conf'
'file /etc/nginx/common/acl.conf') .format(ngxcom),
wo_nginx = open('/etc/nginx/common/acl.conf', 'acl.mustache', data, overwrite=False)
encoding='utf-8', mode='w') WOTemplate.tmpl_render(self,
self.app.render((data), 'acl.mustache', '{0}/blockips.conf'
out=wo_nginx) .format(ngxcnf),
wo_nginx.close() 'blockips.mustache', data, overwrite=False)
if not os.path.isfile('{0}/blockips.conf'.format(ngxcnf)): WOTemplate.tmpl_render(self,
Log.debug(self, 'Writting the nginx configuration to ' '{0}/fastcgi.conf'
'file {0}/blockips.conf'.format(ngxcnf)) .format(ngxcnf),
wo_nginx = open('{0}/blockips.conf'.format(ngxcnf), 'fastcgi.mustache', data, overwrite=False)
encoding='utf-8', mode='w')
self.app.render(
(data), 'blockips.mustache', out=wo_nginx)
wo_nginx.close()
if not os.path.isfile('{0}/fastcgi.conf'.format(ngxcnf)):
Log.debug(self, 'Writting the nginx configuration to '
'file {0}/fastcgi.conf'.format(ngxcnf))
wo_nginx = open('{0}/fastcgi.conf'.format(ngxcnf),
encoding='utf-8', mode='w')
self.app.render(
(data), 'fastcgi.mustache', out=wo_nginx)
wo_nginx.close()
# add redis cache format if not already done # add redis cache format if not already done
if (os.path.isfile("/etc/nginx/nginx.conf") and if (os.path.isfile("/etc/nginx/nginx.conf") and