-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.stack.yaml
More file actions
219 lines (216 loc) · 6.76 KB
/
compose.stack.yaml
File metadata and controls
219 lines (216 loc) · 6.76 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
211
212
213
214
215
216
217
218
219
x-logging: &prod-logging
driver: "json-file"
options:
max-file: "5"
max-size: "10M"
tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"
x-healthcheck: &prod-healthcheck
interval: 120s
timeout: 30s
retries: 3
start_interval: 1s
start_period: 20s
x-deploy: &prod-deploy
replicas: 1
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: always
services:
# ----------------------------------------------------------------------------
web:
environment:
- ENV=production
build:
target: prod
# ----------------------------------------------------------------------------
juicer:
image: ghcr.io/dankobg/juicer:latest
env_file:
- .env
environment:
- ENV=production
ports:
- "${PORT:-1337}:1337"
logging: *prod-logging
healthcheck:
<<: *prod-healthcheck
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:${PORT:-1337}/api/v1/health/alive",
]
deploy: *prod-deploy
labels:
# Rest api
- traefik.enable=true
- traefik.http.routers.juicer.rule=Host(`juicer-dev.xyz`) && PathPrefix(`/api`)
- traefik.http.routers.juicer.entrypoints=websecure
- traefik.http.routers.juicer.tls=true
- traefik.http.routers.juicer.service=juicer@docker
- traefik.http.services.juicer.loadbalancer.server.port=${PORT:-1337}
# Websocket
- traefik.http.routers.juicer-ws.rule=Host(`juicer-dev.xyz`) && Path(`/ws`)
- traefik.http.routers.juicer-ws.entrypoints=websecure
- traefik.http.routers.juicer-ws.tls=true
- traefik.http.routers.juicer-ws.service=juicer-ws@docker
- traefik.http.services.juicer-ws.loadbalancer.server.port=${PORT:-1337}
- traefik.http.services.juicer-ws.loadbalancer.sticky=true
# ----------------------------------------------------------------------------
pg:
env_file:
- .env
environment:
- POSTGRES_USER=${POSTGRES_USER:?Please provide POSTGRES_USER env var}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?Please provide POSTGRES_PASSWORD env var}
- POSTGRES_DB=${POSTGRES_DB:?Please provide POSTGRES_DB env var}
ports:
- "${POSTGRES_PORT:?Please provide POSTGRES_PORT env var}:5432"
logging: *prod-logging
healthcheck:
<<: *prod-healthcheck
test:
[
"CMD",
"pg_isready",
"-q",
"-d",
"${POSTGRES_DB}",
"-U",
"${POSTGRES_USER}",
]
deploy: *prod-deploy
# ----------------------------------------------------------------------------
redis:
env_file:
- .env
environment:
- ENV=production
ports:
- "${REDIS_PORT:?Please provide REDIS_PORT env var}:6379"
logging: *prod-logging
healthcheck:
<<: *prod-healthcheck
test: ["CMD", "redis-cli", "ping"]
deploy: *prod-deploy
# ----------------------------------------------------------------------------
kratos:
env_file:
- .env
environment:
- ENV=production
command: "serve --watch-courier --config /etc/config/kratos/kratos.yaml"
ports:
- "${KRATOS_PUBLIC_PORT:?Please provide KRATOS_PUBLIC_PORT env var}:4433"
- "${KRATOS_ADMIN_PORT:?Please provide KRATOS_ADMIN_PORT env var}:4434"
logging: *prod-logging
healthcheck:
<<: *prod-healthcheck
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:${KRATOS_PUBLIC_PORT:-4433}/health/alive",
]
deploy: *prod-deploy
labels:
- traefik.enable=true
- traefik.http.routers.kratos.rule=Host(`juicer-dev.xyz`) && PathPrefix(`/kratos`)
- traefik.http.routers.kratos.entrypoints=websecure
- traefik.http.routers.kratos.tls=true
- traefik.http.routers.kratos.service=kratos@docker
- traefik.http.services.kratos.loadbalancer.server.port=4433
- traefik.http.middlewares.kratos-stripprefix.stripprefix.prefixes=/kratos
- traefik.http.middlewares.kratos-stripprefix.stripprefix.forceSlash=false
- traefik.http.routers.kratos.middlewares=kratos-stripprefix@docker
# ----------------------------------------------------------------------------
kratos-migrate:
env_file:
- .env
environment:
- ENV=production
logging: *prod-logging
# ----------------------------------------------------------------------------
keto:
env_file:
- .env
environment:
- ENV=production
ports:
- "${SERVE_READ_PORT:?Please provide SERVE_READ_PORT env var}:4466"
- "${SERVE_WRITE_PORT:?Please provide SERVE_WRITE_PORT env var}:4467"
logging: *prod-logging
healthcheck:
<<: *dev-healthcheck
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:${SERVE_READ_PORT}/health/alive",
]
deploy: *prod-deploy
# ----------------------------------------------------------------------------
keto-migrate:
env_file:
- .env
environment:
- ENV=production
logging: *prod-logging
# ----------------------------------------------------------------------------
# traefik:
# image: traefik
# ports:
# - "80:80"
# - "443:443"
# - "8080:8080"
# restart: unless-stopped
# security_opt:
# - no-new-privileges:true
# networks:
# - intranet
# labels:
# - "traefik.enable=true"
# - "traefik.http.routers.traefik=true"
# - "traefik.http.routers.traefik.tls=true"
# - "traefik.http.services.traefik.loadbalancer.server.port=8080"
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock:ro
# - ./traefik/static.yaml:/etc/traefik/traefik.yaml:ro
# - ./traefik/dynamic.yaml:/etc/traefik/dynamic.yaml:ro
# - ./certs:/etc/certs:ro
# logging: *prod-logging
# command: --api=true --docker=true --ping=true
# healthcheck:
# <<: *prod-healthcheck
# test: ["CMD", "traefik", "healthcheck", "--ping"]
# deploy: *prod-deploy
# ----------------------------------------------------------------------------
# pg-backup:
# image: tiredofit/db-backup
# restart: always
# environment:
# - DEBUG_MODE=false
# - DEFAULT_PORT=${POSTGRES_PORT:?Please provide POSTGRES_PORT env var}
# - DEFAULT_BACKUP_INTERVAL=1440
# - DEFAULT_BACKUP_BEGIN=+0
# - DEFAULT_CLEANUP_TIME=10080
# volumes:
# - ./backups:/backup
# - ./tmp/backups:/tmp/backups
# networks:
# intranet:
# depends_on:
# pg:
# condition: service_healthy
# ----------------------------------------------------------------------------