forked from beda-software/docker-sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-links.conf.py
128 lines (120 loc) · 3.77 KB
/
docker-links.conf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
postgres = os.getenv('SENTRY_POSTGRES_HOST') or (os.getenv('POSTGRES_PORT_5432_TCP_ADDR') and 'postgres')
mysql = os.getenv('SENTRY_MYSQL_HOST') or (os.getenv('MYSQL_PORT_3306_TCP_ADDR') and 'mysql')
redis = os.getenv('SENTRY_REDIS_HOST') or (os.getenv('REDIS_PORT_6379_TCP_ADDR') and 'redis')
memcached = os.getenv('SENTRY_MEMCACHED_HOST') or (os.getenv('MEMCACHED_PORT_11211_TCP_ADDR') and 'memcached')
if postgres:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': (
os.getenv('SENTRY_DB_NAME')
or os.getenv('POSTGRES_ENV_POSTGRES_USER')
or 'postgres'
),
'USER': (
os.getenv('SENTRY_DB_USER')
or os.getenv('POSTGRES_ENV_POSTGRES_USER')
or 'postgres'
),
'PASSWORD': (
os.getenv('SENTRY_DB_PASSWORD')
or os.getenv('POSTGRES_ENV_POSTGRES_PASSWORD')
or ''
),
'HOST': postgres,
'PORT': (
os.getenv('SENTRY_POSTGRES_PORT')
or ''
),
'OPTIONS': {
'autocommit': True,
},
},
}
elif mysql:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': (
os.getenv('SENTRY_DB_NAME')
or os.getenv('MYSQL_ENV_MYSQL_DATABASE')
or ''
),
'USER': (
os.getenv('SENTRY_DB_USER')
or os.getenv('MYSQL_ENV_MYSQL_USER')
or 'root'
),
'PASSWORD': (
os.getenv('SENTRY_DB_PASSWORD')
or os.getenv('MYSQL_ENV_MYSQL_PASSWORD')
or os.getenv('MYSQL_ENV_MYSQL_ROOT_PASSWORD')
or ''
),
'HOST': mysql,
'PORT': (
os.getenv('SENTRY_MYSQL_PORT')
or ''
),
},
}
else:
sqlite_path = (
os.getenv('SENTRY_DB_NAME')
or 'sentry.db'
)
if not os.path.isabs(sqlite_path):
sqlite_path = os.path.join(CONF_ROOT, sqlite_path)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': sqlite_path,
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
},
}
if memcached:
memcached_port = (
os.getenv('SENTRY_MEMCACHED_PORT')
or '11211'
)
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': [memcached + ':' + memcached_port],
}
}
if redis:
redis_port = (
os.getenv('SENTRY_REDIS_PORT')
or '6379'
)
redis_db = (
os.getenv('SENTRY_REDIS_DB')
or '0'
)
SENTRY_BUFFER = 'sentry.buffer.redis.RedisBuffer'
SENTRY_REDIS_OPTIONS = {
'hosts': {
0: {
'host': redis,
'port': redis_port,
'db': redis_db,
},
},
}
BROKER_URL = 'redis://' + redis + ':' + redis_port + '/' + redis_db
else:
raise Exception('Error: REDIS_PORT_6379_TCP_ADDR (or SENTRY_REDIS_HOST) is undefined, did you forget to `--link` a redis container?')
SENTRY_URL_PREFIX = os.getenv('SENTRY_URL_PREFIX')
SENTRY_ADMIN_EMAIL = os.getenv('SENTRY_ADMIN_EMAIL')
ALLOWED_HOSTS = ['*']
EMAIL_HOST = os.getenv('EMAIL_HOST')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD')
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER')
EMAIL_PORT = int(os.getenv('EMAIL_PORT', 25))
EMAIL_USE_TLS = os.getenv('EMAIL_USE_TLS') == 'True'
SERVER_EMAIL = EMAIL_HOST_USER
SENTRY_ALLOW_REGISTRATION = False