Make spotter-appmgr restart nginx on port change instead of just reloading
This commit is contained in:
		
							parent
							
								
									e45d836e88
								
							
						
					
					
						commit
						5b714d0b10
					
				| @ -123,16 +123,13 @@ class SpotterManager: | |||||||
| 
 | 
 | ||||||
|     def update_proxy(self, app): |     def update_proxy(self, app): | ||||||
|         self.add_app_to_nginx(app) |         self.add_app_to_nginx(app) | ||||||
|         self.reload_nginx() |         subprocess.call(['service', 'nginx', 'reload']) | ||||||
| 
 | 
 | ||||||
|     def add_app_to_nginx(self, app): |     def add_app_to_nginx(self, app): | ||||||
|         ip = get_container_ip(app) |         ip = get_container_ip(app) | ||||||
|         with open(os.path.join(NGINX_DIR, '{}.conf'.format(app)), 'w') as f: |         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)) |             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): |     def update_domain(self, domain, port): | ||||||
|         self.domain = self.conf["_"]["domain"] = domain |         self.domain = self.conf["_"]["domain"] = domain | ||||||
|         self.port = self.conf["_"]["port"] = port |         self.port = self.conf["_"]["port"] = port | ||||||
| @ -140,7 +137,7 @@ class SpotterManager: | |||||||
|         self.update_app_confs() |         self.update_app_confs() | ||||||
|         self.rebuild_nginx() |         self.rebuild_nginx() | ||||||
|         self.rebuild_issue() |         self.rebuild_issue() | ||||||
|         self.reload_nginx() |         subprocess.call(['service', 'nginx', 'restart']) | ||||||
| 
 | 
 | ||||||
|     def update_app_confs(self): |     def update_app_confs(self): | ||||||
|         for app in self.conf.iteritems(): |         for app in self.conf.iteritems(): | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user