Skip to content

Commit

Permalink
Merge pull request #10 from Rungutan/update-sentry-21.1.0
Browse files Browse the repository at this point in the history
Update sentry 21.1.0
  • Loading branch information
mariusmitrofan authored Jan 22, 2021
2 parents 545bee5 + e159b57 commit 4deeb2b
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 76 deletions.
22 changes: 11 additions & 11 deletions cloudformation-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ Parameters:
# OpsWorks ClickHouse variables
ClickHouseCookbookUrl:
Type: String
Default: https://github.com/Rungutan/sentry-performance-monitoring/releases/download/1.4.0/clickhouse-1.4.0.tar.gz
Default: https://github.com/Rungutan/sentry-performance-monitoring/releases/download/1.5.0/clickhouse-1.5.0.tar.gz

ClickHouseInstanceType:
Type: String
Expand Down Expand Up @@ -205,28 +205,28 @@ Parameters:

SentryImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/sentry-base:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-base:1.4.0 <AND> Docker HUB = rungutancommunity/sentry-base:1.4.0
Default: public.ecr.aws/x7u7j5v7/sentry-base:1.5.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-base:1.5.0 <AND> Docker HUB = rungutancommunity/sentry-base:1.5.0

SnubaImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/sentry-snuba:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-snuba:1.4.0 <AND> Docker HUB = rungutancommunity/sentry-snuba:1.4.0
Default: public.ecr.aws/x7u7j5v7/sentry-snuba:1.5.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-snuba:1.5.0 <AND> Docker HUB = rungutancommunity/sentry-snuba:1.5.0

RelayImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/sentry-relay:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-relay:1.4.0 <AND> Docker HUB = rungutancommunity/sentry-relay:1.4.0
Default: public.ecr.aws/x7u7j5v7/sentry-relay:1.5.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/sentry-relay:1.5.0 <AND> Docker HUB = rungutancommunity/sentry-relay:1.5.0

BashImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/bash:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/bash:1.4.0 <AND> Docker HUB = rungutancommunity/bash:1.4.0
Default: public.ecr.aws/x7u7j5v7/bash:1.5.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/bash:1.5.0 <AND> Docker HUB = rungutancommunity/bash:1.5.0

ClickHouseImage:
Type: String
Default: public.ecr.aws/x7u7j5v7/clickhouse-client:1.4.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/clickhouse-client:1.4.0 <AND> Docker HUB = rungutancommunity/clickhouse-client:1.4.0
Default: public.ecr.aws/x7u7j5v7/clickhouse-client:1.5.0
Description: Public ECR = public.ecr.aws/x7u7j5v7/clickhouse-client:1.5.0 <AND> Docker HUB = rungutancommunity/clickhouse-client:1.5.0

MinCountSnubaApi:
Type: String
Expand Down
2 changes: 1 addition & 1 deletion docker/relay/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM getsentry/relay:20.12.1
FROM getsentry/relay:21.1.0

COPY docker/relay/docker-alt-entrypoint.sh /docker-entrypoint.sh
34 changes: 32 additions & 2 deletions docker/relay/docker-alt-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,43 @@ fi
mkdir -p /work/.relay/ && chown -R relay:relay /work
(cp ${CONFIG_FILE_PATH} /work/.relay/config.yml) || true

# Sleep for the specified number of seconds before starting.
# For example, can be helpful to synchronize container startup in Kubernetes environment.
if [[ -n "${RELAY_DELAY_STARTUP_SECONDS:-}" ]]; then
echo "Sleeping for ${RELAY_DELAY_STARTUP_SECONDS}s..."
sleep "${RELAY_DELAY_STARTUP_SECONDS}"
fi

# Make sure that a specified URL (e.g. the upstream or a proxy sidecar) is reachable before starting.
# Only 200 response is accepted as success.
if [[ -n "${RELAY_PRESTART_ENDPOINT:-}" ]]; then
max_retry="${RELAY_PRESTART_MAX_RETRIES:-120}"
curl_timeout="${RELAY_PRESTART_REQUEST_TIMEOUT:-1}"
for attempt in $(seq 0 "${max_retry}"); do
if [[ "${attempt}" == "${max_retry}" ]]; then
echo "The prestart endpoint has not returned 200 after ${max_retry} attempts, exiting!"
exit 1
fi
status=$(curl --max-time "${curl_timeout}" --show-error --silent \
--output /dev/null --write-out "%{http_code}" \
-H 'Connection: close' \
"${RELAY_PRESTART_ENDPOINT}" \
|| true)
if [[ "${status}" == "200" ]]; then
break
fi
echo "Waiting for a 200 response from ${RELAY_PRESTART_ENDPOINT}, got ${status}"
sleep 1
done
fi

# For compatibility with older images
if [ "$1" == "bash" ]; then
set -- bash
set -- bash "${@:2}"
elif [ "$(id -u)" == "0" ]; then
set -- gosu relay /bin/relay "$@"
else
set -- /bin/relay "$@"
fi

exec "$@"
exec "$@"
2 changes: 1 addition & 1 deletion docker/sentry/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM getsentry/sentry:20.12.1
FROM getsentry/sentry:21.1.0

RUN apt-get update && \
apt-get install -y build-essential lcov valgrind libldap2-dev libsasl2-dev && \
Expand Down
134 changes: 74 additions & 60 deletions docker/sentry/sentry.conf.py
Original file line number Diff line number Diff line change
@@ -1,57 +1,86 @@
from sentry.conf.server import * # NOQA
# flake8: noqa
from __future__ import absolute_import
from sentry.conf.server import *
from sentry.utils.types import Bool
from distutils.util import strtobool

import os
import os.path

CONF_ROOT = os.path.dirname(__file__)
env = os.environ.get

DATABASES = {
"default": {
"ENGINE": "sentry.db.postgres",
"NAME": os.environ.get("POSTGRES_DB"),
"USER": os.environ.get("POSTGRES_USER"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
"HOST": os.environ.get("POSTGRES_HOST"),
"PORT": int(os.environ.get("POSTGRES_PORT"))
"NAME": env("POSTGRES_DB"),
"USER": env("POSTGRES_USER"),
"PASSWORD": env("POSTGRES_PASSWORD"),
"HOST": env("POSTGRES_HOST"),
"PORT": int(env("POSTGRES_PORT"))
}
}

# You should not change this setting after your database has been created
# unless you have altered all schemas first
SENTRY_USE_BIG_INTS = True

# If you're expecting any kind of real traffic on Sentry, we highly recommend
# configuring the CACHES and Redis settings

###########
# General #
###########

# Instruct Sentry that this install intends to be run by a single organization
# and thus various UI optimizations should be enabled.
SENTRY_SINGLE_ORGANIZATION = bool(strtobool(env("SENTRY_SINGLE_ORGANIZATION", "true")))
SENTRY_OPTIONS["system.event-retention-days"] = int(env('SENTRY_EVENT_RETENTION_DAYS') or 90)
SENTRY_RELAY_WHITELIST_PK = []
SENTRY_RELAY_OPEN_REGISTRATION = True

#########
# Redis #
#########

# Generic Redis configuration used as defaults for various things including:
# Buffers, Quotas, TSDB

redis_host = os.environ.get("REDIS_HOST")
redis_port = os.environ.get("REDIS_PORT")
SENTRY_OPTIONS.update({
'redis.clusters': {
'default': {
'hosts': {
0: {
'host': redis_host,
'host': env("REDIS_HOST"),
'password': '',
'port': str(redis_port),
'port': str(env("REDIS_PORT")),
'db': '0',
},
},
},
},
})

#########
# Cache #
#########

# You should not change this setting after your database has been created
# unless you have altered all schemas first
SENTRY_USE_BIG_INTS = True

###########
# General #
###########
# Sentry currently utilizes two separate mechanisms. While CACHES is not a
# requirement, it will optimize several high throughput patterns.

# Instruct Sentry that this install intends to be run by a single organization
# and thus various UI optimizations should be enabled.
SENTRY_SINGLE_ORGANIZATION = True
memcached = env("SENTRY_MEMCACHED_HOST") or (env("MEMCACHED_PORT_11211_TCP_ADDR") and "memcached")
if memcached:
memcached_port = env("SENTRY_MEMCACHED_PORT") or "11211"
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"LOCATION": [memcached + ":" + memcached_port],
"TIMEOUT": 3600,
}
}

SENTRY_OPTIONS["system.event-retention-days"] = int(env('SENTRY_EVENT_RETENTION_DAYS') or 90)
# A primary cache is required for things such as processing events
SENTRY_CACHE = "sentry.cache.redis.RedisCache"

#########
# Queue #
Expand All @@ -60,25 +89,12 @@
# See https://docs.getsentry.com/on-premise/server/queue/ for more
# information on configuring your queue broker and workers. Sentry relies
# on a Python framework called Celery to manage queues.
BROKER_URL = os.environ.get("BROKER_URL", "redis://:@" + redis_host + ":" + redis_port + "/0")

#########
# Cache #
#########

# Sentry currently utilizes two separate mechanisms. While CACHES is not a
# requirement, it will optimize several high throughput patterns.
BROKER_URL = "redis://:@" + env("REDIS_HOST") + ":" + env("REDIS_PORT") + "/0"

# CACHES = {
# "default": {
# "BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
# "LOCATION": ["memcached:11211"],
# "TIMEOUT": 3600,
# }
# }

# A primary cache is required for things such as processing events
SENTRY_CACHE = "sentry.cache.redis.RedisCache"
################
# Event Stream #
################

kafka_broker_1 = os.environ.get("KAFKA_BROKER_1")
kafka_broker_2 = os.environ.get("KAFKA_BROKER_2")
Expand All @@ -95,6 +111,7 @@

KAFKA_CLUSTERS["default"] = DEFAULT_KAFKA_OPTIONS


###############
# Rate Limits #
###############
Expand Down Expand Up @@ -153,6 +170,12 @@
# Web Server #
##############

# If you're using a reverse SSL proxy, you should enable the X-Forwarded-Proto
# header and uncomment the following settings:
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
# SESSION_COOKIE_SECURE = True
# CSRF_COOKIE_SECURE = True

SENTRY_WEB_HOST = "0.0.0.0"
SENTRY_WEB_PORT = 9000
SENTRY_PUBLIC = True
Expand Down Expand Up @@ -240,7 +263,6 @@
"organizations:artifacts-in-settings",
"organizations:transaction-events",
"organizations:invite-members-rate-limits",

"projects:alert-filters",
"projects:custom-inbound-filters",
"projects:data-forwarding",
Expand All @@ -262,27 +284,19 @@
#######################
# Email Configuration #
#######################
if os.getenv('SENTRY_EMAIL_BACKEND') and os.getenv("SENTRY_EMAIL_USERNAME") and os.getenv("SENTRY_EMAIL_PASSWORD") and os.getenv("SENTRY_EMAIL_HOST"):
SENTRY_OPTIONS['mail.backend'] = os.getenv("SENTRY_EMAIL_BACKEND")
SENTRY_OPTIONS['mail.use-tls'] = bool(strtobool(os.getenv("SENTRY_EMAIL_USE_TLS", "true")))
SENTRY_OPTIONS['mail.username'] = os.getenv("SENTRY_EMAIL_USERNAME")
SENTRY_OPTIONS['mail.password'] = os.getenv("SENTRY_EMAIL_PASSWORD")
SENTRY_OPTIONS['mail.port'] = int(os.getenv("SENTRY_EMAIL_PORT"))
SENTRY_OPTIONS['mail.host'] = os.getenv("SENTRY_EMAIL_HOST")
SENTRY_OPTIONS['mail.from'] = os.getenv("SENTRY_EMAIL_FROM")
SENTRY_OPTIONS['mail.use-ssl'] = bool(strtobool(os.getenv("SENTRY_EMAIL_USE_SSL", "false")))

#########################
# Bitbucket Integration #
########################

# BITBUCKET_CONSUMER_KEY = 'YOUR_BITBUCKET_CONSUMER_KEY'
# BITBUCKET_CONSUMER_SECRET = 'YOUR_BITBUCKET_CONSUMER_SECRET'

#########
# Relay #
#########
SENTRY_RELAY_WHITELIST_PK = []
SENTRY_RELAY_OPEN_REGISTRATION = True

email = env("SENTRY_EMAIL_BACKEND") and env("SENTRY_EMAIL_HOST")
if email:
SENTRY_OPTIONS["mail.backend"] = env("SENTRY_EMAIL_BACKEND")
SENTRY_OPTIONS["mail.host"] = env("SENTRY_EMAIL_HOST")
SENTRY_OPTIONS["mail.password"] = env("SENTRY_EMAIL_PASSWORD")
SENTRY_OPTIONS["mail.username"] = env("SENTRY_EMAIL_USERNAME")
SENTRY_OPTIONS["mail.port"] = int(env("SENTRY_EMAIL_PORT") or 25)
SENTRY_OPTIONS["mail.use-tls"] = bool(strtobool(env("SENTRY_EMAIL_USE_TLS", "true")))
SENTRY_OPTIONS["mail.use-ssl"] = bool(strtobool(env("SENTRY_EMAIL_USE_SSL", "false")))
SENTRY_OPTIONS['mail.from'] = env("SENTRY_EMAIL_FROM")
else:
SENTRY_OPTIONS["mail.backend"] = "dummy"


2 changes: 1 addition & 1 deletion docker/snuba/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FROM getsentry/snuba:20.12.1
FROM getsentry/snuba:21.1.0

0 comments on commit 4deeb2b

Please sign in to comment.