Merge "Start using uWSGI role"

This commit is contained in:
Zuul 2019-09-06 15:37:53 +00:00 committed by Gerrit Code Review
commit aa3ef79627
11 changed files with 41 additions and 63 deletions

View File

@ -44,7 +44,7 @@ mistral_pip_packages:
- PyMySQL
- python-memcached
- systemd-python
- uwsgi
mistral_optional_oslomsg_amqp1_pip_packages:
- oslo.messaging[amqp1]
mistral_venv_tag: "{{ venv_tag | default('untagged') }}"
@ -77,18 +77,15 @@ mistral_services:
service_name: mistral-api
init_config_overrides: "{{ mistral_api_init_overrides }}"
start_order: 2
wsgi_overrides: "{{ mistral_api_uwsgi_ini_overrides }}"
wsgi_app: true
wsgi_name: mistral-wsgi-api
uwsgi_overrides: "{{ mistral_api_uwsgi_ini_overrides }}"
uwsgi_bind_address: "{{ mistral_bind_address }}"
uwsgi_port: "{{ mistral_service_port }}"
execstarts: "{{ mistral_uwsgi_bin }}/uwsgi --autoload --ini /etc/uwsgi/mistral-api.ini"
execreloads: "{{ mistral_uwsgi_bin }}/uwsgi --reload /var/run/mistral-api/mistral-api.pid"
# UWSGI settings
mistral_wsgi_processes_max: 16
mistral_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, mistral_wsgi_processes_max] | min }}"
mistral_wsgi_buffer_size: 65535
mistral_wsgi_threads: 1
# RPC

View File

@ -122,6 +122,16 @@
- mistral-config
- systemd-service
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_mistral_services }}"
uwsgi_install_method: "{{ mistral_install_method }}"
tags:
- mistral-config
- uwsgi
- import_tasks: service_setup.yml
vars:
_service_adminuri_insecure: "{{ keystone_service_adminuri_insecure }}"

View File

@ -94,22 +94,3 @@
value: true
when: (install_packages is changed) or
('need_service_restart' not in ansible_local['openstack_ansible']['mistral'])
- name: Ensure uWSGI directory exists
file:
path: "/etc/uwsgi/"
state: directory
mode: "0711"
- name: Apply uWSGI configuration
config_template:
src: "mistral-uwsgi.ini.j2"
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
mode: "0744"
config_overrides: "{{ item.wsgi_overrides }}"
config_type: ini
with_items: "{{ filtered_mistral_services }}"
when: item.wsgi_app | default(False)
notify:
- Manage LB
- Restart mistral services

View File

@ -30,6 +30,7 @@
notify:
- Manage LB
- Restart mistral services
- Restart uwsgi services
- name: Implement policy.json if there are overrides configured
copy:

View File

@ -1,29 +0,0 @@
# {{ ansible_managed }}
[uwsgi]
uid = {{ mistral_system_user_name }}
gid = {{ mistral_system_group_name }}
{% if mistral_install_method == 'source' %}
virtualenv = /openstack/venvs/mistral-{{ mistral_venv_tag }}
{% endif %}
{% if mistral_install_method == 'distro' and (ansible_os_family | lower) == 'debian' %}
plugin = python3
{% endif %}
wsgi-file = {{ mistral_bin }}/{{ item.wsgi_name }}
http = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }}
master = true
enable-threads = true
processes = {{ mistral_wsgi_processes }}
threads = {{ mistral_wsgi_threads }}
exit-on-reload = false
die-on-term = true
lazy-apps = true
add-header = Connection: close
buffer-size = {{ mistral_wsgi_buffer_size }}
thunder-lock = true
disable-logging = true
pidfile = /var/run/{{ item.service_name }}/{{ item.service_name }}.pid
# Avoid filling up the logs with health check requests from haproxy.
route-user-agent = ^osa-haproxy-healthcheck$ donotlog:

View File

@ -51,3 +51,7 @@
src: https://opendev.org/openstack/ansible-role-python_venv_build
scm: git
version: master
- name: uwsgi
src: https://opendev.org/openstack/ansible-role-uwsgi
scm: git
version: master

View File

@ -24,12 +24,9 @@ mistral_distro_packages:
mistral_service_distro_packages:
- python3-mistral
- python3-systemd
- uwsgi
- uwsgi-plugin-python3
mistral_oslomsg_amqp1_distro_packages:
- libsasl2-modules
- sasl2-bin
mistral_uwsgi_bin: '/usr/bin'
cache_timeout: 600

View File

@ -23,9 +23,31 @@ filtered_mistral_services: |-
{% for key, value in mistral_services.items() %}
{% if (value['group'] in group_names) and
(('condition' not in value) or
('condition' in value and value['condition'])) %}
('condition' in value and value['condition'])) and
not ('wsgi_app' in value and value['wsgi_app']) %}
{% set _ = value.update({'service_key': key}) %}
{% set _ = services.append(value) %}
{% endif %}
{% endfor %}
{{ services | sort(attribute='start_order') }}
{{ services | sort(attribute='start_order') }}
uwsgi_mistral_services: |-
{% set services = {} %}
{% for key, value in mistral_services.items() %}
{% if (value['group'] in group_names) and
(('condition' not in value) or ('condition' in value and value['condition']))
and ('wsgi_app' in value and value['wsgi_app']) %}
{% set _ = value.update(
{
'wsgi_path': mistral_bin ~ '/' ~ value.wsgi_name,
'wsgi_venv': ((mistral_install_method == 'source') | ternary(mistral_bin | dirname, None)),
'uwsgi_uid': mistral_system_user_name,
'uwsgi_guid': mistral_system_group_name,
'uwsgi_processes': mistral_wsgi_processes,
'uwsgi_threads': mistral_wsgi_threads
}
) %}
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}

View File

@ -30,5 +30,3 @@ mistral_oslomsg_amqp1_distro_packages:
- cyrus-sasl-lib
- cyrus-sasl-plain
- cyrus-sasl-md5
mistral_uwsgi_bin: '/usr/sbin'

View File

@ -21,4 +21,3 @@ mistral_package_list: |-
{{ packages }}
_mistral_bin: "/openstack/venvs/mistral-{{ mistral_venv_tag }}/bin"
mistral_uwsgi_bin: "{{ _mistral_bin }}"

View File

@ -27,5 +27,3 @@ mistral_oslomsg_amqp1_distro_packages:
- cyrus-sasl
- cyrus-sasl-plain
- cyrus-sasl-digestmd5
mistral_uwsgi_bin: '/usr/sbin'