Skip to content

Commit

Permalink
Use redis and postgres from env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
darklow committed Jan 30, 2016
1 parent 3734799 commit 4c1a594
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions sentry.conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@

CONF_ROOT = os.path.dirname(__file__)

# Sentry settings
SENTRY_FEATURES['auth:register'] = False

# Get and parse dokku env vars
db_url = os.environ['DATABASE_URL']
redis_url = os.environ['REDIS_URL']
db_url_parts = urlparse.urlparse(db_url)
redis_url_parts = urlparse.urlparse(redis_url)

DATABASES = {
'default': {
'ENGINE': 'sentry.db.postgres',
'NAME': 'sentry',
'USER': 'postgres',
'PASSWORD': '',
'HOST': '',
'PORT': '',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': db_url_parts.path[1:],
'USER': db_url_parts.username,
'PASSWORD': db_url_parts.password,
'HOST': db_url_parts.hostname,
'PORT': db_url_parts.port,
}
}

Expand All @@ -39,12 +48,11 @@

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

SENTRY_REDIS_OPTIONS = {
'hosts': {
0: {
'host': '127.0.0.1',
'port': 6379,
'host': redis_url_parts.host,
'port': redis_url_parts.port,
}
}
}
Expand Down Expand Up @@ -79,7 +87,7 @@
# information on configuring your queue broker and workers. Sentry relies
# on a Python framework called Celery to manage queues.

BROKER_URL = 'redis://localhost:6379'
BROKER_URL = redis_url

###############
# Rate Limits #
Expand Down Expand Up @@ -154,7 +162,7 @@
# FORCE_SCRIPT_NAME = '/sentry'

SENTRY_WEB_HOST = '0.0.0.0'
SENTRY_WEB_PORT = 9000
SENTRY_WEB_PORT = os.environ.get('PORT')
SENTRY_WEB_OPTIONS = {
# 'workers': 3, # the number of gunicorn workers
# 'secure_scheme_headers': {'X-FORWARDED-PROTO': 'https'},
Expand Down

0 comments on commit 4c1a594

Please sign in to comment.