Commit ba317b8b authored by Rémi Duraffort's avatar Rémi Duraffort

Dockerfile: add the right hooks for using sentry

The sentry hook is installed when SENTRY_DSN is defined.
Signed-off-by: Rémi Duraffort's avatarRémi Duraffort <remi.duraffort@linaro.org>
parent 28fb448b
Pipeline #3625 failed with stages
in 2 minutes and 27 seconds
......@@ -24,6 +24,7 @@ else
docker container run --name "$LAVAFED_CONTAINER_NAME" -d \
--restart always \
-p 9001:80 \
-e SENTRY_DSN="$SENTRY_DSN" \
-v "/home/lavafed/federation/db.sqlite3:/app/db.sqlite3" \
-v "/home/lavafed/federation/etc/labs/:/app/etc/labs/" \
-v "/home/lavafed/federation/etc/master.yaml:/app/etc/master.yaml" \
......
......@@ -15,7 +15,8 @@ COPY share/urls.py /app/fedweb/urls.py.orig
# Install dependencies
RUN apt-get update -q ;\
apt-get install --no-install-recommends --yes gunicorn3 libjs-jquery python3 python3-django python3-jinja2 python3-requests python3-tz python3-voluptuous python3-yaml python3-whitenoise ;\
apt-get install --no-install-recommends --yes gunicorn3 libjs-jquery python3 python3-pip python3-django python3-jinja2 python3-requests python3-tz python3-voluptuous python3-yaml python3-whitenoise ;\
python3 -m pip install --upgrade 'sentry-sdk==0.7.11' ;\
# Create the django project
chmod 775 /app ;\
django-admin startproject fedweb /app ;\
......
......@@ -16,3 +16,13 @@ MIDDLEWARE = [
]
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
# Add sentry if SENTRY_DSN is defined
if "SENTRY_DSN" in os.environ:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
sentry_sdk.init(
dsn=os.environ["SENTRY_DSN"],
integrations=[DjangoIntegration()]
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment