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/678200/
Depends-On: https://review.opendev.org/678055/
Change-Id: If5aeeefb93c8ba3c1368970de61ea1300218f637
This commit is contained in:
Dmitriy Rabotyagov 2019-08-23 15:41:03 +03:00
parent bc372732b8
commit 060a5beb70
11 changed files with 36 additions and 93 deletions

View File

@ -239,7 +239,6 @@ nova_nested_virt_enabled: False
# Uwsgi settings
nova_wsgi_processes_max: 16
nova_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, nova_wsgi_processes_max] | min }}"
nova_wsgi_buffer_size: 65535
nova_wsgi_threads: 1
## Nova libvirt
@ -396,10 +395,8 @@ nova_services:
service_name: nova-api-metadata
init_config_overrides: "{{ nova_api_metadata_init_overrides }}"
start_order: 5
execstarts: "{{ nova_uwsgi_bin }}/uwsgi --autoload --ini /etc/uwsgi/nova-api-metadata.ini"
execreloads: "{{ nova_uwsgi_bin }}/uwsgi --reload /var/run/nova-api-metadata/nova-api-metadata.pid"
wsgi_app: True
wsgi_overrides: "{{ nova_api_metadata_uwsgi_ini_overrides }}"
uwsgi_overrides: "{{ nova_api_metadata_uwsgi_ini_overrides }}"
uwsgi_bind_address: "{{ nova_metadata_bind_address }}"
uwsgi_port: "{{ nova_metadata_port }}"
wsgi_name: nova-metadata-wsgi
@ -408,10 +405,8 @@ nova_services:
service_name: nova-api-os-compute
init_config_overrides: "{{ {'Install': {'Alias': 'nova-api.service'}} | combine(nova_api_os_compute_init_overrides) }}"
start_order: 4
execstarts: "{{ nova_uwsgi_bin }}/uwsgi --autoload --ini /etc/uwsgi/nova-api-os-compute.ini"
execreloads: "{{ nova_uwsgi_bin }}/uwsgi --reload /var/run/nova-api-os-compute/nova-api-os-compute.pid"
wsgi_app: True
wsgi_overrides: "{{ nova_api_os_compute_uwsgi_ini_overrides }}"
uwsgi_overrides: "{{ nova_api_os_compute_uwsgi_ini_overrides }}"
uwsgi_bind_address: "{{ nova_service_bind_address }}"
uwsgi_port: "{{ nova_service_port }}"
wsgi_name: nova-api-wsgi
@ -480,7 +475,6 @@ nova_pip_packages:
- python-novaclient
- python-openstackclient
- systemd-python
- uWSGI
# Specific pip packages provided by the user
nova_user_pip_packages: []

View File

@ -180,9 +180,15 @@
tags:
- nova-config
- import_tasks: nova_uwsgi.yml
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_nova_services }}"
uwsgi_install_method: "{{ nova_install_method }}"
tags:
- nova-config
- uwsgi
- name: Run the systemd service role
import_role:

View File

@ -1,34 +0,0 @@
---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure uWSGI directory exists
file:
path: "/etc/uwsgi/"
state: directory
mode: "0711"
- name: Apply uWSGI configuration
config_template:
src: "nova-uwsgi.ini.j2"
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
mode: "0744"
config_overrides: "{{ item.wsgi_overrides }}"
config_type: ini
with_items: "{{ filtered_nova_services }}"
when: item.wsgi_app | default(False)
notify:
- Manage LB
- Restart nova services

View File

@ -1,29 +0,0 @@
# {{ ansible_managed }}
[uwsgi]
uid = {{ nova_system_user_name }}
gid = {{ nova_system_group_name }}
{% if nova_install_method == 'source' %}
virtualenv = /openstack/venvs/nova-{{ nova_venv_tag }}
{% endif %}
{% if nova_install_method == 'distro' and (ansible_os_family | lower) == 'debian' %}
plugin = python3
{% endif %}
wsgi-file = {{ nova_bin }}/{{ item.wsgi_name }}
http = {{ item.uwsgi_bind_address}}:{{ item.uwsgi_port }}
master = true
enable-threads = true
processes = {{ nova_wsgi_processes }}
threads = {{ nova_wsgi_threads }}
exit-on-reload = false
die-on-term = true
lazy-apps = true
add-header = Connection: close
buffer-size = {{ nova_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

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

@ -43,9 +43,6 @@ nova_service_extra_distro_packages:
- nova-compute-kvm
novnc:
- nova-novncproxy
nova_api:
- uwsgi
- uwsgi-plugin-python3
spice:
- nova-spiceproxy
serialconsole:
@ -101,5 +98,3 @@ nova_compute_kvm_packages_to_symlink:
nova_compute_ksm_packages:
- ksmtuned
nova_uwsgi_bin: '/usr/bin'

View File

@ -20,10 +20,6 @@
#
nova_package_list: |-
{% set packages = nova_distro_packages %}
{% if nova_services['nova-api-metadata']['group'] in group_names or
nova_services['nova-api-os-compute']['group'] in group_names %}
{% set _ = packages.extend(nova_service_extra_distro_packages['nova_api']) %}
{% endif %}
{% if nova_services['nova-novncproxy']['group'] in group_names or
nova_services['nova-spicehtml5proxy']['group'] in group_names or
nova_services['nova-serialconsole-proxy']['group'] in group_names %}

View File

@ -38,13 +38,35 @@ filtered_nova_services: |-
{% for key, value in nova_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_nova_services: |-
{% set services = {} %}
{% for key, value in nova_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': nova_bin ~ '/' ~ value.wsgi_name,
'wsgi_venv': ((nova_install_method == 'source') | ternary(nova_bin | dirname, None)),
'uwsgi_uid': nova_system_user_name,
'uwsgi_guid': nova_system_group_name,
'uwsgi_processes': nova_wsgi_processes,
'uwsgi_threads': nova_wsgi_threads
}
) %}
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}
# Define all Nova mountpoints when using NFS. If defined
# the corresponding directory will only be created by the
# mount point task.

View File

@ -47,9 +47,6 @@ nova_service_extra_distro_packages:
- openstack-nova-migration
novnc:
- openstack-nova-novncproxy
nova_api:
- uwsgi
- uwsgi-plugin-python
spice:
- openstack-nova-spicehtml5proxy
serialconsole:
@ -89,5 +86,3 @@ nova_compute_oslomsg_amqp1_distro_packages:
- cyrus-sasl-lib
- cyrus-sasl-plain
- cyrus-sasl-md5
nova_uwsgi_bin: '/usr/sbin'

View File

@ -37,4 +37,3 @@ nova_package_list: |-
{{ packages }}
_nova_bin: "/openstack/venvs/nova-{{ nova_venv_tag }}/bin"
nova_uwsgi_bin: "{{ _nova_bin }}"

View File

@ -46,9 +46,6 @@ nova_service_extra_distro_packages:
- openstack-nova-compute
novnc:
- openstack-nova-novncproxy
nova_api:
- uwsgi
- uwsgi-python
spice: []
serialconsole:
- openstack-nova-serialproxy
@ -98,5 +95,3 @@ nova_compute_oslomsg_amqp1_distro_packages:
- cyrus-sasl
- cyrus-sasl-plain
- cyrus-sasl-digestmd5
nova_uwsgi_bin: '/usr/sbin'