From 4e477b7cae9192cc9044758b2eb88c6fd728616e Mon Sep 17 00:00:00 2001 From: okozachenko Date: Wed, 8 Jul 2020 16:31:46 +0300 Subject: [PATCH] Set uwsgi worker number equal to core number on horizon Change-Id: Ia92cb8d73fd8a4531d7ff4e9950cad7ff44cc363 --- images/horizon/Dockerfile | 1 + .../templates/horizon/daemonset.yml.j2 | 6 ++++ .../operator/uwsgidefaultconfig.yml.j2 | 32 +++++++++---------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/images/horizon/Dockerfile b/images/horizon/Dockerfile index beb21624..ff48785b 100644 --- a/images/horizon/Dockerfile +++ b/images/horizon/Dockerfile @@ -48,3 +48,4 @@ ENV UWSGI_HTTP_SOCKET=:8000 \ UWSGI_CHECK_STATIC=/usr/local/lib/python3.7/site-packages/static/ \ UWSGI_STATIC_MAP="/static=/usr/local/lib/python3.7/site-packages/static/" \ UWSGI_MIME_FILE="/etc/mime.types" +CMD ["/usr/local/bin/uwsgi","--ini","/etc/uwsgi/uwsgi.ini"] diff --git a/openstack_operator/templates/horizon/daemonset.yml.j2 b/openstack_operator/templates/horizon/daemonset.yml.j2 index 14019180..9b0f001a 100644 --- a/openstack_operator/templates/horizon/daemonset.yml.j2 +++ b/openstack_operator/templates/horizon/daemonset.yml.j2 @@ -73,6 +73,8 @@ spec: volumeMounts: - name: config mountPath: /etc/horizon + - name: uwsgi-config + mountPath: /etc/uwsgi {% if 'logo' in spec %} - name: logo mountPath: /usr/local/lib/python3.7/site-packages/static/dashboard/img/logo.svg @@ -89,6 +91,10 @@ spec: configMap: defaultMode: 420 name: horizon + - name: uwsgi-config + configMap: + defaultMode: 420 + name: uwsgi-default {% if 'logo' in spec %} - name: logo configMap: diff --git a/openstack_operator/templates/operator/uwsgidefaultconfig.yml.j2 b/openstack_operator/templates/operator/uwsgidefaultconfig.yml.j2 index 5fc18eeb..4e5a3c4b 100644 --- a/openstack_operator/templates/operator/uwsgidefaultconfig.yml.j2 +++ b/openstack_operator/templates/operator/uwsgidefaultconfig.yml.j2 @@ -4,19 +4,19 @@ metadata: name: uwsgi-default namespace: openstack data: - uwsgi.yaml: | - uwsgi: - enable-threads: True - processes: '%k' - exit-on-reload: True - die-on-term: True - lazy-apps: True - add-header: 'Connection: close' - buffer-size: 65535 - thunder-lock: True - http-auto-chunked: True - http-raw-body: True - socket-timeout: 10 - need-app: True - route-user-agent: '^kube-probe.* donotlog:' - log-x-forwarded-for: True + uwsgi.ini: |- + [uwsgi] + enable-threads = true + workers = %(%k * 1) + exit-on-reload = true + die-on-term = true + lazy-apps = true + add-header = 'Connection: close' + buffer-size = 65535 + thunder-lock = true + http-auto-chunked = true + http-raw-body = true + socket-timeout = 10 + need-app = true + route-user-agent = '^kube-probe.* donotlog:' + log-x-forwarded-for = true