-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
194 lines (183 loc) · 4.67 KB
/
docker-compose.yml
File metadata and controls
194 lines (183 loc) · 4.67 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
# © 2026 月球厨师莱恩 (TPMOONCHEFRYAN) – PolyForm Noncommercial License
# TCRN TMS Docker Compose - Local Development Environment
# PRD §4.4: 双网络隔离架构
version: '3.8'
networks:
# Main application network
app-network:
driver: bridge
services:
# =============================================================================
# Main Application Services
# =============================================================================
# PostgreSQL 16 - Main Database
postgres:
image: postgres:16-alpine
container_name: tcrn-postgres
restart: always
networks:
- app-network
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: ${POSTGRES_USER:-tcrn}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
POSTGRES_DB: ${POSTGRES_DB:-tcrn_tms}
ports:
- '5432:5432'
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-tcrn} -d ${POSTGRES_DB:-tcrn_tms}']
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
# Redis 7 - Cache & Queue
redis:
image: redis:7-alpine
container_name: tcrn-redis
restart: always
networks:
- app-network
volumes:
- redis-data:/data
ports:
- '6379:6379'
command: redis-server --appendonly yes
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.25'
memory: 256M
# MinIO - Object Storage
minio:
image: minio/minio:latest
container_name: tcrn-minio
restart: always
networks:
- app-network
volumes:
- minio-data:/data
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?MINIO_ROOT_PASSWORD is required}
ports:
- '9000:9000'
- '9001:9001'
command: server /data --console-address ":9001"
healthcheck:
test: ['CMD', 'mc', 'ready', 'local']
interval: 30s
timeout: 20s
retries: 3
deploy:
resources:
limits:
cpus: '0.25'
memory: 512M
# NATS JetStream - Event Bus
nats:
image: nats:2-alpine
container_name: tcrn-nats
restart: always
networks:
- app-network
ports:
- '4222:4222'
- '8222:8222'
command: ['--jetstream', '--store_dir=/data', '-m', '8222']
volumes:
- nats-data:/data
healthcheck:
test: ['CMD', 'nats-server', '--help']
interval: 30s
timeout: 10s
retries: 3
deploy:
resources:
limits:
cpus: '0.25'
memory: 128M
# =============================================================================
# Observability Services (PRD §15)
# Opt in with: docker compose --profile observability up -d loki tempo
# =============================================================================
# Grafana Loki - Log Aggregation
loki:
image: grafana/loki:2.9.0
container_name: tcrn-loki
restart: always
profiles:
- observability
networks:
- app-network
ports:
- '3100:3100'
volumes:
- loki-data:/loki
- ./infra/loki/loki-local.yaml:/etc/loki/local-config.yaml
command: -config.file=/etc/loki/local-config.yaml
healthcheck:
test: ['CMD-SHELL', 'wget -q --spider http://localhost:3100/ready || exit 1']
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.25'
memory: 256M
# Grafana Tempo - Distributed Tracing (PRD P-32)
tempo:
image: grafana/tempo:2.3.0
container_name: tcrn-tempo
restart: always
profiles:
- observability
networks:
- app-network
ports:
- '3200:3200' # Tempo API
- '4317:4317' # OTLP gRPC
- '4318:4318' # OTLP HTTP
volumes:
- tempo-data:/tmp/tempo
- ./infra/tempo/tempo.yaml:/etc/tempo/tempo.yaml
command: -config.file=/etc/tempo/tempo.yaml
healthcheck:
test: ['CMD-SHELL', 'wget -q --spider http://localhost:3200/ready || exit 1']
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '0.25'
memory: 512M
volumes:
postgres-data:
name: tcrn-postgres-data
redis-data:
name: tcrn-redis-data
minio-data:
name: tcrn-minio-data
nats-data:
name: tcrn-nats-data
loki-data:
name: tcrn-loki-data
tempo-data:
name: tcrn-tempo-data
caddy-data:
name: tcrn-caddy-data
caddy-config:
name: tcrn-caddy-config
caddy-logs:
name: tcrn-caddy-logs