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.

Change-Id: I946adf21b58e117508dcc470c0fb3e9c2565c26d
This commit is contained in:
Mohammed Naser 2020-01-30 09:29:01 +01:00 committed by Dmitriy Rabotyagov (noonedeadpunk)
parent 1838f95d33
commit abbfec221b
7 changed files with 38 additions and 65 deletions

View File

@ -218,7 +218,6 @@ manila_pip_packages:
- python-openstackclient
- python-memcached
- systemd-python
- uwsgi
# Memcached override
manila_memcached_servers: "{{ memcached_servers }}"
@ -261,11 +260,9 @@ manila_services:
service_name: manila-api
init_config_overrides: "{{ manila_api_init_overrides }}"
start_order: 4
execstarts: "{{ manila_uwsgi_bin }}/uwsgi --autoload --ini /etc/uwsgi/manila-api.ini"
execreloads: "{{ manila_uwsgi_bin }}/uwsgi --reload /var/run/manila_api/manila-api.pid"
wsgi_overrides: "{{ manila_api_uwsgi_ini_overrides }}"
wsgi_app: True
wsgi_name: manila-wsgi
uwsgi_overrides: "{{ manila_api_uwsgi_ini_overrides }}"
uwsgi_port: "{{ manila_service_port }}"
uwsgi_bind_address: "{{ manila_uwsgi_bind_address }}"

View File

@ -121,9 +121,17 @@
tags:
- manila-config
- import_tasks: manila_uwsgi.yml
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_manila_services }}"
uwsgi_install_method: "source"
when:
- manila_services['manila-api']['group'] in group_names
tags:
- manila-config
- uwsgi
- name: import_tasks ceph_client role
import_role:

View File

@ -36,6 +36,7 @@
notify:
- Manage LB
- Restart manila services
- Restart uwsgi services
- name: Drop sudoers file
template:

View File

@ -1,34 +0,0 @@
---
# Copyright 2019, 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: "manila-uwsgi.ini.j2"
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
mode: "0744"
config_overrides: "{{ item.wsgi_overrides }}"
config_type: ini
with_items: "{{ filtered_manila_services }}"
when:
- item.wsgi_app | default(false)
notify:
- Manage LB
- Restart manila services

View File

@ -1,25 +0,0 @@
[uwsgi]
uid = {{ manila_system_user_name }}
gid = {{ manila_system_group_name }}
{% if manila_install_method == 'source' %}
virtualenv = /openstack/venvs/manila-{{ manila_venv_tag }}
{% endif %}
wsgi-file = {{ manila_bin }}/{{ item.wsgi_name }}
http = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }}
master = true
enable-threads = true
processes = {{ manila_wsgi_processes }}
threads = {{ manila_wsgi_threads }}
exit-on-reload = false
die-on-term = true
lazy-apps = true
add-header = Connection: close
buffer-size = {{ manila_wsgi_buffer_size }}
thunder-lock = true
logfile-chmod = 644
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

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

@ -26,13 +26,35 @@ filtered_manila_services: |-
{% for key, value in manila_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_manila_services: |-
{% set services = {} %}
{% for key, value in manila_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': manila_bin ~ '/' ~ value.wsgi_name,
'wsgi_venv': ((manila_install_method == 'source') | ternary(manila_bin | dirname, None)),
'uwsgi_uid': manila_system_user_name,
'uwsgi_guid': manila_system_group_name,
'uwsgi_processes': manila_wsgi_processes,
'uwsgi_threads': manila_wsgi_threads
}
) %}
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}
manila_core_files:
- src: "manila.conf.j2"
dest: "/etc/manila/manila.conf"