From 25ff5d69f6b38411bc57779a1a22b9e8923edd1b Mon Sep 17 00:00:00 2001 From: Hugo Chinchilla Carbonell Date: Tue, 16 May 2017 08:44:48 +0200 Subject: [PATCH 1/7] upgrade to Sentry 8.15.0 --- Dockerfile | 2 +- requirements.txt | 2 +- sentry_docker_conf.py | 71 +++++++++++++++++++------------------------ sentry_run | 2 +- 4 files changed, 35 insertions(+), 42 deletions(-) diff --git a/Dockerfile b/Dockerfile index eb9f305..f3797ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ ADD sentry_run /usr/local/bin/ ENTRYPOINT ["/usr/local/bin/sentry_run"] -CMD ["start"] +CMD ["run", "web"] ADD scripts/create_team_or_project.py /conf/ ADD scripts/check_db_isalive.py /conf/ diff --git a/requirements.txt b/requirements.txt index 5552a8a..12473fc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ django-redis==4.3.0 hiredis==0.2.0 # sentry -sentry[postgres]==8.0.6 +sentry[postgres]==8.15.0 # ldap user store django-auth-ldap==1.2.7 diff --git a/sentry_docker_conf.py b/sentry_docker_conf.py index 82af71b..34fd503 100644 --- a/sentry_docker_conf.py +++ b/sentry_docker_conf.py @@ -33,22 +33,6 @@ SENTRY_PUBLIC = config('SENTRY_PUBLIC', default=False, cast=bool) -def nydus_config(from_env_var): - """ - Generate a Nydus Redis configuration from an ENV variable of the form "server:port,server:port..." - Default to REDIS_HOST:REDIS_PORT if the ENV variable is not provided. - """ - redis_servers_cast = lambda x: list(r.split(':') for r in x.split(',')) - servers = config(from_env_var, default='{0}:{1}'.format(REDIS_HOST, REDIS_PORT), cast=redis_servers_cast) - _redis_hosts = {} - - for r_index, r_host_pair in enumerate(servers): - _redis_hosts[r_index] = {'host': r_host_pair[0], 'port': int(r_host_pair[1])} - - return { - 'hosts': _redis_hosts - } - ############################ # General Sentry options ## @@ -57,6 +41,27 @@ def nydus_config(from_env_var): # You MUST configure the absolute URI root for Sentry: 'system.url-prefix': config('SENTRY_URL_PREFIX'), 'system.admin-email': config('SENTRY_ADMIN_EMAIL', default='root@localhost'), + # If this file ever becomes compromised, it's important to regenerate your SECRET_KEY + # Changing this value will result in all current sessions being invalidated + 'system.secret-key': config('SECRET_KEY'), + # Mail Settings + # For more information check Django's documentation: + # https://docs.djangoproject.com/en/1.3/topics/email/?from=olddocs#e-mail-backends + 'mail.backend': config('SENTRY_EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend'), + 'mail.host': config('SENTRY_EMAIL_HOST', default='localhost'), + 'mail.port': config('SENTRY_EMAIL_PORT', default=25, cast=int), + 'mail.password': config('SENTRY_EMAIL_HOST_PASSWORD', default=''), + 'mail.username': config('SENTRY_EMAIL_HOST_USER', default=''), + 'mail.use-tls': config('SENTRY_EMAIL_USE_TLS', default=False, cast=bool), + # The email address to send on behalf of + 'mail.from': config('SENTRY_SERVER_EMAIL', default='root@localhost'), + 'redis.clusters': { + 'default': { + 'hosts': { + 0: {'host': REDIS_HOST, 'port': REDIS_PORT}, + } + } + } } ########### @@ -94,7 +99,6 @@ def nydus_config(from_env_var): if SENTRY_USE_REDIS_BUFFERS: SENTRY_BUFFER = 'sentry.buffer.redis.RedisBuffer' - SENTRY_REDIS_OPTIONS = nydus_config('SENTRY_REDIS_BUFFERS') SENTRY_CACHE = 'sentry.cache.redis.RedisCache' ####################### @@ -108,7 +112,17 @@ def nydus_config(from_env_var): if SENTRY_USE_REDIS_TSDB: SENTRY_TSDB = 'sentry.tsdb.redis.RedisTSDB' - SENTRY_TSDB_OPTIONS = nydus_config('SENTRY_REDIS_TSDBS') + SENTRY_TSDB_OPTIONS = {'cluster': 'default'} + + +############ +# Digests ## +############ + +SENTRY_USE_REDIS_DIGESTS = config('SENTRY_USE_REDIS_DIGESTS', default=False, cast=bool) +if SENTRY_USE_REDIS_DIGESTS: + SENTRY_DIGESTS = 'sentry.digests.backends.redis.RedisBackend' + SENTRY_DIGESTS_OPTIONS = {'cluster': 'default'} ################ # Web Server ## @@ -132,23 +146,6 @@ def nydus_config(from_env_var): # allows JavaScript clients to submit cross-domain error reports. Useful for local development SENTRY_ALLOW_ORIGIN = config('SENTRY_ALLOW_ORIGIN', default=None) -################# -# Mail Server ## -################# - -# For more information check Django's documentation: -# https://docs.djangoproject.com/en/1.3/topics/email/?from=olddocs#e-mail-backends - -EMAIL_BACKEND = config('SENTRY_EMAIL_BACKEND', default='django.core.mail.backends.console.EmailBackend') - -EMAIL_HOST = config('SENTRY_EMAIL_HOST', default='localhost') -EMAIL_HOST_PASSWORD = config('SENTRY_EMAIL_HOST_PASSWORD', default='') -EMAIL_HOST_USER = config('SENTRY_EMAIL_HOST_USER', default='') -EMAIL_PORT = config('SENTRY_EMAIL_PORT', default=25, cast=int) -EMAIL_USE_TLS = config('SENTRY_EMAIL_USE_TLS', default=False, cast=bool) - -# The email address to send on behalf of -SERVER_EMAIL = config('SENTRY_SERVER_EMAIL', default='root@localhost') ########### # etc. ## @@ -156,10 +153,6 @@ def nydus_config(from_env_var): SENTRY_FEATURES['auth:register'] = config('SENTRY_ALLOW_REGISTRATION', default=False, cast=bool) -# If this file ever becomes compromised, it's important to regenerate your SECRET_KEY -# Changing this value will result in all current sessions being invalidated -SECRET_KEY = config('SECRET_KEY') - # http://twitter.com/apps/new # It's important that input a callback URL, even if its useless. We have no idea why, consult Twitter. TWITTER_CONSUMER_KEY = config('TWITTER_CONSUMER_KEY', default='') diff --git a/sentry_run b/sentry_run index e688324..fecc834 100755 --- a/sentry_run +++ b/sentry_run @@ -7,7 +7,7 @@ export SENTRY_CONF=$SENTRY_CONF_FILE SCRIPTS_DIR=${SENTRY_SCRIPTS_DIR:-/conf} # if starting the web worker then try to initialize DB and superuser -if [ "$1" == "start" ] || [ "$1" == "prepare" ]; then +if [ "$1" == "run" -a "$2" == "web" ] || [ "$1" == "prepare" ]; then # check DB health if "SENTRY_DOCKER_DO_DB_CHECK" is set if [ -n "$SENTRY_DOCKER_DO_DB_CHECK" ]; then From 257705799736405d48895f2454d6bd8b543938b2 Mon Sep 17 00:00:00 2001 From: Hugo Chinchilla Carbonell Date: Tue, 16 May 2017 09:04:30 +0200 Subject: [PATCH 2/7] update REDME --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 78ed926..3bd4d89 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ Sentry in Docker Latest changes introduced some new build tags: -* **8.0** - current stable version (8.0.X) +* **8.15.0** - current stable version (8.15.0) +* **8.0** - old stable version (8.0.X) - no longer updated * **7.7** - old stable version (7.7.4) - no longer updated * **7.6** - old stable version (7.6.2) - no longer updated * **7.5** - old stable version (7.5.6) - no longer updated @@ -16,7 +17,7 @@ Latest changes introduced some new build tags: * **7.0** - older stable version (7.0.2) - no longer updated * **6.4** - even older stable version (6.4.4) - no longer updated * **dev** - current master on github (infrequent builds) -* **latest** (the default one used earlier) - is now the same as **8.0** +* **latest** (the default one used earlier) - is now the same as **8.15.0** if you want to keep your builds same as before update your Dockerfiles and change ```FROM slafs/sentry``` to ```FROM slafs/sentry:6.4```. From 64ea5bc4dc84a68a82a530a3b894a7b710e75d84 Mon Sep 17 00:00:00 2001 From: Hugo Chinchilla Carbonell Date: Tue, 16 May 2017 10:19:52 +0200 Subject: [PATCH 3/7] create project with scrub_data option set to false --- scripts/create_team_or_project.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/create_team_or_project.py b/scripts/create_team_or_project.py index 1297dee..c891955 100644 --- a/scripts/create_team_or_project.py +++ b/scripts/create_team_or_project.py @@ -50,6 +50,7 @@ def create_project(team_name, project_name): defaults = {'organization': team.organization} project, new = Project.objects.get_or_create(name=project_name, team=team, defaults=defaults) + project.update_option('sentry:scrub_data', False) return project, new From c8ad930c758b55559f5e86988c5f7cb0da17d8c2 Mon Sep 17 00:00:00 2001 From: Hugo Chinchilla Carbonell Date: Tue, 16 May 2017 10:22:12 +0200 Subject: [PATCH 4/7] create project with scrub_defaults option set to false --- scripts/create_team_or_project.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/create_team_or_project.py b/scripts/create_team_or_project.py index c891955..b5a999b 100644 --- a/scripts/create_team_or_project.py +++ b/scripts/create_team_or_project.py @@ -51,6 +51,7 @@ def create_project(team_name, project_name): project, new = Project.objects.get_or_create(name=project_name, team=team, defaults=defaults) project.update_option('sentry:scrub_data', False) + project.update_option('sentry:scrub_defaults', False) return project, new From f53433c45c77cd8722645192594063ac4444da8c Mon Sep 17 00:00:00 2001 From: Hugo Chinchilla Carbonell Date: Mon, 12 Jun 2017 08:06:36 +0200 Subject: [PATCH 5/7] Add setting to control redis broker database --- sentry_docker_conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry_docker_conf.py b/sentry_docker_conf.py index 34fd503..88e4de6 100644 --- a/sentry_docker_conf.py +++ b/sentry_docker_conf.py @@ -74,7 +74,8 @@ # You can enable queueing of jobs by turning off the always eager setting: CELERY_ALWAYS_EAGER = config('CELERY_ALWAYS_EAGER', default=True, cast=bool) -DEFAULT_BROKER_URL = 'redis://{0}:{1}/1'.format(REDIS_HOST, REDIS_PORT) +REDIS_BROKER_DATABASE=config('REDIS_BROKER_DATABASE', default='1') +DEFAULT_BROKER_URL = 'redis://{0}:{1}/{2}'.format(REDIS_HOST, REDIS_PORT, REDIS_BROKER_DATABASE) BROKER_URL = config('SENTRY_BROKER_URL', default=DEFAULT_BROKER_URL) From 74d2f6ceabc6c99716f246ea34da3bc90769b896 Mon Sep 17 00:00:00 2001 From: Hugo Chinchilla Carbonell Date: Mon, 12 Jun 2017 08:06:49 +0200 Subject: [PATCH 6/7] add option to enable redis quotas --- sentry_docker_conf.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sentry_docker_conf.py b/sentry_docker_conf.py index 88e4de6..e6101ce 100644 --- a/sentry_docker_conf.py +++ b/sentry_docker_conf.py @@ -125,6 +125,12 @@ SENTRY_DIGESTS = 'sentry.digests.backends.redis.RedisBackend' SENTRY_DIGESTS_OPTIONS = {'cluster': 'default'} + +SENTRY_USE_REDIS_QUOTAS = config('SENTRY_USE_REDIS_QUOTAS', default=False, cast=bool) +if SENTRY_USE_REDIS_QUOTAS: + SENTRY_QUOTAS = 'sentry.quotas.redis.RedisQuota' + SENTRY_QUOTA_OPTIONS = {'cluster': 'default'} + ################ # Web Server ## ################ From ad4e53a23ec0c18acbfd8d46ee57fbf0f77bcd12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20Piz=C3=A0?= Date: Tue, 8 Aug 2017 09:54:15 +0200 Subject: [PATCH 7/7] Hardcoded sentry-plugins in requirements.txt --- requirements.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements.txt b/requirements.txt index 12473fc..6ca6b0b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,3 +13,5 @@ sentry[postgres]==8.15.0 # ldap user store django-auth-ldap==1.2.7 +# plugins (i.e. Jira) +sentry-plugins==8.19.0