Skip to content

Add support for more ENVs #3664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@ HEALTHCHECK_RETRIES=10
POSTGRES_MAX_CONNECTIONS=100
# Set SETUP_JS_SDK_ASSETS to 1 to enable the setup of JS SDK assets
# SETUP_JS_SDK_ASSETS=1
# You can also override the default value for the assets URL
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# You can also override the default value for the assets URL
# You can override the default value for the assets URL

# JS_SDK_LOADER_DEFAULT_SDK_URL=https://sentry.example.com/js-sdk/%s/bundle%s.min.js

# To enabled the memcached cache store
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# To enabled the memcached cache store
# Enable memcached cache store

# ENABLE_MEMCACHED=true

# You can disable features
# SENTRY_DISABLE_FEATURES=organizations:sso-rippling,organizations:sso-saml2

# Or enable features
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each variable and its comment should be used and defined regardless of other variables.

Suggested change
# Or enable features
# You can enable features

# SENTRY_ENABLE_FEATURES=projects:sample-events
63 changes: 45 additions & 18 deletions sentry/sentry.conf.example.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def get_internal_network():
DATABASES = {
"default": {
"ENGINE": "sentry.db.postgres",
"NAME": "postgres",
"USER": "postgres",
"PASSWORD": "",
"HOST": "postgres",
"PORT": "",
"NAME": env("SENTRY_DB_NAME", "postgres"),
"USER": env("SENTRY_DB_USER", "postgres"),
"PASSWORD": env("SENTRY_DB_PASSWORD", ""),
"HOST": env("SENTRY_DB_HOST", "postgres"),
"PORT": env("SENTRY_DB_PORT", ""),
Comment on lines +48 to +52
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind renaming these to SENTRY_POSTGRES_DB_*? Since we have a few DBs..

}
}

Expand All @@ -66,7 +66,7 @@ def get_internal_network():

# 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
SENTRY_SINGLE_ORGANIZATION = env("SENTRY_SINGLE_ORGANIZATION", "false").lower() in ("true")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SENTRY_SINGLE_ORGANIZATION = env("SENTRY_SINGLE_ORGANIZATION", "false").lower() in ("true")
SENTRY_SINGLE_ORGANIZATION = env("SENTRY_SINGLE_ORGANIZATION", "true").lower() in ("true")

oops

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also make it accept 1, yes, y, and t too just to be comprehensive.


SENTRY_OPTIONS["system.event-retention-days"] = int(
env("SENTRY_EVENT_RETENTION_DAYS", "90")
Expand Down Expand Up @@ -123,14 +123,17 @@ def get_internal_network():
# Sentry currently utilizes two separate mechanisms. While CACHES is not a
# requirement, it will optimize several high throughput patterns.

CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"LOCATION": ["memcached:11211"],
"TIMEOUT": 3600,
"OPTIONS": {"ignore_exc": True},
# If you wish to use memcached, use ENABLE_MEMCACHED=true

if env("ENABLE_MEMCACHED", "false").lower() in ("true"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also default to true, right?

CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"LOCATION": ["memcached:11211"],
"TIMEOUT": 3600,
"OPTIONS": {"ignore_exc": True},
}
}
}

# A primary cache is required for things such as processing events
SENTRY_CACHE = "sentry.cache.redis.RedisCache"
Expand Down Expand Up @@ -213,8 +216,8 @@ def get_internal_network():
# Web Server #
##############

SENTRY_WEB_HOST = "0.0.0.0"
SENTRY_WEB_PORT = 9000
SENTRY_WEB_HOST = env("SENTRY_WEB_HOST", "0.0.0.0")
SENTRY_WEB_PORT = env("SENTRY_WEB_PORT", 9000)
Comment on lines +219 to +220
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should almost never be modifying these as they don't do what you expect with a docker-compose setup.

SENTRY_WEB_OPTIONS = {
"http": "%s:%s" % (SENTRY_WEB_HOST, SENTRY_WEB_PORT),
"protocol": "uwsgi",
Expand Down Expand Up @@ -265,13 +268,18 @@ def get_internal_network():
########

SENTRY_OPTIONS["mail.list-namespace"] = env("SENTRY_MAIL_HOST", "localhost")
SENTRY_OPTIONS["mail.from"] = f"sentry@{SENTRY_OPTIONS['mail.list-namespace']}"
SENTRY_OPTIONS["mail.from"] = env('SENTRY_MAIL_FROM', f"sentry@{SENTRY_OPTIONS['mail.list-namespace']}")
SENTRY_OPTIONS["mail.port"] = env('SENTRY_MAIL_PORT', 465)
SENTRY_OPTIONS["mail.username"] = env('SENTRY_MAIL_USERNAME', '')
SENTRY_OPTIONS["mail.password"] = env('SENTRY_MAIL_PASSWORD', '')
SENTRY_OPTIONS["mail.use-tls"] = env('SENTRY_MAIL_USE_TLS', 'false').lower() in ('true')
SENTRY_OPTIONS["mail.use-ssl"] = env('SENTRY_MAIL_USE_SSL', 'false').lower() in ('true')
Comment on lines +271 to +276
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't these defined on the config.yml file, instead of here? Or do you disable those on config.yml and define the mail configurations here instead?


############
# Features #
############

SENTRY_FEATURES["projects:sample-events"] = False
# Enable features
SENTRY_FEATURES.update(
{
feature: True
Expand All @@ -284,6 +292,7 @@ def get_internal_network():
"organizations:integrations-issue-sync",
"organizations:invite-members",
"organizations:metric-alert-builder-aggregate",
# Required feature !
"organizations:sso-basic",
"organizations:sso-rippling",
"organizations:sso-saml2",
Expand Down Expand Up @@ -338,6 +347,24 @@ def get_internal_network():
}
)

# Disable features
SENTRY_FEATURES.update(
{
feature: False
for feature in tuple(part for part in env("SENTRY_DISABLE_FEATURES", "").split(',') if part) + (
"projects:sample-events",
)
}
)

# Enable features
SENTRY_FEATURES.update(
{
feature: True
for feature in tuple(part for part in env("SENTRY_ENABLE_FEATURES", "").split(',') if part)
}
)

#######################
# MaxMind Integration #
#######################
Expand Down Expand Up @@ -387,7 +414,7 @@ def get_internal_network():
# to keep the old assets, set `SETUP_JS_SDK_KEEP_OLD_ASSETS` environment variable to any value on
# your `.env` or `.env.custom` file. The files should only be a few KBs, and this might be useful
# if you're using it directly like a CDN instead of using the loader script.
JS_SDK_LOADER_DEFAULT_SDK_URL = "https://browser.sentry-cdn.com/%s/bundle%s.min.js"
JS_SDK_LOADER_DEFAULT_SDK_URL = env("JS_SDK_LOADER_DEFAULT_SDK_URL", "https://browser.sentry-cdn.com/%s/bundle%s.min.js")

#####################
# Insights Settings #
Expand Down
Loading