Add uWSGI support to blazar

This patch adds uWSGI support to os_blazar role. All openstack services
should stay behind uWSGI.

It's also required for upcoming TLS backend feature. Blazar does not
have native TLS support so it needs to be handled by uWSGI.

Change-Id: I65511de4d5014a28f0f91536f9dbaf96fcb8e7a2
This commit is contained in:
Damian Dabrowski 2023-04-17 17:00:53 +02:00
parent c1418e167a
commit c9d10f41fa
5 changed files with 50 additions and 2 deletions

View File

@ -93,9 +93,13 @@ blazar_services:
blazar-api:
group: blazar_all
service_name: blazar-api
execstarts: "{{ blazar_bin }}/blazar-api {{ blazar_config_option }}"
init_config_overrides: "{{ blazar_api_init_config_overrides }}"
start_order: 1
wsgi_app: True
wsgi_name: blazar-api-wsgi
uwsgi_port: "{{ blazar_service_port }}"
uwsgi_bind_address: "{{ blazar_bind_address }}"
uwsgi_overrides: "{{ blazar_api_uwsgi_ini_overrides }}"
blazar-manager:
group: blazar_all
service_name: blazar-manager
@ -103,6 +107,12 @@ blazar_services:
init_config_overrides: "{{ blazar_manager_init_config_overrides }}"
start_order: 2
# Blazar uWSGI settings
blazar_wsgi_processes_max: 16
blazar_wsgi_processes: "{{ [[(ansible_facts['processor_vcpus']//ansible_facts['processor_threads_per_core'])|default(1), 1] | max * 2, blazar_wsgi_processes_max] | min }}"
blazar_wsgi_threads: 1
blazar_wsgi_buffer_size: 65535
## Keystone
blazar_service_project_domain_id: default
blazar_service_project_name: service
@ -156,3 +166,4 @@ blazar_policy_overrides: {}
blazar_blazar_conf_overrides: {}
blazar_api_init_config_overrides: {}
blazar_manager_init_config_overrides: {}
blazar_api_uwsgi_ini_overrides: {}

View File

@ -0,0 +1,4 @@
---
other:
- |
uWSGI support was implemented to os_blazar role.

View File

@ -36,3 +36,4 @@
condition: "{{ (blazar_policy_overrides) }}"
notify:
- Restart blazar services
- Restart uwsgi services

View File

@ -103,6 +103,16 @@
tags:
- blazar-config
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_blazar_services }}"
uwsgi_install_method: "source"
tags:
- blazar-config
- uwsgi
- name: Run the systemd service role
import_role:
name: systemd_service

View File

@ -25,7 +25,8 @@ filtered_blazar_services: |-
{% for key, value in blazar_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,
@ -40,3 +41,24 @@ filtered_blazar_services: |-
{% endif %}
{% endfor %}
{{ services | sort(attribute='start_order') }}
uwsgi_blazar_services: |-
{% set services = {} %}
{% for key, value in blazar_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': blazar_bin ~ '/' ~ value.wsgi_name,
'wsgi_venv': "{{ blazar_bin | dirname }}",
'uwsgi_uid': blazar_system_user_name,
'uwsgi_guid': blazar_system_group_name,
'uwsgi_processes': blazar_wsgi_processes,
'uwsgi_threads': blazar_wsgi_threads
}
) %}
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}