forked from UnlockedLabs/UnlockEdv2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
272 lines (257 loc) · 6.6 KB
/
docker-compose.yml
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
services:
postgres:
image: postgres:16
environment:
POSTGRES_DB: unlocked
POSTGRES_USER: unlocked
POSTGRES_PASSWORD: dev
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- config:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U unlocked"]
interval: 10s
timeout: 5s
retries: 5
networks:
- intranet
frontend:
build:
context: frontend
dockerfile: dev.Dockerfile
volumes:
- ./frontend:/app
- node_modules:/app/node_modules
networks:
- intranet
rev_proxy:
image: nginx:1.21.3-alpine
ports:
- 80:80
volumes:
- ./config/dev.nginx.conf:/etc/nginx/conf.d/default.conf
- logs:/var/log/nginx/
networks:
- intranet
restart: unless-stopped
depends_on:
kratos-migrate:
condition: service_completed_successfully
# backend API
server:
build:
context: ./
dockerfile: backend/dev.Dockerfile
ports:
- 8080:8080
networks:
- intranet
volumes:
- ./:/app
environment:
- APP_DSN=postgres://unlocked:dev@postgres:5432/unlocked
- APP_ENV=production
- LOG_LEVEL=debug
- APP_URL=http://127.0.0.1
- APP_KEY=base64:NTQxODNmNDMyM2YzNzdiNzM3NDMzYTFlOTgyMjllYWQwZmRjNjg2ZjkzYmFiMDU3ZWNiNjEyZGFhOTQwMDJiNSAgLQo=
- PROVIDER_SERVICE_URL=http://provider-service:8081
- HYDRA_ADMIN_URL=http://hydra:4445
- HYDRA_PUBLIC_URL=http://hydra:4444
- KRATOS_ADMIN_URL=http://kratos:4434
- KRATOS_PUBLIC_URL=http://kratos:4433
- MIDDLEWARE_CRON_SCHEDULE=0 22 * * *
- KETO_ADMIN_URL=http://keto:4466
- ORY_TOKEN=eyJvZmZzZXQiOiItMjUwIiwidmo8iV*@
- NATS_URL=nats:4222
- NATS_USER=unlocked
- NATS_PASSWORD=dev
- MIGRATION_DIR=backend/migrations
depends_on:
kratos:
condition: service_started
postgres:
condition: service_healthy
# Provider middleware
provider-service:
build:
context: .
dockerfile: provider-middleware/dev.Dockerfile
environment:
- APP_ENV=production
- APP_KEY=base64:NTQxODNmNDMyM2YzNzdiNzM3NDMzYTFlOTgyMjllYWQwZmRjNjg2ZjkzYmFiMDU3ZWNiNjEyZGFhOTQwMDJiNSAgLQo=
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=unlocked
- DB_PASSWORD=dev
- KOLIBRI_DB_PASSWORD=dev
- DB_NAME=unlocked
- NATS_URL=nats:4222
- NATS_USER=unlocked
- NATS_PASSWORD=dev
networks:
- intranet
volumes:
- logs:/logs
- ./:/app
ports:
- 8081:8081
restart: unless-stopped
depends_on: [server]
# Scheduler + task runner for provider-middleware
cron-tasks:
build:
context: .
dockerfile: ./backend/tasks/dev.Dockerfile
environment:
- LOG_LEVEL=debug
- NATS_URL=nats:4222
- NATS_USER=unlocked
- NATS_PASSWORD=dev
- DB_HOST=postgres
- DB_PORT=5432
- DB_USER=unlocked
- DB_PASSWORD=dev
- DB_NAME=unlocked
- MIDDLEWARE_CRON_SCHEDULE=0 22 * * *
networks:
- intranet
volumes:
- logs:/logs
- ./:/app
depends_on:
provider-service:
condition: service_started
keto-migrate:
image: oryd/keto:v0.12.0-alpha.0
links:
- postgres:postgres
volumes:
- config:/home/ory
environment:
- LOG_LEVEL=debug
- DSN=postgres://keto:ChangeMe!@postgres:5432/accesscontroldb?sslmode=prefer&max_conns=20&max_idle_conns=4
command: ["migrate", "up", "-y"]
depends_on:
postgres:
condition: service_healthy
networks:
- intranet
nats:
image: nats:latest
networks:
- intranet
ports:
- 8222:8222
- 4222:4222
command: --js -c /config/nats-server.conf
restart: on-failure
volumes:
- config:/config
- nats_data:/data
keto:
image: oryd/keto:v0.11.1-alpha.0
links:
- postgres:postgres
volumes:
- type: bind
source: config
target: /home/ory
ports:
- "4466:4466"
- "4467:4467"
depends_on:
- keto-migrate
environment:
- DSN=postgres://keto:ChangeMe!@postgres:5432/accesscontroldb?sslmode=prefer&max_conns=20&max_idle_conns=4
networks:
- intranet
kratos-migrate:
image: oryd/kratos:v1.1.0
environment:
- DSN=postgres://kratos:ChangeMe!@postgres:5432/kratos?sslmode=disable&max_conns=20&max_idle_conns=4
volumes:
- type: bind
source: ./config/kratos
target: /etc/config/kratos
command: -c /etc/config/kratos/kratos.yml migrate sql -e --yes
networks:
- intranet
depends_on:
postgres:
condition: service_healthy
kratos:
depends_on:
- kratos-migrate
image: oryd/kratos:v1.1.0
ports:
- "4433:4433" # public
- "4434:4434" # admin
environment:
- DSN=postgres://kratos:ChangeMe!@postgres:5432/kratos?sslmode=prefer&max_conns=20&max_idle_conns=4
- LOG_LEVEL=trace
command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier
volumes:
- type: bind
source: ./config/kratos
target: /etc/config/kratos
networks:
- intranet
hydra:
image: oryd/hydra:v2.2.0
ports:
- "4444:4444"
- "4445:4445"
- "5555:5555"
command: serve -c /etc/config/hydra/hydra.yml all --dev
volumes:
- type: bind
source: ./config/hydra
target: /etc/config/hydra
environment:
- LOG_LEVEL=debug
- OAUTH2_EXPOSE_INTERNAL_ERRORS=1
- SERVE_PUBLIC_CORS_ENABLED=true
- SERVE_PUBLIC_CORS_ALLOWED_METHODS=POST,GET,PUT,DELETE
- SERVE_ADMIN_CORS_ENABLED=true
- SERVE_ADMIN_CORS_ALLOWED_METHODS=POST,GET,PUT,DELETE
- DSN=postgres://hydra:ChangeMe!@postgres:5432/hydra?sslmode=prefer&max_conns=20&max_idle_conns=4
restart: unless-stopped
depends_on:
- hydra-migrate
networks:
- intranet
hydra-migrate:
image: oryd/hydra:v2.2.0
environment:
- DSN=postgres://hydra:ChangeMe!@postgres:5432/hydra?sslmode=prefer&max_conns=20&max_idle_conns=4
command: migrate -c /etc/config/hydra/hydra.yml sql -e --yes
volumes:
- type: bind
source: ./config/hydra
target: /etc/config/hydra
networks:
- intranet
depends_on:
postgres:
condition: service_healthy
networks:
intranet:
driver: bridge
volumes:
nats_data:
postgres_data:
config:
driver: local
driver_opts:
type: none
o: bind
device: ./config
logs:
driver: local
driver_opts:
type: none
o: bind
device: ./logs
node_modules: