-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
74 lines (68 loc) · 2.11 KB
/
docker-compose.yml
File metadata and controls
74 lines (68 loc) · 2.11 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
version: '3.8'
# Required environment variables — set these in a .env file or via your CI/CD
# secrets manager before running docker-compose up.
#
# DB_PASS=<strong-password> (required)
# JWT_SECRET=<min-32-char-secret> (required)
# NIOFLOW_CORS_ORIGIN=https://yourdomain.com (required)
services:
app:
build: .
ports:
- "8080:8080"
read_only: true
tmpfs:
- /tmp
security_opt:
- no-new-privileges:true
environment:
- JDBC_URL=jdbc:postgresql://db:5432/nioflow
- DB_USER=postgres
# :? means Docker Compose will fail immediately if this variable is unset or empty
- DB_PASS=${DB_PASS:?DB_PASS is required. Set it in .env or as an env var.}
- NIOFLOW_ENABLE_DB=true
- NIOFLOW_CORS_ORIGIN=${NIOFLOW_CORS_ORIGIN:?NIOFLOW_CORS_ORIGIN is required (e.g. https://yourdomain.com).}
- JWT_SECRET=${JWT_SECRET:?JWT_SECRET is required and must be at least 32 characters.}
- NIOFLOW_TRACING_ENABLED=true
- OTEL_EXPORTER_OTLP_ENDPOINT=http://jaeger:4317
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8080/_ready >/dev/null || exit 1"]
interval: 15s
timeout: 5s
retries: 5
start_period: 20s
depends_on:
db:
condition: service_healthy
networks:
- nioflow-net
db:
image: postgres:15-alpine
environment:
- POSTGRES_DB=nioflow
- POSTGRES_PASSWORD=${DB_PASS:?DB_PASS is required.}
# Port 5432 is intentionally NOT exposed to the host.
# The app container reaches the DB over the internal nioflow-net network.
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- nioflow-net
jaeger:
image: jaegertracing/all-in-one:latest
ports:
- "16686:16686" # UI
- "4317:4317" # OTLP gRPC
- "4318:4318" # OTLP HTTP
networks:
- nioflow-net
networks:
nioflow-net:
driver: bridge
volumes:
postgres_data: