From a83e7548f11fa8bc2e2ae88abd0eb3307798da56 Mon Sep 17 00:00:00 2001 From: Vasily Ostanin Date: Thu, 26 Jan 2017 15:36:30 +0500 Subject: [PATCH] fix for 0.3 --- circle.yml | 1 - nginx/nginx.conf | 2 ++ requirements.txt | 2 +- src/vergilius/loop/nginx_reloader.py | 8 +++++++- src/vergilius/templates/service_validate.html | 2 ++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index cca56e2..eec926c 100644 --- a/circle.yml +++ b/circle.yml @@ -20,7 +20,6 @@ test: pre: - docker run -d -p 8500:8500 e96tech/consul-server -advertise 127.0.0.1 -bootstrap -dc circle -domain local - curl --retry 10 --retry-delay 5 -v http://localhost:8500 - - sed -i '1i load_module "modules/ngx_stream_module.so";' /home/ubuntu/vergilius/src/vergilius/templates/service_validate.html deployment: dockerhub_master: diff --git a/nginx/nginx.conf b/nginx/nginx.conf index f681d50..de97773 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,6 +1,8 @@ user root; worker_processes 4; +load_module "modules/ngx_stream_module.so"; + error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; diff --git a/requirements.txt b/requirements.txt index 53fbe21..8af8f89 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ zope.component==4.2.2 zope.event==4.1.0 zope.interface==4.1.3 -python-consul==0.4.7 +python-consul==0.7.0 tornado==4.3 funcsigs==1.0.0 mock==1.3.0 diff --git a/src/vergilius/loop/nginx_reloader.py b/src/vergilius/loop/nginx_reloader.py index a7a89ea..f7fa35d 100644 --- a/src/vergilius/loop/nginx_reloader.py +++ b/src/vergilius/loop/nginx_reloader.py @@ -4,6 +4,12 @@ import vergilius +try: + from subprocess import DEVNULL # py3k +except ImportError: + import os + DEVNULL = open(os.devnull, 'wb') + class NginxReloader(object): nginx_update_event = Event() @@ -18,7 +24,7 @@ def nginx_reload(cls): yield cls.nginx_update_event.wait() cls.nginx_update_event.clear() vergilius.logger.info('[nginx]: reload') - subprocess.check_call([vergilius.config.NGINX_BINARY, '-s', 'reload'], stdout=subprocess.DEVNULL) + subprocess.check_call([vergilius.config.NGINX_BINARY, '-s', 'reload'], stdout=DEVNULL) @classmethod def queue_reload(cls): diff --git a/src/vergilius/templates/service_validate.html b/src/vergilius/templates/service_validate.html index ad4cf71..d8e77f7 100644 --- a/src/vergilius/templates/service_validate.html +++ b/src/vergilius/templates/service_validate.html @@ -1,3 +1,5 @@ +load_module "modules/ngx_stream_module.so"; + worker_processes 1; pid {{pid_file}};