11version : " 3.4"
22x-restart-policy : &restart_policy
33 restart : unless-stopped
4+ x-healthcheck-defaults : &healthcheck_defaults
5+ # Avoid setting the interval too small, as docker uses much more CPU than one would expect.
6+ # Related issues:
7+ # https://github.com/moby/moby/issues/39102
8+ # https://github.com/moby/moby/issues/39388
9+ # https://github.com/getsentry/onpremise/issues/1000
10+ interval : 30s
11+ timeout : 5s
12+ retries : 3
13+ start_period : 10s
414x-sentry-defaults : &sentry_defaults
515 << : *restart_policy
616 image : " $SENTRY_IMAGE"
@@ -60,21 +70,15 @@ services:
6070 << : *restart_policy
6171 image : " memcached:1.6.9-alpine"
6272 healthcheck :
73+ << : *healthcheck_defaults
6374 # From: https://stackoverflow.com/a/31877626/5155484
6475 test : echo stats | nc 127.0.0.1 11211
65- interval : 2s
66- timeout : 3s
67- retries : 30
68- start_period : 3s
6976 redis :
7077 << : *restart_policy
7178 image : " redis:6.2.4-alpine"
7279 healthcheck :
80+ << : *healthcheck_defaults
7381 test : redis-cli ping
74- interval : 2s
75- timeout : 3s
76- retries : 30
77- start_period : 3s
7882 volumes :
7983 - " sentry-redis:/data"
8084 ulimits :
@@ -85,13 +89,19 @@ services:
8589 << : *restart_policy
8690 image : " postgres:9.6"
8791 healthcheck :
92+ << : *healthcheck_defaults
8893 # Using default user "postgres" from sentry/sentry.conf.example.py or value of POSTGRES_USER if provided
8994 test : ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
90- interval : 2s
91- timeout : 3s
92- retries : 30
93- start_period : 10s
94- command : ["postgres", "-c", "wal_level=logical", "-c", "max_replication_slots=1", "-c", "max_wal_senders=1"]
95+ command :
96+ [
97+ " postgres" ,
98+ " -c" ,
99+ " wal_level=logical" ,
100+ " -c" ,
101+ " max_replication_slots=1" ,
102+ " -c" ,
103+ " max_wal_senders=1" ,
104+ ]
95105 environment :
96106 POSTGRES_HOST_AUTH_METHOD : " trust"
97107 entrypoint : /opt/sentry/postgres-entrypoint.sh
@@ -115,10 +125,9 @@ services:
115125 - " sentry-zookeeper-log:/var/lib/zookeeper/log"
116126 - " sentry-secrets:/etc/zookeeper/secrets"
117127 healthcheck :
118- test : ["CMD-SHELL", 'echo "ruok" | nc -w 2 -q 2 localhost 2181 | grep imok']
119- interval : 10s
120- timeout : 5s
121- retries : 6
128+ << : *healthcheck_defaults
129+ test :
130+ ["CMD-SHELL", 'echo "ruok" | nc -w 2 -q 2 localhost 2181 | grep imok']
122131 kafka :
123132 << : *restart_policy
124133 depends_on :
@@ -141,10 +150,8 @@ services:
141150 - " sentry-kafka-log:/var/lib/kafka/log"
142151 - " sentry-secrets:/etc/kafka/secrets"
143152 healthcheck :
144- test : ["CMD-SHELL", 'nc -z localhost 9092']
145- interval : 10s
146- timeout : 5s
147- retries : 6
153+ << : *healthcheck_defaults
154+ test : ["CMD-SHELL", "nc -z localhost 9092"]
148155 clickhouse :
149156 << : *restart_policy
150157 image : " yandex/clickhouse-server:20.3.9.70"
0 commit comments