-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-stack.yml
More file actions
210 lines (199 loc) · 5.38 KB
/
docker-stack.yml
File metadata and controls
210 lines (199 loc) · 5.38 KB
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
version: "3.8"
x-api-common: &api-common
environment:
- DOCKER_RUN=1
- REDIS_URL=redis://redis:6379
secrets:
- xcm_auth_header
networks:
- hydration-net
depends_on:
- redis
services:
redis:
image: redis:7-alpine
networks:
- hydration-net
volumes:
- redis-data:/data
deploy:
replicas: 1
restart_policy:
condition: on-failure
resources:
limits:
memory: 256M
app:
<<: *api-common
image: ${IMAGE_API:-greenjay/hydration-api:latest}
environment:
- DOCKER_RUN=1
- PORT=3000
- REDIS_URL=redis://redis:6379
networks:
- hydration-net
- gateway
deploy:
replicas: 2
update_config:
parallelism: 1
delay: 10s
failure_action: rollback
order: start-first
rollback_config:
parallelism: 1
delay: 5s
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
resources:
limits:
memory: 512M
labels:
- "traefik.enable=true"
- "traefik.docker.network=gateway"
- "traefik.http.routers.hydration-api.rule=Host(`api.nice.hydration.cloud`)"
- "traefik.http.routers.hydration-api.entrypoints=websecure"
- "traefik.http.routers.hydration-api.tls.certresolver=myresolver"
- "traefik.http.routers.hydration-api.tls.domains[0].main=api.nice.hydration.cloud"
- "traefik.http.services.hydration-api.loadbalancer.server.port=3000"
- "traefik.http.routers.hydration-api-http.rule=Host(`api.nice.hydration.cloud`)"
- "traefik.http.routers.hydration-api-http.entrypoints=web"
- "traefik.http.routers.hydration-api-http.middlewares=https-redirect"
- "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://localhost:3000/health/app').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
jobs:
<<: *api-common
image: ${IMAGE_JOBS:-greenjay/hydration-api-jobs:latest}
environment:
- DOCKER_RUN=1
- REDIS_URL=redis://redis:6379
- JOB_NAME=cache-coingecko-tickers-job
- CONTINUOUS_JOB=true
secrets:
- xcm_auth_header
- pgpassword_db
- pgpassword_db_fallback
deploy:
replicas: 1
restart_policy:
condition: on-failure
delay: 10s
resources:
limits:
memory: 256M
monitor:
<<: *api-common
image: ${IMAGE_MONITOR:-greenjay/hydration-api-monitor:latest}
environment:
- DOCKER_RUN=1
- REDIS_URL=redis://redis:6379
- MONITOR_PORT=9090
- DISCORD_CHANNEL_ID=884924771584860221
- DEXSCREENER_STALE_THRESHOLD_SECONDS=600
- ORCA_STALE_THRESHOLD_SECONDS=600
secrets:
- xcm_auth_header
- discord_webhook_url
deploy:
replicas: 1
restart_policy:
condition: on-failure
delay: 10s
resources:
limits:
memory: 128M
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://localhost:9090/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
prometheus:
image: prom/prometheus:latest
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=90d"
configs:
- source: prometheus_config
target: /etc/prometheus/prometheus.yml
volumes:
- prometheus-data:/prometheus
networks:
- hydration-net
deploy:
replicas: 1
restart_policy:
condition: on-failure
resources:
limits:
memory: 512M
grafana:
image: grafana/grafana:latest
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GF_ADMIN_PASSWORD:-changeme}
- GF_SERVER_ROOT_URL=https://grafana.nice.hydration.cloud
volumes:
- grafana-data:/var/lib/grafana
networks:
- hydration-net
- gateway
deploy:
replicas: 1
restart_policy:
condition: on-failure
resources:
limits:
memory: 256M
labels:
- "traefik.enable=true"
- "traefik.docker.network=gateway"
- "traefik.http.routers.grafana.rule=Host(`grafana.nice.hydration.cloud`)"
- "traefik.http.routers.grafana.entrypoints=websecure"
- "traefik.http.routers.grafana.tls.certresolver=myresolver"
- "traefik.http.routers.grafana.tls.domains[0].main=grafana.nice.hydration.cloud"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"
- "traefik.http.routers.grafana-http.rule=Host(`grafana.nice.hydration.cloud`)"
- "traefik.http.routers.grafana-http.entrypoints=web"
- "traefik.http.routers.grafana-http.middlewares=https-redirect"
networks:
hydration-net:
driver: overlay
attachable: true
gateway:
external: true
volumes:
redis-data:
prometheus-data:
grafana-data:
configs:
prometheus_config:
external: true
secrets:
xcm_auth_header:
external: true
discord_webhook_url:
external: true
pgpassword_db:
external: true
pgpassword_db_fallback:
external: true