Merge "Add sentry to horizon"

This commit is contained in:
Zuul 2020-08-08 14:51:35 +00:00 committed by Gerrit Code Review
commit ae58ef7084
4 changed files with 50 additions and 0 deletions

View File

@ -30,6 +30,7 @@ RUN python manage.py compilemessages && \
chown 1001 -R local/ ../static
COPY *.svg ../static/dashboard/img/
COPY *.ico ../static/dashboard/img/
COPY wsgi.py /usr/local/lib/python3.7/site-packages/openstack_dashboard/wsgi.py
EXPOSE 8000
ENV UWSGI_HTTP_SOCKET=:8000 \
UWSGI_WSGI_FILE=/usr/local/lib/python3.7/site-packages/openstack_dashboard/wsgi.py \

View File

@ -1,5 +1,6 @@
uWSGI
python-memcached
sentry-sdk
git+https://opendev.org/openstack/horizon@stable/ussuri
git+https://opendev.org/openstack/heat-dashboard@stable/ussuri
git+https://opendev.org/openstack/designate-dashboard@stable/ussuri

44
images/horizon/wsgi.py Normal file
View File

@ -0,0 +1,44 @@
#!/usr/local/bin/python
# Copyright (c) 2020 VEXXHOST, 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.
"""
WSGI config for openstack_dashboard project.
"""
import os
import sys
import pkg_resources
import sentry_sdk
from django.core.wsgi import get_wsgi_application
from sentry_sdk.integrations import wsgi
VERSION = pkg_resources.get_distribution("horizon").version
sentry_sdk.init(
release="horizon@%s" % VERSION,
traces_sample_rate=0.1
)
# Add this file path to sys.path in order to import settings
sys.path.insert(0, os.path.normpath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..')))
os.environ['DJANGO_SETTINGS_MODULE'] = 'openstack_dashboard.settings'
sys.stdout = sys.stderr
application = get_wsgi_application()
application = wsgi.SentryWsgiMiddleware(application)

View File

@ -41,6 +41,10 @@ spec:
image: vexxhost/horizon:latest
imagePullPolicy: Always
env:
{% if 'sentryDSN' in spec %}
- name: SENTRY_DSN
value: {{ spec.sentryDSN }}
{% endif %}
{% for v in env %}
- name: "{{ v.name }}"
value: "{{ v.value }}"