-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.prod.yml
240 lines (226 loc) · 5.86 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
235
236
237
238
239
240
version: "3"
volumes:
prometheus_data: {}
grafana_data: {}
build_folder: null
services:
db:
image: mysql:8.0
container_name: db
ports:
- 3306:3306 # HOST:CONTAINER
restart: always
environment:
MYSQL_ROOT_PASSWORD: "1234"
MYSQL_DATABASE: "mysql-db"
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
volumes:
- ./mysql-db:/var/lib/mysql #이거?
backend:
container_name: backend
build:
context: ./backend
args:
DJANGO_ALLOWED_HOSTS: "*"
DJANGO_SECRET_KEY: "*"
DJANGO_CORS_ORIGIN_WHITELIST: "*"
image: ${DOCKER_REGISTRY}/backend:latest
command: >
sh -c "python wait_for_mysql.py &&
python manage.py makemigrations hey_apple_app &&
python manage.py migrate hey_apple_app &&
gunicorn backend.wsgi:application --bind 0.0.0.0:8000"
# 나중에 배포 시 /etc/systemd/system/gunicorn.service 파일 생성
ports:
- 8000:8000
volumes:
- ./backend/:/backend/
expose:
- 8000
depends_on:
elasticsearch:
condition: service_healthy
environment:
- TZ=Asia/Seoul
redis:
image: redis:latest
command: redis-server --port 6379
container_name: "redis_server"
environment:
- REDIS_PASSWORD=1234
- REDIS_HOST=redis
labels:
- "name=redis"
- "mode=standalone"
volumes:
- ./backend/redis:/redis
ports:
- 6379:6379
crawling:
build: ./crawling
image: ${DOCKER_REGISTRY}/crawling:latest
shm_size: 2gb
user: root
command: >
sh -c "
python3 elastic.py &&
python3 scheduler.py
"
# command: >
# sh -c "python3 pymongo_tut.py"
environment:
- TZ=Asia/Seoul
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
tty: true
depends_on:
elasticsearch:
condition: service_healthy
nginx:
container_name: nginx
build:
context: "./nginx"
image: ${DOCKER_REGISTRY}/nginx:latest
ports:
- 80:80 # [호스트 포트]:[컨테이너 포트]
volumes:
- build_folder:/var/www/frontend
depends_on:
- backend
# - frontend
celery_worker:
container_name: celery_worker
image: ${DOCKER_REGISTRY}/backend:latest
volumes:
- ./backend:/backend
ports: []
depends_on:
- rabbitmq
- backend
environment:
- C_FORCE_ROOT=true
command: sh -c "celery -A backend worker --loglevel=info"
rabbitmq:
container_name: rabbitmq
image: rabbitmq:3-management-alpine
environment:
- RABBITMQ_USER=admin
- RABBITMQ_PASSWORD=admin
ports:
- "5672:5672" # Default Port
- "15672:15672" # UI Port
expose:
- "15672"
prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- 9090:9090
command:
- --config.file=/etc/prometheus/prometheus.yml
volumes:
- ./monitor/prometheus.yml:/etc/prometheus/prometheus.yml:ro
depends_on:
- cadvisor
node-exporter:
image: prom/node-exporter:latest
container_name: node_exporter
restart: unless-stopped
expose:
- 9100
ports:
- 9100:9100
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.47.0
container_name: cadvisor
ports:
- 8080:8080
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /etc/machine-id:/etc/machine-id:ro
privileged: true
grafana:
image: grafana/grafana:latest
container_name: grafana
user: root
restart: unless-stopped
links:
- prometheus:prometheus
ports:
- 3000:3000
volumes:
- ./monitor/data/grafana:/var/lib/grafana
environment:
- GF_SECURITY_ADMIN_PASSWORD=myadmin
- GF_USERS_ALLOW_SIGN_UP=false
alertmanager:
container_name: alertmanager
image: prom/alertmanager
ports:
- "9093:9093"
volumes:
- ./monitor/alertmanager/:/etc/alertmanager/
restart: always
command:
- "--config.file=/etc/alertmanager/config.yml"
- "--storage.path=/alertmanager"
influxdb:
image: bitnami/influxdb:1.8.5
container_name: influxdb
ports:
- "8086:8086"
- "8085:8088"
environment:
- INFLUXDB_ADMIN_USER_PASSWORD=bitnami123
- INFLUXDB_ADMIN_USER_TOKEN=admintoken123
- INFLUXDB_HTTP_AUTH_ENABLED=false
- INFLUXDB_DB=heyAppleDB
elasticsearch:
container_name: elasticsearch
build:
context: elasticsearch/
image: ${DOCKER_REGISTRY}/elasticsearch:latest
volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
# - ./elasticsearch:/usr/share/elasticsearch/data
ports:
- "9200:9200"
- "9300:9300"
environment:
ES_JAVA_OPTS: "-Xmx512m -Xms512m" # 자바 메모리
# ELASTIC_PASSWORD: heyapple123
healthcheck:
test: curl --silent http://elasticsearch:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi
interval: 30s
timeout: 10s
retries: 5
kibana:
container_name: kibana
build:
context: kibana/
image: ${DOCKER_REGISTRY}/kibana:latest
volumes:
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro,z
ports:
- "5601:5601"
environment:
ELASTICSEARCH_URL: http://elasticsearch:9200
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
depends_on:
elasticsearch:
condition: service_healthy
# frontend:
# build:
# context: ./frontend/hey-apple
# image: ${DOCKER_REGISTRY}/frontend:latest
# volumes:
# - ./frontend/hey-apple/:/frontend
# - build_folder:/frontend/build
# - ./frontend/node_modules/:/frontend/node_modules
# tty: true