-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
142 lines (136 loc) · 3.88 KB
/
Copy pathdocker-compose.yml
File metadata and controls
142 lines (136 loc) · 3.88 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
# Production-like Compose stack.
#
# Usage:
# docker compose up -d # background
# docker compose logs -f # tail logs
# docker compose down # stop
# docker compose down -v # stop + remove volumes (drops DB)
#
# Override with docker-compose.dev.yml for hot-reload dev.
name: node-ts-starter
services:
node-api:
build:
context: .
dockerfile: services/node-api/Dockerfile
args:
NODE_VERSION: 22-alpine
image: node-ts-starter-node-api:latest
container_name: ntsa-node-api
restart: unless-stopped
environment:
NODE_ENV: production
PORT: 3000
LOG_LEVEL: ${LOG_LEVEL:-info}
# If DATABASE_URL is set in the shell or .env, Postgres is used.
# Otherwise SQLite at DATABASE_PATH (default below).
DATABASE_URL: ${DATABASE_URL:-}
DATABASE_PATH: ${DATABASE_PATH:-/data/users.db}
# Observability: when an OTel Collector / Tempo is reachable, send
# traces there (docker-compose.obs.yml sets this). Otherwise unset →
# SDK falls back to console exporter or disabled.
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-}
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-node-ts-starter-api}
OTEL_SDK_DISABLED: ${OTEL_SDK_DISABLED:-}
volumes:
- api-data:/data
ports:
- "${API_PORT:-3000}:3000"
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:3000/ready"]
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
deploy:
resources:
limits:
memory: 256M
cpus: "0.5"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
networks:
- app
spring-api:
build:
context: .
dockerfile: services/spring-api/Dockerfile
args:
JAVA_VERSION: "21"
image: node-ts-starter-spring-api:latest
container_name: ntsa-spring-api
restart: unless-stopped
environment:
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-prod}
# When DATABASE_URL is set, Spring uses Postgres (shared with node-api).
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL:-${DATABASE_URL:-}}
LOGGING_LEVEL_ROOT: ${LOGGING_LEVEL:-INFO}
# OTel: defaults to localhost (silent fail if no collector). The obs
# override (docker-compose.obs.yml) sets this to http://tempo:4318
# when the observability stack is up.
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-http://localhost:4318}
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME_SPRING:-node-ts-starter-spring-api}
OTEL_SDK_DISABLED: ${OTEL_SDK_DISABLED:-}
ports:
- "${SPRING_API_PORT:-8080}:8080"
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/actuator/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 30s
deploy:
resources:
limits:
memory: 512M
cpus: "1.0"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
networks:
- app
web:
build:
context: .
dockerfile: Dockerfile.web
args:
NODE_VERSION: 22-alpine
NGINX_VERSION: 1.27-alpine
image: node-ts-starter-web:latest
container_name: ntsa-web
restart: unless-stopped
depends_on:
node-api:
condition: service_healthy
ports:
- "${WEB_PORT:-8081}:80"
healthcheck:
test: ["CMD-SHELL", "wget --spider -q http://localhost:80/ || exit 1"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
deploy:
resources:
limits:
memory: 64M
cpus: "0.25"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
networks:
- app
volumes:
api-data:
name: ntsa-api-data
networks:
app:
name: ntsa-net
driver: bridge