-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
241 lines (224 loc) · 6.05 KB
/
docker-compose.yaml
File metadata and controls
241 lines (224 loc) · 6.05 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
233
234
235
236
237
238
239
240
241
version: '3.8'
x-logging: &default-logging
driver: loki
options:
loki-url: 'http://localhost:3100/loki/api/v1/push'
loki-pipeline-stages: |
- multiline:
firstline: '^\d{4}-\d{2}-\d{2} \d{1,2}:\d{2}:\d{2}'
max_wait_time: 3s
- regex:
expression: '^(?P<time>\d{4}-\d{2}-\d{2} \d{1,2}:\d{2}:\d{2},\d{3}) (?P<message>(?s:.*))$$'
services:
app:
build:
context: .
dockerfile: Dockerfile # 이미 저장소 최상단에 있는 Dockerfile 재사용
container_name: artemia-backend # 로컬 개발 시 편의용
ports:
- "8000:8000" # FastAPI → Uvicorn 8000
env_file:
- .env # (선택) 로컬에서 바로 읽고 싶다면
restart: unless-stopped
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp
healthcheck: # FastAPI 헬스엔드포인트 (예: /health)
test: ["CMD-SHELL", "curl -f http://localhost:8000/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
deploy:
resources:
limits:
memory: 1G
cpus: '1.0'
reservations:
memory: 512M
cpus: '0.5'
logging: *default-logging
labels:
- "compose_service=app"
# app:
# build:
# context: ./app
# dockerfile: Dockerfile
# # -------- replace with comment to run with gunicorn --------
# command: python main.py
# # command: gunicorn app.main:app -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8000
# env_file:
# - ./app/.env
# # -------- replace with comment if you are using nginx --------
# ports:
# - "8000:8000"
# # expose:
# # - "8000"
# depends_on:
# - db
# - redis
# - loki
# volumes:
# - ./app:/code
# - ./app/.env:/code/.env
# environment:
# APP_NAME: "app"
# logging: *default-logging
# TODO requirements.txt arq 추가 필요
# worker:
# build:
# context: .
# dockerfile: Dockerfile
# command: arq app.core.worker.settings.WorkerSettings
# env_file:
# - ./app/.env
# depends_on:
# - db
# - redis
# - loki
# volumes:
# - ./app:/code
# - ./app/.env:/code/.env
# logging: *default-logging
db:
image: postgres:13
env_file:
- ./app/.env
volumes:
- postgres-data:/var/lib/postgresql/data
# -------- replace with comment to run migrations with docker --------
expose:
- "5432"
# ports:
# - 5432:5432
redis:
image: redis:alpine
volumes:
- redis-data:/data
expose:
- "6379"
#-------- uncomment to run with pgadmin --------
# pgadmin:
# container_name: pgadmin4
# image: dpage/pgadmin4:latest
# restart: always
# ports:
# - "5050:80"
# volumes:
# - pgadmin-data:/var/lib/pgadmin
# env_file:
# - ./src/.env
# depends_on:
# - db
#-------- uncomment to run with nginx --------
# nginx:
# image: nginx:latest
# ports:
# - "80:80"
# volumes:
# - ./default.conf:/etc/nginx/conf.d/default.conf
# depends_on:
# - web
#-------- uncomment to create first superuser --------
# create_superuser:
# build:
# context: .
# dockerfile: Dockerfile
# env_file:
# - ./src/.env
# depends_on:
# - db
# - web
# command: python -m src.scripts.create_first_superuser
# volumes:
# - ./src:/code/src
#-------- uncomment to create first tier --------
# create_tier:
# build:
# context: .
# dockerfile: Dockerfile
# env_file:
# - ./src/.env
# depends_on:
# - db
# - web
# command: python -m src.scripts.create_first_tier
# volumes:
# - ./src:/code/src
# Monitoring Services
loki:
image: grafana/loki:3.5.0
command: -config.file=/etc/loki/local-config.yaml
ports:
- "3100:3100"
# elasticsearch:
# image: docker.elastic.co/elasticsearch/elasticsearch:8.12.0
# environment:
# - discovery.type=single-node
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
# - xpack.security.enabled=false
# - cluster.name=${ELASTICSEARCH_CLUSTER_NAME:-elasticsearch-cluster}
# ports:
# - "9200:9200"
# - "9300:9300"
# volumes:
# - elasticsearch-data:/usr/share/elasticsearch/data
# logging: *default-logging
# elasticsearch-exporter:
# image: quay.io/prometheuscommunity/elasticsearch-exporter:latest
# command:
# - '--es.uri=http://elasticsearch:9200'
# - '--es.all'
# - '--es.indices'
# - '--es.indices_settings'
# - '--es.shards'
# - '--es.cluster_settings'
# ports:
# - "9114:9114"
# depends_on:
# - elasticsearch
# logging: *default-logging
prometheus:
image: prom/prometheus:v3.3.1
ports:
- "9090:9090"
volumes:
- ./monitoring/etc/prometheus:/workspace
command:
- --config.file=/workspace/prometheus.yml
- --enable-feature=exemplar-storage
depends_on:
- loki
logging: *default-logging
tempo:
image: grafana/tempo:2.7.2
command: [ "-config.file=/etc/tempo.yml", "--target=all", "--storage.trace.backend=local", "--storage.trace.local.path=/var/tempo", "--auth.enabled=false" ]
ports:
- "4317:4317"
- "4318:4318"
volumes:
- ./monitoring/etc/tempo/tempo.yml:/etc/tempo.yml
depends_on:
- loki
logging: *default-logging
grafana:
image: grafana/grafana:12.0.0
ports:
- "4000:4000"
environment:
- GF_SERVER_HTTP_PORT=4000
volumes:
- ./monitoring/etc/grafana/:/etc/grafana/provisioning/datasources
- ./monitoring/etc/dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml
- ./monitoring/etc/dashboards:/etc/grafana/dashboards
depends_on:
- loki
- prometheus
logging: *default-logging
volumes:
postgres-data:
redis-data:
# elasticsearch-data:
#pgladmin-data: