Merge "Start using uWSGI role"

This commit is contained in:
Zuul 2019-09-06 15:54:29 +00:00 committed by Gerrit Code Review
commit 4a596c6850
8 changed files with 35 additions and 120 deletions

View File

@ -60,13 +60,11 @@ ironic_services:
group: ironic_api
service_name: ironic-api
init_config_overrides: "{{ ironic_api_init_config_overrides }}"
wsgi_overrides: "{{ ironic_api_uwsgi_ini_overrides }}"
wsgi_app: True
log_string: "--logto "
wsgi_name: ironic-api-wsgi
uwsgi_overrides: "{{ ironic_api_uwsgi_ini_overrides }}"
uwsgi_port: "{{ ironic_service_port }}"
uwsgi_bind_address: "{{ ironic_uwsgi_bind_address }}"
execstarts: "{{ ironic_bin }}/uwsgi --ini /etc/uwsgi/ironic-api.ini"
ironic-conductor:
group: ironic_conductor
service_name: ironic-conductor
@ -195,7 +193,6 @@ ironic_pip_packages:
- sushy
- systemd-python
- UcsSdk
- uwsgi
## Oslo Messaging Info
# RPC
@ -233,7 +230,6 @@ ironic_service_user_name: "ironic"
ironic_wsgi_threads: 1
ironic_wsgi_processes_max: 16
ironic_wsgi_processes: "{{ [[ansible_processor_vcpus|default(4) // 4, 1] | max, ironic_wsgi_processes_max] | min }}"
ironic_wsgi_buffer_size: 65535
ironic_uwsgi_bind_address: 0.0.0.0
### OpenStack Services to integrate with

View File

@ -60,5 +60,3 @@
- { path: "{{ ironic_system_home_folder }}/cache/api", mode: "0700" }
- { path: "{{ ironic_lock_path }}" }
- { path: "/var/run/ironic" }
- { path: "/var/www/cgi-bin", owner: root, group: root }
- { path: "/var/www/cgi-bin/ironic" }

View File

@ -1,44 +0,0 @@
---
# Copyright 2014, 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: Setup Ironic WSGI Configs
template:
src: "ironic-wsgi.py.j2"
dest: "{{ ironic_bin }}/{{ item.wsgi_name }}.wsgi"
owner: "{{ ironic_system_user_name }}"
group: "{{ ironic_system_group_name }}"
mode: "0755"
with_list: "{{ filtered_ironic_services }}"
when: item.wsgi_app | default(False)
notify:
- Restart ironic services
- name: Ensure uWSGI directory exists
file:
path: "/etc/uwsgi/"
state: directory
mode: "0711"
- name: Apply uWSGI configuration
config_template:
src: "ironic-uwsgi.ini.j2"
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
mode: "0744"
config_overrides: "{{ item.wsgi_overrides }}"
config_type: ini
with_list: "{{ filtered_ironic_services }}"
when: item.wsgi_app | default(False)
notify:
- Restart ironic services

View File

@ -83,9 +83,15 @@
tags:
- ironic-config
- import_tasks: ironic_uwsgi.yml
- name: Import uwsgi role
import_role:
name: uwsgi
vars:
uwsgi_services: "{{ uwsgi_ironic_services }}"
uwsgi_install_method: "source"
tags:
- ironic-config
- uwsgi
- import_tasks: ironic_conductor_post_install.yml
when: "ironic_services['ironic-conductor']['group'] in group_names"

View File

@ -1,22 +0,0 @@
[uwsgi]
uid = {{ ironic_system_user_name }}
gid = {{ ironic_system_group_name }}
virtualenv = /openstack/venvs/ironic-{{ ironic_venv_tag }}
wsgi-file = {{ ironic_bin }}/{{ item.wsgi_name }}.wsgi
http-socket = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }}
master = true
enable-threads = true
processes = {{ ironic_wsgi_processes }}
threads = {{ ironic_wsgi_threads }}
exit-on-reload = true
die-on-term = true
lazy-apps = true
add-header = Connection: close
buffer-size = {{ ironic_wsgi_buffer_size }}
thunder-lock = true
disable-logging = true
# Avoid filling up the logs with health check requests from haproxy.
route-user-agent = ^osa-haproxy-healthcheck$ donotlog:

View File

@ -1,45 +0,0 @@
# -*- mode: python -*-
# -*- encoding: utf-8 -*-
#
# 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.
#"""
#Use this file for deploying the API service under Apache2 mod_wsgi.
#"""
import os
activate_this = os.path.expanduser("{{ ironic_bin }}/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))
import logging
import sys
from oslo_config import cfg
import oslo_i18n as i18n
from oslo_log import log
from ironic.api import app
from ironic.common import service
CONF = cfg.CONF
i18n.install('ironic')
service.prepare_service(sys.argv)
LOG = log.getLogger(__name__)
LOG.debug("Configuration:")
CONF.log_opt_values(LOG, logging.DEBUG)
application = app.VersionSelectorApplication()

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

@ -155,7 +155,8 @@ filtered_ironic_services: |-
{% for key, value in ironic_services.items() %}
{% if (value['group'] in group_names) and
(('service_en' not in value) or
('service_en' in value and value['service_en'])) %}
('service_en' in value and value['service_en'])) and
not ('wsgi_app' in value and value['wsgi_app']) %}
{% set _ = value.update(
{
'service_key': key,
@ -176,6 +177,27 @@ filtered_ironic_services: |-
{% endfor %}
{{ services }}
uwsgi_ironic_services: |-
{% set services = {} %}
{% for key, value in ironic_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': ironic_bin ~ '/' ~ value.wsgi_name,
'wsgi_venv': ironic_bin | dirname,
'uwsgi_uid': ironic_system_user_name,
'uwsgi_guid': ironic_system_group_name,
'uwsgi_processes': ironic_wsgi_processes,
'uwsgi_threads': ironic_wsgi_threads
}
) %}
{% set _ = services.update({key: value}) %}
{% endif %}
{% endfor %}
{{ services }}
filtered_ironic_drivers: |-
{% set concat_drivers = [] %}
{% for driver in ironic_drivers_enabled %}