-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdocker-compose-prod.yml
234 lines (225 loc) · 5.24 KB
/
docker-compose-prod.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
x-build-args: &build-args
DOCKER_BUILDKIT: 1
GO_VERSION: 1.23
ALPINE_VERSION: latest
name: trenova-prod
services:
tren-db:
container_name: tren-db
image: postgres:latest
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
POSTGRES_USER: ${DB_USER:-postgres}
POSTGRES_DB: ${DB_NAME:-postgres}
POSTGRES_MULTIPLE_EXTENSIONS: "pg_stat_statements,pg_buffercache"
POSTGRES_INITDB_ARGS: "--data-checksums"
command:
- "postgres"
- "-c"
- "wal_level=logical"
- "-c"
- "shared_preload_libraries=pg_stat_statements,pg_buffercache"
- "-c"
- "pg_stat_statements.track=all"
- "-c"
- "max_replication_slots=1"
- "-c"
- "max_connections=100"
- "-c"
- "shared_buffers=128MB" # 25% of container memory
- "-c"
- "effective_cache_size=384MB" # 75% of container memory
- "-c"
- "maintenance_work_mem=64MB"
- "-c"
- "checkpoint_completion_target=0.9"
- "-c"
- "random_page_cost=1.1"
- "-c"
- "effective_io_concurrency=200"
- "-c"
- "work_mem=4MB"
- "-c"
- "min_wal_size=1GB"
- "-c"
- "max_wal_size=4GB"
restart: unless-stopped
volumes:
- pg_data:/var/lib/postgresql/data
deploy:
resources:
limits:
memory: 512M
cpus: "1"
reservations:
memory: 256M
networks:
- app-network
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-postgres}",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s # Allow time for initial startup
tren-search:
container_name: tren-search
image: getmeili/meilisearch:v1.11.3
ports:
- "7700:7700"
environment:
- MEILI_MASTER_KEY=${MEILI_MASTER_KEY:-masterKey}
- MEILI_NO_ANALYTICS=${MEILI_NO_ANALYTICS:-true}
- MEILI_DB_PATH=${MEILI_DB_PATH:-/data.ms}
- MEILI_ENV=${MEILI_ENV:-development}
restart: always
networks:
- app-network
volumes:
- meilisearch_data:/data.ms
deploy:
resources:
limits:
memory: 512M
healthcheck:
test: set -o pipefail;curl -fsS http://localhost:7700/health | grep -q '{"status":"available"}'
retries: 3
timeout: 5s
tren-redis:
container_name: tren-redis
image: redis/redis-stack:latest
ports:
- "6379:6379"
environment:
- ALLOW_EMPTY_PASSWORD=yes
restart: always
volumes:
- redis_data:/data
networks:
- app-network
deploy:
resources:
limits:
memory: 1G
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
tren-minio:
container_name: tren-minio
image: quay.io/minio/minio
command: server /data --console-address ":9001"
environment:
- MINIO_ROOT_USER=${MINIO_ROOT_USER:-minioadmin}
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-minioadmin}
volumes:
- minio_data:/data
ports:
- 9000:9000 # API
- 9001:9001 # Console
restart: always
networks:
- app-network
deploy:
resources:
limits:
memory: 512M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
tren-api:
container_name: tren-api
build:
context: .
dockerfile: Dockerfile
args:
<<: *build-args
ports:
- "3001:3001"
environment:
- TRENOVA_APP_ENVIRONMENT=production
- TRENOVA_SERVER_SECRET_KEY=${SERVER_SECRET_KEY:-secretKey}
depends_on:
tren-db:
condition: service_healthy
tren-redis:
condition: service_healthy
tren-search:
condition: service_healthy
tren-minio:
condition: service_healthy
networks:
- app-network
deploy:
resources:
limits:
memory: 512M
cpus: "1"
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
restart: unless-stopped
tren-client:
container_name: tren-client
build:
context: ./ui
dockerfile: Dockerfile
ports:
- "5173:5173"
networks:
- app-network
depends_on:
- tren-api
environment:
- VITE_API_URL=https://trenova.local/api/v1
restart: unless-stopped
deploy:
resources:
limits:
memory: 256M
cpus: "0.5"
tren-caddy:
container_name: tren-caddy
build:
context: .
dockerfile: Dockerfile.caddy
ports:
- "80:80"
- "443:443"
volumes:
- caddy_data:/data
- caddy_config:/config
- ./logs/caddy:/var/log/caddy
environment:
- ACME_AGREE=true
networks:
- app-network
depends_on:
- tren-api
restart: unless-stopped
deploy:
resources:
limits:
memory: 128M
cpus: "0.5"
volumes:
pg_data: {}
redis_data: {}
minio_data: {}
meilisearch_data: {}
caddy_data: {}
caddy_config: {}
networks:
app-network:
driver: bridge