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: Ieac6d03a436f6b706d7f12e292ffc98171a43246
This commit is contained in:
parent
4dd7251f8c
commit
ee018d9083
@ -296,7 +296,6 @@ cinder_pip_packages:
|
|||||||
- python-openstackclient
|
- python-openstackclient
|
||||||
- python-memcached
|
- python-memcached
|
||||||
- systemd-python
|
- systemd-python
|
||||||
- uwsgi
|
|
||||||
|
|
||||||
# Specific pip packages provided by the user
|
# Specific pip packages provided by the user
|
||||||
cinder_user_pip_packages: []
|
cinder_user_pip_packages: []
|
||||||
@ -338,11 +337,9 @@ cinder_services:
|
|||||||
service_name: cinder-api
|
service_name: cinder-api
|
||||||
init_config_overrides: "{{ cinder_api_init_overrides }}"
|
init_config_overrides: "{{ cinder_api_init_overrides }}"
|
||||||
start_order: 4
|
start_order: 4
|
||||||
execstarts: "{{ cinder_uwsgi_bin }}/uwsgi --autoload --ini /etc/uwsgi/cinder-api.ini"
|
|
||||||
execreloads: "{{ cinder_uwsgi_bin }}/uwsgi --reload /var/run/cinder-api/cinder-api.pid"
|
|
||||||
wsgi_overrides: "{{ cinder_api_uwsgi_ini_overrides }}"
|
|
||||||
wsgi_app: True
|
wsgi_app: True
|
||||||
wsgi_name: cinder-wsgi
|
wsgi_name: cinder-wsgi
|
||||||
|
uwsgi_overrides: "{{ cinder_api_uwsgi_ini_overrides }}"
|
||||||
uwsgi_port: "{{ cinder_service_port }}"
|
uwsgi_port: "{{ cinder_service_port }}"
|
||||||
uwsgi_bind_address: "{{ cinder_uwsgi_bind_address }}"
|
uwsgi_bind_address: "{{ cinder_uwsgi_bind_address }}"
|
||||||
|
|
||||||
@ -350,7 +347,6 @@ cinder_services:
|
|||||||
cinder_wsgi_processes_max: 16
|
cinder_wsgi_processes_max: 16
|
||||||
cinder_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, cinder_wsgi_processes_max] | min }}"
|
cinder_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, cinder_wsgi_processes_max] | min }}"
|
||||||
cinder_wsgi_threads: 1
|
cinder_wsgi_threads: 1
|
||||||
cinder_wsgi_buffer_size: 65535
|
|
||||||
|
|
||||||
# This variable is used by the repo_build process to determine
|
# This variable is used by the repo_build process to determine
|
||||||
# which host group to check for members of before building the
|
# which host group to check for members of before building the
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
---
|
|
||||||
# Copyright 2017, 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: "cinder-uwsgi.ini.j2"
|
|
||||||
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
|
|
||||||
mode: "0744"
|
|
||||||
config_overrides: "{{ item.wsgi_overrides }}"
|
|
||||||
config_type: ini
|
|
||||||
with_items: "{{ filtered_cinder_services }}"
|
|
||||||
when: item.wsgi_app | default(False)
|
|
||||||
notify:
|
|
||||||
- Manage LB
|
|
||||||
- Restart cinder services
|
|
@ -135,9 +135,15 @@
|
|||||||
tags:
|
tags:
|
||||||
- cinder-config
|
- cinder-config
|
||||||
|
|
||||||
- import_tasks: cinder_uwsgi.yml
|
- name: Import uwsgi role
|
||||||
|
import_role:
|
||||||
|
name: uwsgi
|
||||||
|
vars:
|
||||||
|
uwsgi_services: "{{ uwsgi_cinder_services }}"
|
||||||
|
uwsgi_install_method: "{{ cinder_install_method }}"
|
||||||
tags:
|
tags:
|
||||||
- cinder-config
|
- cinder-config
|
||||||
|
- uwsgi
|
||||||
|
|
||||||
- import_tasks: service_setup.yml
|
- import_tasks: service_setup.yml
|
||||||
vars:
|
vars:
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
[uwsgi]
|
|
||||||
uid = {{ cinder_system_user_name }}
|
|
||||||
gid = {{ cinder_system_group_name }}
|
|
||||||
|
|
||||||
{% if cinder_install_method == 'source' %}
|
|
||||||
virtualenv = /openstack/venvs/cinder-{{ cinder_venv_tag }}
|
|
||||||
{% endif %}
|
|
||||||
{% if cinder_install_method == 'distro' and (ansible_os_family | lower) == 'debian' %}
|
|
||||||
plugin = python3
|
|
||||||
{% endif %}
|
|
||||||
wsgi-file = {{ cinder_bin }}/{{ item.wsgi_name }}
|
|
||||||
http = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }}
|
|
||||||
|
|
||||||
master = true
|
|
||||||
enable-threads = true
|
|
||||||
processes = {{ cinder_wsgi_processes }}
|
|
||||||
threads = {{ cinder_wsgi_threads }}
|
|
||||||
exit-on-reload = false
|
|
||||||
die-on-term = true
|
|
||||||
lazy-apps = true
|
|
||||||
add-header = Connection: close
|
|
||||||
buffer-size = {{ cinder_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:
|
|
@ -59,3 +59,7 @@
|
|||||||
src: https://opendev.org/openstack/ansible-role-python_venv_build
|
src: https://opendev.org/openstack/ansible-role-python_venv_build
|
||||||
scm: git
|
scm: git
|
||||||
version: master
|
version: master
|
||||||
|
- name: uwsgi
|
||||||
|
src: https://opendev.org/openstack/ansible-role-uwsgi
|
||||||
|
scm: git
|
||||||
|
version: master
|
||||||
|
@ -45,9 +45,7 @@ cinder_devel_distro_packages:
|
|||||||
- libxslt1-dev
|
- libxslt1-dev
|
||||||
- libsystemd-dev
|
- libsystemd-dev
|
||||||
|
|
||||||
cinder_api_distro_packages:
|
cinder_api_distro_packages: []
|
||||||
- uwsgi
|
|
||||||
- uwsgi-plugin-python3
|
|
||||||
|
|
||||||
cinder_volume_distro_packages: []
|
cinder_volume_distro_packages: []
|
||||||
|
|
||||||
@ -72,5 +70,3 @@ cinder_backup_distro_packages:
|
|||||||
cinder_oslomsg_amqp1_distro_packages:
|
cinder_oslomsg_amqp1_distro_packages:
|
||||||
- libsasl2-modules
|
- libsasl2-modules
|
||||||
- sasl2-bin
|
- sasl2-bin
|
||||||
|
|
||||||
cinder_uwsgi_bin: '/usr/bin'
|
|
||||||
|
@ -28,13 +28,35 @@ filtered_cinder_services: |-
|
|||||||
{% for key, value in cinder_services.items() %}
|
{% for key, value in cinder_services.items() %}
|
||||||
{% if (value['group'] in group_names) and
|
{% if (value['group'] in group_names) and
|
||||||
(('condition' not in value) or
|
(('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 _ = value.update({'service_key': key}) %}
|
||||||
{% set _ = services.append(value) %}
|
{% set _ = services.append(value) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ services | sort(attribute='start_order') }}
|
{{ services | sort(attribute='start_order') }}
|
||||||
|
|
||||||
|
uwsgi_cinder_services: |-
|
||||||
|
{% set services = {} %}
|
||||||
|
{% for key, value in cinder_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': cinder_bin ~ '/' ~ value.wsgi_name,
|
||||||
|
'wsgi_venv': ((cinder_install_method == 'source') | ternary(cinder_bin | dirname, None)),
|
||||||
|
'uwsgi_uid': cinder_system_user_name,
|
||||||
|
'uwsgi_guid': cinder_system_group_name,
|
||||||
|
'uwsgi_processes': cinder_wsgi_processes,
|
||||||
|
'uwsgi_threads': cinder_wsgi_threads
|
||||||
|
}
|
||||||
|
) %}
|
||||||
|
{% set _ = services.update({key: value}) %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{{ services }}
|
||||||
|
|
||||||
cinder_core_files:
|
cinder_core_files:
|
||||||
- tmp_f: "/tmp/api-paste.ini"
|
- tmp_f: "/tmp/api-paste.ini"
|
||||||
target_f: "/etc/cinder/api-paste.ini"
|
target_f: "/etc/cinder/api-paste.ini"
|
||||||
|
@ -37,9 +37,7 @@ cinder_devel_distro_packages:
|
|||||||
- systemd-devel
|
- systemd-devel
|
||||||
- zlib-devel
|
- zlib-devel
|
||||||
|
|
||||||
cinder_api_distro_packages:
|
cinder_api_distro_packages: []
|
||||||
- uwsgi
|
|
||||||
- uwsgi-plugin-python
|
|
||||||
|
|
||||||
cinder_volume_distro_packages: []
|
cinder_volume_distro_packages: []
|
||||||
|
|
||||||
@ -64,5 +62,3 @@ cinder_oslomsg_amqp1_distro_packages:
|
|||||||
- cyrus-sasl-lib
|
- cyrus-sasl-lib
|
||||||
- cyrus-sasl-plain
|
- cyrus-sasl-plain
|
||||||
- cyrus-sasl-md5
|
- cyrus-sasl-md5
|
||||||
|
|
||||||
cinder_uwsgi_bin: '/usr/sbin'
|
|
||||||
|
@ -32,4 +32,3 @@ cinder_package_list: |-
|
|||||||
{{ packages }}
|
{{ packages }}
|
||||||
|
|
||||||
_cinder_bin: "/openstack/venvs/cinder-{{ cinder_venv_tag }}/bin"
|
_cinder_bin: "/openstack/venvs/cinder-{{ cinder_venv_tag }}/bin"
|
||||||
cinder_uwsgi_bin: "{{ _cinder_bin }}"
|
|
||||||
|
@ -30,8 +30,6 @@ cinder_service_distro_packages:
|
|||||||
|
|
||||||
cinder_api_distro_packages:
|
cinder_api_distro_packages:
|
||||||
- openstack-cinder-api
|
- openstack-cinder-api
|
||||||
- uwsgi
|
|
||||||
- uwsgi-python
|
|
||||||
|
|
||||||
cinder_devel_distro_packages:
|
cinder_devel_distro_packages:
|
||||||
- git-core
|
- git-core
|
||||||
@ -66,5 +64,3 @@ cinder_oslomsg_amqp1_distro_packages:
|
|||||||
- cyrus-sasl
|
- cyrus-sasl
|
||||||
- cyrus-sasl-plain
|
- cyrus-sasl-plain
|
||||||
- cyrus-sasl-digestmd5
|
- cyrus-sasl-digestmd5
|
||||||
|
|
||||||
cinder_uwsgi_bin: '/usr/sbin'
|
|
||||||
|
Loading…
Reference in New Issue
Block a user