-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.prod.yaml
executable file
·152 lines (139 loc) · 3.98 KB
/
docker-compose.prod.yaml
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
#배포용, for production
version: '3.8'
volumes:
mysql_data:
redisdata:
static_volume:
media_volume:
build_folder:
prometheus_data: {}
grafana_data: {}
services:
mysqldb:
build: ./backend/db
env_file:
- './backend/db/db.env'
ports:
- '3307:3306'
volumes:
- mysql_data:/var/lib/mysql
# healthcheck:
# test: ['CMD', 'curl', '-f', 'http://localhost:3306']
# interval: 10s
# timeout: 15s #체크하는데 15초 이상 걸리면 체크 실패했다고 판단
# retries: 5 #실패를 5번까지 체크해서 다 실패하면 unhealty판단
# start_period: 10s
backend:
build: ./backend/backend
command: >
bash -c "python wait_mysql.py &&
python manage.py makemigrations &&
python manage.py migrate &&
python manage.py loaddata fixture.json &&
gunicorn backend.wsgi --bind 0.0.0.0:8080" &&
ports:
- '8080:8080'
volumes:
- ./backend/backend:/app
depends_on:
- mysqldb
links:
- mysqldb
expose:
- 8080
redis:
container_name: redis_contain
image: redis:latest
hostname: redis
ports:
- '6379:6379'
volumes:
- 'redisdata:/data'
nginx:
build: ./nginx
ports:
- '80:3000'
volumes:
- build_folder:/var/www/frontend
- ./nginx/log:/var/log/nginx
depends_on:
- backend
- frontend
frontend:
container_name: client
build:
context: ./frontend
dockerfile: dockerfile.prod
volumes:
- ./frontend/:/frontend
- build_folder:/frontend/build
- ./frontend/node_modules/:/frontend/node_modules
tty: true
rabbitmq:
container_name: rabbitmq
image: rabbitmq:latest #아마 될거야
environment:
- RABBITMQ_USER=guest
- RABITMQ_PASSWORD=guset #막막하네
ports:
- '5672:5672' #rabbitMQ default port
- '15672:15672' #UI를 위한 port 이건 뭐지?
expose: #이건 뭐더라?
- '15672'
celery_worker:
container_name: celery_worker
build:
context: ./backend/backend
ports: []
depends_on:
- mysqldb
# condition: service_healthy
command: sh -c "celery -A backend worker --loglevel=info"
tty: true
restart: always
prometheus:
container_name: prometheus
image: prom/prometheus:latest
command:
- '--config.file=/etc/prometheus/prometheus.yml'
volumes:
- ./backend/prometheus:/etc/prometheus/
- ./backend/cprometheus.yml:/prometheus/prometheus.yml:ro
ports:
- 9090:9090
node-exporter:
container_name: node-exporter
image: prom/node-exporter
ports:
- 9100:9100
cadvisor: #docker health check 해보기, 컨테이너 순서를 보장
container_name: cadvisor
image: gcr.io/cadvisor/cadvisor:v0.46.0 #zcube/cadvisor
privileged: true
volumes: #빠진 volumes 찾아보기
- /var/run/docker.sock:/var/run/docker.sock:ro # 이 부분이 없으면 cadvisor에서 docker container를 잡지 못하는 것 같음.
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk/:/dev/disk:ro # cadvisor 배포 깃허브 페이지를 보고 추가
- /etc/machine-id:/etc/machine-id:ro # Failed to get system UUID: open /etc/machine-id: no such file or directory 해결책
ports:
- 8081:8080
devices:
- /dev/kmsg:/dev/kmsg
grafana:
container_name: grafana
image: grafana/grafana
environment:
GF_INSTALL_PLUGINS: 'grafana-clock-panel,grafana-simple-json-datasource'
GF_AUTH_ANONYMOUS_ENABLED: 'true'
GF_AUTH_ANONYMOUS_ORG_ROLE: 'Admin'
GF_AUTH_DISABLE_LOGIN_FORM: 'true'
volumes:
- grafana_data:/var/lib/grafana
- ./backend/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
- ./backend/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
ports:
- 3001:3000
restart: always