From afa917a3dee66bc687d7a6ff8140624241ed03ed Mon Sep 17 00:00:00 2001 From: Michael Johnson Date: Tue, 6 Aug 2019 17:09:48 -0700 Subject: [PATCH] Change amphora logging to dedicated socket In some environments running older versions of gunicorn in the amphora image, gunicorn can fail to start do to /dev/log socket issues (timing, configuration, etc.). This patch sets up a dedicated rsyslog socket /run/rsyslog/octavia/log for gunicorn and haproxy to use. This should resolve any issues with systemd overriding the /dev/log socket. This also bumps the gunicorn minimum verison to 19.9.0. Change-Id: I1e1ad8fde2ad8c1ffba95b1867afb130503b0a5b --- elements/amphora-agent/element-deps | 1 + .../amphora-agent/static/etc/rsyslog.d/55-octavia-socket.conf | 4 ++++ lower-constraints.txt | 2 +- octavia/cmd/agent.py | 2 +- .../common/jinja/haproxy/combined_listeners/templates/base.j2 | 4 ++-- .../common/jinja/haproxy/split_listeners/templates/base.j2 | 4 ++-- .../backends/agent/api_server/test_haproxy_compatibility.py | 4 ++-- .../unit/common/sample_configs/sample_configs_combined.py | 4 ++-- .../tests/unit/common/sample_configs/sample_configs_split.py | 4 ++-- requirements.txt | 2 +- 10 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 elements/amphora-agent/static/etc/rsyslog.d/55-octavia-socket.conf diff --git a/elements/amphora-agent/element-deps b/elements/amphora-agent/element-deps index f16aabadd9..ea84e496ad 100644 --- a/elements/amphora-agent/element-deps +++ b/elements/amphora-agent/element-deps @@ -1,4 +1,5 @@ dib-init-system +install-static package-installs pkg-map source-repositories diff --git a/elements/amphora-agent/static/etc/rsyslog.d/55-octavia-socket.conf b/elements/amphora-agent/static/etc/rsyslog.d/55-octavia-socket.conf new file mode 100644 index 0000000000..8983a13850 --- /dev/null +++ b/elements/amphora-agent/static/etc/rsyslog.d/55-octavia-socket.conf @@ -0,0 +1,4 @@ +module(load="imuxsock") +input(type="imuxsock" + Socket="/run/rsyslog/octavia/log" + CreatePath="on") diff --git a/lower-constraints.txt b/lower-constraints.txt index 9ef40ac0a3..8625e4a2d4 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -43,7 +43,7 @@ futures==3.0.0 gitdb2==2.0.3 GitPython==2.1.8 greenlet==0.4.13 -gunicorn==19.0.0 +gunicorn==19.9.0 hacking==0.12.0 idna==2.6 imagesize==1.0.0 diff --git a/octavia/cmd/agent.py b/octavia/cmd/agent.py index 0eca392aa7..9f0c764f7c 100644 --- a/octavia/cmd/agent.py +++ b/octavia/cmd/agent.py @@ -83,7 +83,7 @@ def main(): 'syslog': True, 'syslog_facility': 'local{}'.format( CONF.amphora_agent.administrative_log_facility), - 'syslog_addr': 'unix://dev/log', + 'syslog_addr': 'unix://run/rsyslog/octavia/log#dgram', } AmphoraAgent(server_instance.app, options).run() diff --git a/octavia/common/jinja/haproxy/combined_listeners/templates/base.j2 b/octavia/common/jinja/haproxy/combined_listeners/templates/base.j2 index c06093ceb2..17fadb5b7d 100644 --- a/octavia/common/jinja/haproxy/combined_listeners/templates/base.j2 +++ b/octavia/common/jinja/haproxy/combined_listeners/templates/base.j2 @@ -17,8 +17,8 @@ global daemon user nobody - log {{ log_http | default('/dev/log', true)}} local{{ user_log_facility }} - log {{ log_server | default('/dev/log', true)}} local{{ administrative_log_facility }} notice + log {{ log_http | default('/run/rsyslog/octavia/log', true)}} local{{ user_log_facility }} + log {{ log_server | default('/run/rsyslog/octavia/log', true)}} local{{ administrative_log_facility }} notice stats socket {{ sock_path }} mode 0666 level user {% if loadbalancer.global_connection_limit is defined %} maxconn {{ loadbalancer.global_connection_limit }} diff --git a/octavia/common/jinja/haproxy/split_listeners/templates/base.j2 b/octavia/common/jinja/haproxy/split_listeners/templates/base.j2 index 734cf8d020..591b4442fa 100644 --- a/octavia/common/jinja/haproxy/split_listeners/templates/base.j2 +++ b/octavia/common/jinja/haproxy/split_listeners/templates/base.j2 @@ -17,8 +17,8 @@ global daemon user nobody - log {{ log_http | default('/dev/log', true)}} local{{ user_log_facility }} - log {{ log_server | default('/dev/log', true)}} local{{ administrative_log_facility }} notice + log {{ log_http | default('/run/rsyslog/octavia/log', true)}} local{{ user_log_facility }} + log {{ log_server | default('/run/rsyslog/octavia/log', true)}} local{{ administrative_log_facility }} notice stats socket {{ sock_path }} mode 0666 level user {% if loadbalancer.global_connection_limit is defined %} maxconn {{ loadbalancer.global_connection_limit }} diff --git a/octavia/tests/unit/amphorae/backends/agent/api_server/test_haproxy_compatibility.py b/octavia/tests/unit/amphorae/backends/agent/api_server/test_haproxy_compatibility.py index a3ac074814..3107ece0eb 100644 --- a/octavia/tests/unit/amphorae/backends/agent/api_server/test_haproxy_compatibility.py +++ b/octavia/tests/unit/amphorae/backends/agent/api_server/test_haproxy_compatibility.py @@ -28,8 +28,8 @@ class HAProxyCompatTestCase(base.TestCase): "global\n" " daemon\n" " user nobody\n" - " log /dev/log local0\n" - " log /dev/log local1 notice\n" + " log /run/rsyslog/octavia/log local0\n" + " log /run/rsyslog/octavia/log local1 notice\n" " stats socket /var/lib/octavia/sample_loadbalancer_id_1.sock" " mode 0666 level user\n" " maxconn {maxconn}\n\n" diff --git a/octavia/tests/unit/common/sample_configs/sample_configs_combined.py b/octavia/tests/unit/common/sample_configs/sample_configs_combined.py index 504e5a18b1..27aea1502f 100644 --- a/octavia/tests/unit/common/sample_configs/sample_configs_combined.py +++ b/octavia/tests/unit/common/sample_configs/sample_configs_combined.py @@ -1085,8 +1085,8 @@ def sample_base_expected_config(frontend=None, backend=None, "global\n" " daemon\n" " user nobody\n" - " log /dev/log local0\n" - " log /dev/log local1 notice\n" + " log /run/rsyslog/octavia/log local0\n" + " log /run/rsyslog/octavia/log local1 notice\n" " stats socket /var/lib/octavia/sample_loadbalancer_id_1.sock" " mode 0666 level user\n" + global_opts + defaults + peers + frontend + backend) diff --git a/octavia/tests/unit/common/sample_configs/sample_configs_split.py b/octavia/tests/unit/common/sample_configs/sample_configs_split.py index 9d18e3ea9e..bb6b6a5f7b 100644 --- a/octavia/tests/unit/common/sample_configs/sample_configs_split.py +++ b/octavia/tests/unit/common/sample_configs/sample_configs_split.py @@ -1103,8 +1103,8 @@ def sample_base_expected_config(frontend=None, backend=None, "global\n" " daemon\n" " user nobody\n" - " log /dev/log local0\n" - " log /dev/log local1 notice\n" + " log /run/rsyslog/octavia/log local0\n" + " log /run/rsyslog/octavia/log local1 notice\n" " stats socket /var/lib/octavia/sample_listener_id_1.sock" " mode 0666 level user\n" + global_opts + defaults + peers + frontend + backend) diff --git a/requirements.txt b/requirements.txt index eac49c51df..adcb5c6f34 100644 --- a/requirements.txt +++ b/requirements.txt @@ -55,5 +55,5 @@ netifaces>=0.10.4 # MIT ipaddress>=1.0.17;python_version<'3.3' # PSF cryptography>=2.1 # BSD/Apache-2.0 pyroute2>=0.4.21;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2) -gunicorn>=19.0.0 # MIT +gunicorn>=19.9.0 # MIT Werkzeug>=0.14.1 # BSD License