Skip to content

Commit

Permalink
Added sentry for error monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Mar 11, 2020
1 parent 4e5392f commit d307aea
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ services:
- DJANGO_SETTINGS_MODULE=puzzlehunt_server.settings.env_settings
- DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@db/${DB_NAME}
- ENABLE_DEBUG_TOOLBAR
- SENTRY_DSN
depends_on:
- db
- redis
Expand All @@ -58,6 +59,7 @@ services:
- DJANGO_SECRET_KEY
- DJANGO_SETTINGS_MODULE=puzzlehunt_server.settings.env_settings
- DATABASE_URL=postgres://${DB_USER}:${DB_PASSWORD}@db/${DB_NAME}
- SENTRY_DSN
depends_on:
- app

Expand Down
12 changes: 12 additions & 0 deletions puzzlehunt_server/settings/base_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,15 @@
if os.environ.get("ENABLE_DEBUG_TOOLBAR"):
INSTALLED_APPS = INSTALLED_APPS + ('debug_toolbar',)
MIDDLEWARE = ('debug_toolbar.middleware.DebugToolbarMiddleware',) + MIDDLEWARE

if os.environ.get("SENTRY_DSN"):
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

sentry_sdk.init(
dsn=os.environ.get("SENTRY_DSN"),
integrations=[DjangoIntegration()],

# Sends which user caused the error
send_default_pii=True
)
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ dj-database-url
django-redis
redis
huey
sentry-sdk==0.14.2
7 changes: 5 additions & 2 deletions sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DB_USER=user
DJANGO_SECRET_KEY=mysecretkey
DJANGO_EMAIL_USER=email_user
DJANGO_EMAIL_PASSWORD=email_password
DJANGO_ENABLE_DEBUG=False

# DJANGO_ENABLE_DEBUG True
# DJANGO_USE_SHIBBOLETH True
Expand All @@ -13,5 +14,7 @@ DOMAIN=your.domain-here.com
CONTACT_EMAIL=sample_email@example.com
PROJECT_NAME=puzzlehunt_site

#COMPOSE_FILE=docker-compose.yml:docker/local_override.yml
#COMPOSE_FILE=docker-compose.yml:docker/shib_override.yml:docker/proxy_override.yml
# SENTRY_DSN=https://some_long_hex_string@sentry.io/some_number

# COMPOSE_FILE=docker-compose.yml:docker/local_override.yml
# COMPOSE_FILE=docker-compose.yml:docker/shib_override.yml:docker/proxy_override.yml

0 comments on commit d307aea

Please sign in to comment.