Start using uWSGI role

Move service to use uWSGI role instead of iternal task for uwsgi
deployment. This aims to ease the maintenance of uWSGI and speedup
metal deployments as the same uwsgi environment will be used
across all services.

Depends-On: https://review.opendev.org/678025/
Change-Id: I6f129940e55130c289d94138171cee54dbd28fc1
This commit is contained in:
Dmitriy Rabotyagov 2019-08-22 19:27:25 +03:00
parent 4c8dd7f0f3
commit 4b2724b44b
10 changed files with 39 additions and 68 deletions

View File

@ -249,7 +249,6 @@ glance_pip_packages:
- python-memcached
- python-swiftclient
- systemd-python
- uwsgi
- warlock
# Specific pip packages provided by the user
@ -268,13 +267,11 @@ glance_services:
service_name: glance-api
init_config_overrides: "{{ glance_api_init_overrides }}"
start_order: 1
wsgi_overrides: "{{ glance_api_uwsgi_ini_overrides }}"
wsgi_app: True
wsgi_name: glance-wsgi-api
uwsgi_overrides: "{{ glance_api_uwsgi_ini_overrides }}"
uwsgi_bind_address: "{{ glance_api_bind_address }}"
uwsgi_port: "{{ glance_api_service_port }}"
execstarts: "{{ glance_uwsgi_bin }}/uwsgi --autoload --ini /etc/uwsgi/glance-api.ini"
execreloads: "{{ glance_uwsgi_bin }}/uwsgi --reload /var/run/glance-api/glance-api.pid"
glance-registry:
group: glance_registry
service_name: glance-registry
@ -287,7 +284,6 @@ glance_services:
glance_wsgi_processes_max: 16
glance_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, glance_wsgi_processes_max] | min }}"
glance_wsgi_threads: 1
glance_wsgi_buffer_size: 65535
# This variable is used by the repo_build process to determine
# which host group to check for members of before building the

View File

@ -182,22 +182,3 @@
tags:
- glance-config
- systemd-service
- name: Ensure uWSGI directory exists
file:
path: "/etc/uwsgi/"
state: directory
mode: "0711"
- name: Apply uWSGI configuration
config_template:
src: "glance-uwsgi.ini.j2"
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
mode: "0744"
config_overrides: "{{ item.wsgi_overrides }}"
config_type: ini
with_items: "{{ filtered_glance_services }}"
when: item.wsgi_app | default(False)
notify:
- Manage LB
- Restart glance services

View File

@ -122,6 +122,17 @@
tags:
- glance-config
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_glance_services }}"
uwsgi_install_method: "{{ glance_install_method }}"
tags:
- glance-install
- glance-config
- uwsgi
- name: Import ceph_client role
import_role:
name: ceph_client

View File

@ -1,30 +0,0 @@
[uwsgi]
uid = {{ glance_system_user_name }}
gid = {{ glance_system_group_name }}
{% if glance_install_method == 'source' %}
virtualenv = /openstack/venvs/glance-{{ glance_venv_tag }}
{% endif %}
{% if glance_install_method == 'distro' and (ansible_os_family | lower) == 'debian' %}
plugin = python3
{% endif %}
wsgi-file = {{ glance_bin }}/{{ item.wsgi_name }}
http-socket = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }}
master = true
enable-threads = true
processes = {{ glance_wsgi_processes }}
threads = {{ glance_wsgi_threads }}
exit-on-reload = true
die-on-term = true
lazy-apps = true
add-header = Connection: close
buffer-size = {{ glance_wsgi_buffer_size }}
thunder-lock = true
disable-logging = true
http-auto-chunked = true
http-raw-body = true
socket-timeout = 10
# Avoid filling up the logs with health check requests from haproxy.
route-user-agent = ^osa-haproxy-healthcheck$ donotlog:

View File

@ -63,3 +63,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

@ -31,11 +31,7 @@ glance_devel_distro_packages:
glance_service_distro_packages:
- python3-glance
- python3-systemd
- uwsgi
- uwsgi-plugin-python3
glance_oslomsg_amqp1_distro_packages:
- libsasl2-modules
- sasl2-bin
glance_uwsgi_bin: '/usr/bin'

View File

@ -23,13 +23,35 @@ filtered_glance_services: |-
{% for key, value in glance_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') }}
uwsgi_glance_services: |-
{% set services = {} %}
{% for key, value in glance_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': glance_bin ~ '/' ~ value.wsgi_name,
'wsgi_venv': ((glance_install_method == 'source') | ternary(glance_bin | dirname, None)),
'uwsgi_uid': glance_system_user_name,
'uwsgi_guid': glance_system_group_name,
'uwsgi_processes': glance_wsgi_processes,
'uwsgi_threads': glance_wsgi_threads,
}
) %}
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}
# Define all glance mountpoints when using NFS. If defined
# the corresponding directory will only be created by the
# mount point task.

View File

@ -27,16 +27,12 @@ glance_devel_distro_packages:
glance_service_distro_packages:
- openstack-glance
- systemd-python
- uwsgi
- uwsgi-plugin-python
glance_oslomsg_amqp1_distro_packages:
- cyrus-sasl-lib
- cyrus-sasl-plain
- cyrus-sasl-md5
glance_uwsgi_bin: '/usr/sbin'
glance_core_files:
- tmp_f: "/tmp/policy.json"
target_f: "{{ glance_etc_dir }}/policy.json"

View File

@ -21,4 +21,3 @@ glance_package_list: |-
{{ packages }}
_glance_bin: "/openstack/venvs/glance-{{ glance_venv_tag }}/bin"
glance_uwsgi_bin: "{{ _glance_bin }}"

View File

@ -29,12 +29,8 @@ glance_service_distro_packages:
- openstack-glance
- openstack-glance-api
- python-systemd
- uwsgi
- uwsgi-python
glance_oslomsg_amqp1_distro_packages:
- cyrus-sasl
- cyrus-sasl-plain
- cyrus-sasl-digestmd5
glance_uwsgi_bin: '/usr/sbin'