Fix error in Gnocchi service

* mount gnocchi volume for gnocchi-api and gnocchi-statsd
* fix the failed of gnocchi-api
* use gnocchi user when running gnocchi-upgrade
* use the app.wsgi file in python path directly, rather than copy it to
  /var/www/cgi-bin/gnocchi/app file

TrivialFix

Change-Id: Ie026b8f44cd8e9703bf115cebb4e2d50b114a3a2
This commit is contained in:
Jeffrey Zhang 2016-09-29 01:14:19 +08:00 committed by Jeffrey Zhang
parent 1432046728
commit 89d38770ce
4 changed files with 18 additions and 28 deletions

View File

@ -19,6 +19,7 @@
name: "gnocchi_metricd"
volumes:
- "{{ node_config_directory }}/gnocchi-metricd/:{{ container_config_directory }}/:ro"
- "gnocchi:/var/lib/gnocchi/"
- "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['gnocchi-metricd']
@ -30,5 +31,6 @@
name: "gnocchi_statsd"
volumes:
- "{{ node_config_directory }}/gnocchi-statsd/:{{ container_config_directory }}/:ro"
- "gnocchi:/var/lib/gnocchi/"
- "kolla_logs:/var/log/kolla/"
when: inventory_hostname in groups['gnocchi-statsd']

View File

@ -3,23 +3,15 @@ Listen {{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['addr
<VirtualHost *:{{ gnocchi_api_port }}>
## Vhost docroot
DocumentRoot "/var/www/cgi-bin/gnocchi"
ErrorLog "/var/log/kolla/gnocchi/gnocchi-api-error.log"
CustomLog "/var/log/kolla/gnocchi/gnocchi-api-access.log" combined
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess gnocchi group=gnocchi processes=5 threads=1 user=gnocchi python-path={{ python_path }}
WSGIProcessGroup gnocchi
WSGIScriptAlias / "{{ python_path }}/gnocchi/rest/app.wsgi"
## Directories, there should at least be a declaration for /var/www/cgi-bin/gnocchi
<Directory "/var/www/cgi-bin/gnocchi">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
<Directory "{{ python_path }}/gnocchi/rest">
Require all granted
</Directory>
## Logging
ErrorLog "/var/log/kolla/gnocchi/gnocchi_wsgi_error.log"
ServerSignature Off
CustomLog "/var/log/kolla/gnocchi/gnocchi_wsgi_access.log" combined
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess gnocchi group=gnocchi processes=2 threads=2 user=gnocchi
WSGIProcessGroup gnocchi
WSGIScriptAlias / "/var/www/cgi-bin/gnocchi/app"
</VirtualHost>

View File

@ -13,6 +13,6 @@ fi
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
gnocchi-upgrade --logfile /var/log/kolla/gnocchi/gnocchi-upgrade.log
sudo -H -i -u gnocchi gnocchi-upgrade --create-legacy-resource-types --logfile /var/log/kolla/gnocchi/gnocchi-upgrade.log
exit 0
fi

View File

@ -17,9 +17,7 @@ MAINTAINER {{ maintainer }}
] %}
{{ macros.install_packages(gnocchi_base_packages | customizable("packages")) }}
RUN mkdir -p /var/www/cgi-bin/gnocchi \
&& cp -a /usr/lib/python2.7/site-packages/gnocchi/rest/app.wsgi /var/www/cgi-bin/gnocchi/app \
&& sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf
RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf
{% elif base_distro in ['ubuntu'] %}
{% set gnocchi_base_packages = [
@ -30,9 +28,7 @@ RUN mkdir -p /var/www/cgi-bin/gnocchi \
] %}
{{ macros.install_packages(gnocchi_base_packages | customizable("packages")) }}
RUN mkdir -p /var/www/cgi-bin/gnocchi \
&& cp -a /usr/share/gnocchi-common/app.wsgi /var/www/cgi-bin/gnocchi/app \
&& echo > /etc/apache2/ports.conf
RUN truncate -s 0 /etc/apache2/ports.conf
{% endif %}
{% elif install_type == 'source' %}
@ -55,7 +51,7 @@ RUN mkdir -p /var/www/cgi-bin/gnocchi \
] %}
{{ macros.install_packages(gnocchi_base_packages | customizable("packages")) }}
RUN echo > /etc/apache2/ports.conf
RUN truncate -s 0 /etc/apache2/ports.conf
{% endif %}
ADD gnocchi-base-archive /gnocchi-base-source
@ -63,10 +59,9 @@ ADD gnocchi-base-archive /gnocchi-base-source
RUN ln -s gnocchi-base-source/* gnocchi \
&& useradd --user-group gnocchi \
&& /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt gnocchiclient /gnocchi[keystone,mysql,file] \
&& mkdir -p /etc/gnocchi /var/log/kolla/gnocchi /home/gnocchi /var/www/cgi-bin/gnocchi \
&& mkdir -p /etc/gnocchi /var/log/kolla/gnocchi /home/gnocchi \
&& cp -r /gnocchi/etc/gnocchi/* /etc/gnocchi/ \
&& cp /gnocchi/gnocchi/rest/app.wsgi /var/www/cgi-bin/gnocchi/ \
&& chown -R gnocchi: /etc/gnocchi /var/log/kolla/gnocchi /var/www/cgi-bin/gnocchi
&& chown -R gnocchi: /etc/gnocchi /var/log/kolla/gnocchi
{% endif %}
@ -74,9 +69,10 @@ COPY extend_start.sh /usr/local/bin/kolla_extend_start
COPY gnocchi_sudoers /etc/sudoers.d/kolla_gnocchi_sudoers
RUN usermod -a -G kolla gnocchi \
&& mkdir -p /var/lib/gnocchi \
&& chown -R gnocchi: /var/lib/gnocchi \
&& chmod 750 /etc/sudoers.d \
&& chmod 640 /etc/sudoers.d/kolla_gnocchi_sudoers \
&& chmod 755 /var/www/cgi-bin/gnocchi \
&& touch /usr/local/bin/kolla_gnocchi_extend_start \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_gnocchi_extend_start