Merge "Add WSGI support for cloudkitty-api"

This commit is contained in:
Jenkins 2017-09-01 09:47:37 +00:00 committed by Gerrit Code Review
commit e71f53d405
6 changed files with 49 additions and 2 deletions

View File

@ -19,6 +19,7 @@
- service.enabled | bool
- config_json.changed | bool
or cloudkitty_conf.changed | bool
or cloudkitty_conf_wsgi.changed | bool
or policy_json.changed | bool
or cloudkitty_api_container.changed | bool

View File

@ -44,6 +44,19 @@
- Restart cloudkitty-api container
- Restart cloudkitty-processor container
- name: Copying over wsgi-cloudkitty.conf
vars:
service: "{{ cloudkitty_services['cloudkitty-api'] }}"
template:
src: "wsgi-cloudkitty.conf.j2"
dest: "{{ node_config_directory }}/cloudkitty-api/wsgi-cloudkitty.conf"
register: cloudkitty_conf_wsgi
when:
- inventory_hostname in groups[service.group]
- service.enabled | bool
notify:
- Restart cloudkitty-api container
- name: Check if policies shall be overwritten
local_action: stat path="{{ node_custom_config }}/cloudkitty/policy.json"
run_once: True

View File

@ -1,5 +1,7 @@
{% set cloudkitty_cmd = 'apache2' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd' %}
{% set cloudkitty_dir = 'apache2/conf-enabled' if kolla_base_distro in ['ubuntu', 'debian'] else 'httpd/conf.d' %}
{
"command": "cloudkitty-api --config-file /etc/cloudkitty/cloudkitty.conf",
"command": "{{ cloudkitty_cmd }} -DFOREGROUND",
"config_files": [
{
"source": "{{ container_config_directory }}/cloudkitty.conf",
@ -7,6 +9,12 @@
"owner": "cloudkitty",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/wsgi-cloudkitty.conf",
"dest": "/etc/{{ cloudkitty_dir }}/wsgi-cloudkitty.conf",
"owner": "cloudkitty",
"perm": "0600"
},
{
"source": "{{ container_config_directory }}/policy.json",
"dest": "/etc/cloudkitty/policy.json",

View File

@ -3,6 +3,11 @@ debug = {{ cloudkitty_logging_debug }}
log_dir = /var/log/kolla/cloudkitty
{% if service_name == 'cloudkitty-api' %}
# Force cloudkitty-api.log or will use app.wsgi
log_file = /var/log/kolla/cloudkitty/cloudkitty-api.log
{% endif %}
transport_url = rabbit://{% for host in groups['rabbitmq'] %}{{ rabbitmq_user }}:{{ rabbitmq_password }}@{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ rabbitmq_port }}{% if not loop.last %},{% endif %}{% endfor %}
[database]

View File

@ -0,0 +1,20 @@
{% set python_path = '/usr/lib/python2.7/site-packages' if kolla_install_type == 'binary' else '/var/lib/kolla/venv/lib/python2.7/site-packages' %}
Listen {{ api_interface_address }}:{{ cloudkitty_api_port }}
TraceEnable off
<VirtualHost *:{{ cloudkitty_api_port }}>
ErrorLog "/var/log/kolla/cloudkitty/cloudkitty-api-error.log"
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\"" logformat
CustomLog "/var/log/kolla/cloudkitty/cloudkitty-api-access.log" logformat
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess cloudkitty group=cloudkitty processes={{ openstack_service_workers }} threads=1 user=cloudkitty python-path={{ python_path }}
WSGIProcessGroup cloudkitty
WSGIScriptAlias / "{{ python_path }}/cloudkitty/api/app.wsgi"
<Directory "{{ python_path }}/cloudkitty/api">
Require all granted
</Directory>
</VirtualHost>

View File

@ -1,7 +1,7 @@
<match kolla.var.log.kolla.*.*.log>
@type rewrite_tag_filter
capitalize_regex_backreference yes
rewriterule1 programname ^(cinder-api-access|gnocchi-api-access|horizon-access|keystone-apache-admin-access|keystone-apache-public-access|placement-api-access|panko-api-access)$ apache_access
rewriterule1 programname ^(cinder-api-access|cloudkitty-api-access|gnocchi-api-access|horizon-access|keystone-apache-admin-access|keystone-apache-public-access|placement-api-access|panko-api-access)$ apache_access
rewriterule2 programname ^(aodh_wsgi_access | zun_api_wsgi_access)$ wsgi_access
rewriterule3 programname ^(nova-api|nova-compute|nova-conductor|nova-consoleauth|nova-manage|nova-novncproxy|nova-scheduler|nova-placement-api|placement-api|privsep-helper)$ openstack_python
rewriterule4 programname ^(sahara-api|sahara-engine)$ openstack_python