Replace Slack reporting by Sentry reporting

parent ee395fe0
......@@ -78,7 +78,7 @@ build docker image:
- echo $GITLAB_REGISTRY_PASSWORD | docker login --username thaliawww --password-stdin registry.gitlab.com
script:
- docker-compose config -q
- docker-compose build --build-arg install_dev_requirements=0 web
- docker-compose build --build-arg install_dev_requirements=0 --build-arg source_commit=$(git rev-parse HEAD) web
- docker-compose run --rm web test
- docker tag $DOCKER_LATEST $DOCKER_TAG
- docker push $DOCKER_TAG
......
......@@ -4,6 +4,7 @@ LABEL description="Contains the Thaliawebsite Django application"
# Arguments
ARG install_dev_requirements=1
ARG source_commit="unknown"
# Try to keep static operation on top to maximise Docker cache utilisation
......@@ -11,6 +12,7 @@ ARG install_dev_requirements=1
ENV DJANGO_PRODUCTION 1
ENV PYTHONUNBUFFERED 1
ENV DEBIAN_FRONTEND=noninteractive
ENV SOURCE_COMMIT=${source_commit}
# Set up entrypoint and command
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
......
......@@ -16,3 +16,4 @@ pyfcm>=1.4.2,<1.5
celery>=4.0<4.2
redis>=2.10<2.11
django-celery-results>=1.0.1<1.1
raven>=6.4.0,<6.5.0
......@@ -10,14 +10,11 @@ See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/
"""
import os
from copy import deepcopy
from django.utils.log import DEFAULT_LOGGING
from . import settings
INSTALLED_APPS = settings.INSTALLED_APPS
INSTALLED_APPS.append('django_slack')
INSTALLED_APPS.append('raven.contrib.django.raven_compat')
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.abspath(os.path.join(
......@@ -135,17 +132,57 @@ X_FRAME_OPTIONS = 'DENY'
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
# Slack configuration
SLACK_TOKEN = os.environ.get('DJANGO_SLACK_TOKEN')
SLACK_CHANNEL = '#django-errors'
SLACK_USERNAME = 'Concrexit'
SLACK_ICON_EMOJI = ':pingu:'
SLACK_FAIL_SILENTLY = True
LOGGING = deepcopy(DEFAULT_LOGGING)
LOGGING['handlers']['slack-error'] = {
'level': 'ERROR',
'class': 'django_slack.log.SlackExceptionHandler',
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
},
'root': {
'level': 'WARNING',
'handlers': ['sentry'],
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s '
'%(process)d %(thread)d %(message)s'
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
},
'sentry': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'raven.contrib.django.raven_compat.'
'handlers.SentryHandler',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': 'INFO',
},
'raven': {
'level': 'DEBUG',
'handlers': ['console'],
'propagate': False,
},
'sentry.errors': {
'level': 'DEBUG',
'handlers': ['console'],
'propagate': False,
},
},
}
RAVEN_CONFIG = {
'dsn': os.environ.get('SENTRY_DSN'),
'release': os.environ.get('SOURCE_COMMIT'),
}
LOGGING['loggers']['django']['handlers'].append('slack-error')
LOGGING['loggers']['django']['handlers'].remove('mail_admins')
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