Merge "Start using uWSGI role"

This commit is contained in:
Zuul 2019-09-13 11:15:10 +00:00 committed by Gerrit Code Review
commit 7a8e052276
11 changed files with 39 additions and 74 deletions

View File

@ -161,7 +161,6 @@ octavia_pip_packages:
- octavia
- shade
- systemd-python
- uwsgi
# Specific pip packages provided by the user
octavia_user_pip_packages: []
@ -181,14 +180,11 @@ octavia_services:
service_name: octavia-api
start_order: 4
init_config_overrides: "{{ octavia_api_init_overrides }}"
execstarts: "{{ octavia_uwsgi_bin }}/uwsgi --ini /etc/uwsgi/octavia-api.ini"
execreloads: "{{ octavia_uwsgi_bin }}/uwsgi --reload /var/run/octavia-api/octavia-api.pid"
wsgi_overrides: "{{ octavia_api_uwsgi_ini_overrides }}"
wsgi_app: True
wsgi_name: octavia-wsgi
uwsgi_overrides: "{{ octavia_api_uwsgi_ini_overrides }}"
uwsgi_port: "{{ octavia_service_port }}"
uwsgi_bind_address: "{{ octavia_uwsgi_bind_address }}"
program_override: "{{ octavia_uwsgi_bin }}/uwsgi --ini /etc/uwsgi/octavia-api.ini"
octavia-worker:
group: octavia-worker
service_name: octavia-worker
@ -417,7 +413,6 @@ octavia_iptables_rules:
octavia_wsgi_processes_max: 16
octavia_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, octavia_wsgi_processes_max] | min }}"
octavia_wsgi_threads: 1
octavia_wsgi_buffer_size: 65535
octavia_uwsgi_bind_address: "0.0.0.0"
octavia_api_uwsgi_ini_overrides: {}

View File

@ -93,9 +93,15 @@
tags:
- octavia-install
- import_tasks: octavia_uwsgi.yml
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_octavia_services }}"
uwsgi_install_method: "{{ octavia_install_method }}"
tags:
- octavia-config
- uwsgi
- name: Run the systemd service role
import_role:

View File

@ -24,4 +24,5 @@
config_type: "json"
notify:
- Restart octavia services
- Restart uwsgi services
when: octavia_legacy_policy

View File

@ -136,3 +136,4 @@
config_type: "ini"
notify:
- Restart octavia services
- Restart uwsgi services

View File

@ -1,32 +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: "octavia-uwsgi.ini.j2"
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
mode: "0744"
config_overrides: "{{ item.wsgi_overrides }}"
config_type: ini
with_items: "{{ filtered_octavia_services }}"
when: item.wsgi_app | default(False)
notify:
- Restart octavia services

View File

@ -1,25 +0,0 @@
[uwsgi]
uid = {{ octavia_system_user_name }}
gid = {{ octavia_system_group_name }}
{% if octavia_install_method == 'source' %}
virtualenv = /openstack/venvs/octavia-{{ octavia_venv_tag }}
{% endif %}
wsgi-file = {{ octavia_bin }}/{{ item.wsgi_name }}
http-socket = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }}
master = true
enable-threads = true
processes = {{ octavia_wsgi_processes }}
threads = {{ octavia_wsgi_threads }}
exit-on-reload = true
die-on-term = true
lazy-apps = true
add-header = Connection: close
buffer-size = {{ octavia_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

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

@ -33,7 +33,3 @@ octavia_service_distro_packages:
- octavia-worker
- python-pymysql
- python-systemd
- uwsgi
- uwsgi-plugin-python
octavia_uwsgi_bin: '/usr/bin'

View File

@ -22,7 +22,8 @@ filtered_octavia_services: |-
{% for key, value in octavia_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,
@ -36,3 +37,26 @@ filtered_octavia_services: |-
{% endif %}
{% endfor %}
{{ services | sort(attribute='start_order') }}
uwsgi_octavia_services: |-
{% set services = {} %}
{% for key, value in octavia_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': octavia_bin ~ '/' ~ value.wsgi_name,
'wsgi_venv': ((octavia_install_method == 'source') | ternary(octavia_bin | dirname, None)),
'uwsgi_uid': octavia_system_user_name,
'uwsgi_guid': octavia_system_group_name,
'uwsgi_processes': octavia_wsgi_processes,
'uwsgi_threads': octavia_wsgi_threads
}
)
%}
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}

View File

@ -29,8 +29,6 @@ octavia_service_distro_packages:
- openstack-octavia-housekeeping
- openstack-octavia-worker
- systemd-python
- uwsgi
- uwsgi-plugin-python
octavia_distro_openstack_clients_packages:
- python-shade
@ -40,5 +38,3 @@ octavia_distro_openstack_clients_packages:
- python-cinderclient
- python-octaviaclient
- python-openstackclient
octavia_uwsgi_bin: '/usr/sbin'

View File

@ -2,4 +2,3 @@
octavia_package_list: "{{ octavia_distro_packages }}"
_octavia_bin: "/openstack/venvs/octavia-{{ octavia_venv_tag }}/bin"
octavia_uwsgi_bin: "{{ _octavia_bin }}"