Make spotter-appmgr restart nginx on port change instead of just reloading

This commit is contained in:
Disassembler 2018-03-29 14:32:15 +02:00
parent e45d836e88
commit 5b714d0b10
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499

View File

@ -123,16 +123,13 @@ class SpotterManager:
def update_proxy(self, app):
self.add_app_to_nginx(app)
self.reload_nginx()
subprocess.call(['service', 'nginx', 'reload'])
def add_app_to_nginx(self, app):
ip = get_container_ip(app)
with open(os.path.join(NGINX_DIR, '{}.conf'.format(app)), 'w') as f:
f.write(NGINX_TEMPLATE.format(app=app, ip=ip, domain=self.domain, port=self.port))
def reload_nginx(self):
subprocess.call(['service', 'nginx', 'reload'])
def update_domain(self, domain, port):
self.domain = self.conf["_"]["domain"] = domain
self.port = self.conf["_"]["port"] = port
@ -140,7 +137,7 @@ class SpotterManager:
self.update_app_confs()
self.rebuild_nginx()
self.rebuild_issue()
self.reload_nginx()
subprocess.call(['service', 'nginx', 'restart'])
def update_app_confs(self):
for app in self.conf.iteritems():