-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
232 lines (222 loc) · 5.27 KB
/
docker-compose.prod.yml
File metadata and controls
232 lines (222 loc) · 5.27 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
220
221
222
223
224
225
226
227
228
229
230
231
232
# Production environment with PostgreSQL 16 + Redis + resource limits
# Build info injected via VERSION/COMMIT/BUILD_TIME args -> Wire + ldflags
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
args:
VERSION: ${VERSION:-prod}
COMMIT: ${COMMIT:-none}
BUILD_TIME: ${BUILD_TIME:-unknown}
image: skeleton-api:${VERSION:-prod}
container_name: skeleton-api-prod
restart: unless-stopped
environment:
- APP_ENV=prod
- APP_PORT=8080
- DATABASE_URL=${DATABASE_URL}
- REDIS_URL=${REDIS_URL}
- AUTH_PRIVATE_KEY_PATH=/app/keys/private.pem
- AUTH_PUBLIC_KEY_PATH=/app/keys/public.pem
- AUTH_ACCESS_TTL_MINUTES=15
- AUTH_REFRESH_TTL_DAYS=7
- SESSION_TTL_MINUTES=60
- SESSION_COOKIE_NAME=session
- RATE_LIMIT_GLOBAL_LIMIT=${RATE_LIMIT_GLOBAL_LIMIT:-1000}
- RATE_LIMIT_GLOBAL_WINDOW=${RATE_LIMIT_GLOBAL_WINDOW:-60}
- CACHE_CLEANUP_INTERVAL=${CACHE_CLEANUP_INTERVAL:-300}
- CACHE_REDIS_PREFIX=${CACHE_REDIS_PREFIX:-skeleton:prod}
secrets:
- db_password
- redis_password
volumes:
- ./backend/keys:/app/keys:ro
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"]
interval: 30s
timeout: 3s
retries: 3
start_period: 15s
deploy:
resources:
limits:
cpus: '2'
memory: 512M
reservations:
cpus: '0.5'
memory: 256M
networks:
- skeleton_network
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
office:
build:
context: ./web/office
dockerfile: Dockerfile
image: skeleton-office:${VERSION:-prod}
container_name: skeleton-office-prod
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.5'
memory: 128M
networks:
- skeleton_network
logging:
driver: json-file
options:
max-size: "5m"
max-file: "3"
commerce:
build:
context: ./web/commerce
dockerfile: Dockerfile
image: skeleton-commerce:${VERSION:-prod}
container_name: skeleton-commerce-prod
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.5'
memory: 128M
networks:
- skeleton_network
logging:
driver: json-file
options:
max-size: "5m"
max-file: "3"
nginx:
image: nginx:alpine
container_name: skeleton-nginx-prod
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- backend
- office
- commerce
deploy:
resources:
limits:
cpus: '0.5'
memory: 128M
networks:
- skeleton_network
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
postgres:
image: postgres:16-alpine
container_name: skeleton-postgres-prod
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_prod_data:/var/lib/postgresql/data
- ./backend/migrations:/docker-entrypoint-initdb.d:ro
secrets:
- db_password
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: '4'
memory: 2G
reservations:
cpus: '1'
memory: 1G
networks:
- skeleton_network
logging:
driver: json-file
options:
max-size: "50m"
max-file: "5"
redis:
image: redis:7-alpine
container_name: skeleton-redis-prod
restart: unless-stopped
ports:
- "${REDIS_PORT:-6379}:6379"
command: >
redis-server
--appendonly yes
--maxmemory 1gb
--maxmemory-policy allkeys-lru
--save 900 1
--save 300 10
--save 60 10000
volumes:
- redis_prod_data:/data
secrets:
- redis_password
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
deploy:
resources:
limits:
cpus: '1'
memory: 1G
reservations:
cpus: '0.25'
memory: 512M
networks:
- skeleton_network
logging:
driver: json-file
options:
max-size: "20m"
max-file: "3"
redis-commander:
image: rediscommander/redis-commander:latest
container_name: skeleton-redis-commander-prod
ports:
- "8082:8081"
environment:
- REDIS_HOSTS=local:redis:6379
depends_on:
- redis
networks:
- skeleton_network
profiles:
- management
volumes:
postgres_prod_data:
driver: local
redis_prod_data:
driver: local
secrets:
db_password:
file: ./secrets/db_password.txt
redis_password:
file: ./secrets/redis_password.txt
networks:
skeleton_network:
driver: bridge