Implement uWSGI for heat api services
As part of the Pike goals we are moving api services to run as WSGI apps. heat-api, heat-api-cfn, and heat-api-cloudwatch are now set up as WSGI apps. Since this is just a drop in replacement for existing eventlet services, operators and deployers should not notice a difference. Change-Id: I3dba17c33a7f1a1b9a03020a650e258099b4d20d Implements: blueprint goal-deploy-api-in-wsgi
This commit is contained in:
parent
dea0d5d496
commit
2b5fe2ef79
@ -206,6 +206,7 @@ heat_pip_packages:
|
||||
- python-openstackclient
|
||||
- python-swiftclient
|
||||
- python-troveclient
|
||||
- uwsgi
|
||||
|
||||
heat_api_init_overrides: {}
|
||||
heat_api_cfn_init_overrides: {}
|
||||
@ -219,16 +220,37 @@ heat_services:
|
||||
service_name: heat-api
|
||||
init_config_overrides: "{{ heat_api_init_overrides }}"
|
||||
start_order: 2
|
||||
wsgi_overrides: "{{ heat_api_uwsgi_ini_overrides }}"
|
||||
wsgi_app: True
|
||||
log_string: "--logto "
|
||||
wsgi_name: heat-wsgi-api
|
||||
uwsgi_port: "{{ heat_service_port }}"
|
||||
uwsgi_bind_address: "{{ heat_api_uwsgi_bind_address }}"
|
||||
program_override: "{{ heat_bin }}/uwsgi --ini /etc/uwsgi/heat-api.ini"
|
||||
heat-api-cfn:
|
||||
group: heat_api_cfn
|
||||
service_name: heat-api-cfn
|
||||
init_config_overrides: "{{ heat_api_cfn_init_overrides }}"
|
||||
start_order: 3
|
||||
wsgi_overrides: "{{ heat_api_cfn_uwsgi_ini_overrides }}"
|
||||
wsgi_app: True
|
||||
log_string: "--logto "
|
||||
wsgi_name: heat-wsgi-api-cfn
|
||||
uwsgi_port: "{{ heat_cfn_service_port }}"
|
||||
uwsgi_bind_address: "{{ heat_api_cfn_uwsgi_bind_address }}"
|
||||
program_override: "{{ heat_bin }}/uwsgi --ini /etc/uwsgi/heat-api-cfn.ini"
|
||||
heat-api-cloudwatch:
|
||||
group: heat_api_cloudwatch
|
||||
service_name: heat-api-cloudwatch
|
||||
init_config_overrides: "{{ heat_api_cloudwatch_init_overrides }}"
|
||||
start_order: 3
|
||||
wsgi_overrides: "{{ heat_api_cloudwatch_uwsgi_ini_overrides }}"
|
||||
wsgi_app: True
|
||||
log_string: "--logto "
|
||||
wsgi_name: heat-wsgi-api-cloudwatch
|
||||
uwsgi_port: "{{ heat_watch_port }}"
|
||||
uwsgi_bind_address: "{{ heat_api_cloudwatch_uwsgi_bind_address }}"
|
||||
program_override: "{{ heat_bin }}/uwsgi --ini /etc/uwsgi/heat-api-cloudwatch.ini"
|
||||
heat-engine:
|
||||
group: heat_engine
|
||||
service_name: heat-engine
|
||||
@ -245,6 +267,18 @@ heat_required_secrets:
|
||||
- heat_service_password
|
||||
- memcached_encryption_key
|
||||
|
||||
# uWSGI Settings
|
||||
heat_api_uwsgi_ini_overrides: {}
|
||||
heat_api_cfn_uwsgi_ini_overrides: {}
|
||||
heat_api_cloudwatch_uwsgi_ini_overrides: {}
|
||||
heat_wsgi_processes_max: 16
|
||||
heat_wsgi_processes: "{{ [[ansible_processor_vcpus|default(1), 1] | max * 2, heat_wsgi_processes_max] | min }}"
|
||||
heat_wsgi_threads: 1
|
||||
heat_wsgi_buffer_size: 65535
|
||||
heat_api_uwsgi_bind_address: 0.0.0.0
|
||||
heat_api_cfn_uwsgi_bind_address: 0.0.0.0
|
||||
heat_api_cloudwatch_uwsgi_bind_address: 0.0.0.0
|
||||
|
||||
# This variable is used by the repo_build process to determine
|
||||
# which host group to check for members of before building the
|
||||
# pip packages required by this role. The value is picked up
|
||||
|
20
releasenotes/notes/heat_uwsgi-11d691aa4d47c35d.yaml
Normal file
20
releasenotes/notes/heat_uwsgi-11d691aa4d47c35d.yaml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
features:
|
||||
- The ``heat-api``, ``heat-api-cfn``, and
|
||||
``heat-api-cloudwatch`` services have moved to run
|
||||
as a uWSGI applications. You can set the max number
|
||||
of WSGI processes, the number of processes, threads,
|
||||
and buffer size utilizing the
|
||||
``heat_wsgi_processes_max``,
|
||||
``heat_wsgi_processes``, ``heat_wsgi_threads``,
|
||||
and ``heat_wsgi_buffer_size``.
|
||||
Additionally, you can override any settings in the
|
||||
uWSGI ini configuration file using the
|
||||
``heat_api_uwsgi_ini_overrides``,
|
||||
``heat_api_cfn_uwsgi_ini_overrides``, and
|
||||
``heat_api_cloudwatch_uwsgi_ini_overrides`` settings.
|
||||
The uWSGI applications will listen on the addresses
|
||||
specified by ``heat_api_uwsgi_bind_address``,
|
||||
``heat_api_cfn_uwsgi_bind_address``, and
|
||||
``heat_api_cloudwatch_uwsgi_bind_address``
|
||||
respectively. Which all default to ``0.0.0.0``.
|
32
tasks/heat_uwsgi.yml
Normal file
32
tasks/heat_uwsgi.yml
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
# 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: "heat-uwsgi.ini.j2"
|
||||
dest: "/etc/uwsgi/{{ item.service_name }}.ini"
|
||||
mode: "0744"
|
||||
config_overrides: "{{ item.wsgi_overrides }}"
|
||||
config_type: ini
|
||||
with_items: "{{ filtered_heat_services }}"
|
||||
when: item.wsgi_app | default(False)
|
||||
notify:
|
||||
- Restart heat services
|
@ -62,6 +62,10 @@
|
||||
tags:
|
||||
- heat-config
|
||||
|
||||
- include: heat_uwsgi.yml
|
||||
tags:
|
||||
- heat-config
|
||||
|
||||
- include: heat_service_setup.yml
|
||||
static: no
|
||||
when:
|
||||
|
@ -10,10 +10,10 @@ Type=simple
|
||||
User={{ heat_system_user_name }}
|
||||
Group={{ heat_system_group_name }}
|
||||
|
||||
{% if program_override is defined %}
|
||||
ExecStart={{ program_override }} {{ program_config_options|default('') }} --log-file=/var/log/heat/{{ item.service_name }}.log
|
||||
{% if item.program_override is defined %}
|
||||
ExecStart={{ item.program_override }} {{ program_config_options|default('') }} {{ item.log_string | default('--log-file=') }}/var/log/heat/{{ item.service_name }}.log
|
||||
{% else %}
|
||||
ExecStart={{ heat_bin }}/{{ item.service_name }} {{ program_config_options|default('') }} --log-file=/var/log/heat/{{ item.service_name }}.log
|
||||
ExecStart={{ heat_bin }}/{{ item.service_name }} {{ item.program_config_options|default('') }} --log-file=/var/log/heat/{{ item.service_name }}.log
|
||||
{% endif %}
|
||||
|
||||
# Give a reasonable amount of time for the server to start up/shut down
|
||||
|
19
templates/heat-uwsgi.ini.j2
Normal file
19
templates/heat-uwsgi.ini.j2
Normal file
@ -0,0 +1,19 @@
|
||||
[uwsgi]
|
||||
uid = {{ heat_system_user_name }}
|
||||
gid = {{ heat_system_group_name }}
|
||||
|
||||
virtualenv = /openstack/venvs/heat-{{ heat_venv_tag }}
|
||||
wsgi-file = {{ heat_bin }}/{{ item.wsgi_name }}
|
||||
http-socket = {{ item.uwsgi_bind_address }}:{{ item.uwsgi_port }}
|
||||
|
||||
master = true
|
||||
enable-threads = true
|
||||
processes = {{ heat_wsgi_processes }}
|
||||
threads = {{ heat_wsgi_threads }}
|
||||
exit-on-reload = true
|
||||
die-on-term = true
|
||||
lazy-apps = true
|
||||
add-header = Connection: close
|
||||
buffer-size = {{ heat_wsgi_buffer_size }}
|
||||
thunder-lock = true
|
||||
logfile-chmod = 644
|
Loading…
Reference in New Issue
Block a user