-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdocker-compose.prod.yml
205 lines (188 loc) ยท 5.25 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
# ๋์ปคํ์ผ์ ๋น๋ํ ๋ ๋ฐ์
# ๋์ปค์ปดํฌ์ฆ๋ ์
ํ ๋ ๋ฐ์
version: "3"
services:
frontend:
build: ./frontend
command: ["npm", "start"]
container_name: frontend
ports:
- 3000:3000
volumes:
- ./frontend:/frontend
- build_folder:/frontend/build
- ./frontend/node_modules/:/frontend/node_modules
environment:
- CI=true
- CHOKIDAR_USEPOLLING=true # HMR์ ์ํด ํ์ํ ์ค์
- REACT_APP_BACKEND_URL=http://localhost:8000
stdin_open: true # react-script 3.4.1 ๋ถํฐ ํ์
tty: true
# ๊ฐ์ ๋คํธ์ํฌ ์ฐ๊ฒฐ
networks:
- photoon
backend:
container_name: backend
build:
# context : ํ์ฌ ํด๋์ backend ํด๋์ ์๋ ๋์ปคํ์ผ์ ์ฐ๊ฒ ๋ค.
context: ./backend
args:
DJANGO_ALLOWED_HOSTS: "*"
DJANGO_SECRET_KEY: "*"
DJANGO_CORS_ORIGIN_WHITELIST: "*"
# command : ์ปจํ
์ด๋๊ฐ ๋์์ง ๋ ์คํํ๋ ๋ช
๋ น์ด / ์๋ฒ์คํ
command: gunicorn config.wsgi --preload --bind 0.0.0.0:8000 --timeout 240
# ai_init.py, makemigrations, migrate ๋ฐ๋ก ํด์ผํจ
# restart : ์คํจํ๋ฉด ์ฌ์์
restart: on-failure
ports:
# ์ผ์ชฝ์ด ๋์ปค ๋ฐ๊นฅ(์ธ๋ถ์์ ์ ๊ทผํ ํฌํธ๋ฒํธ) / ์ค๋ฅธ์ชฝ์ด ๋์ปค ๋ด๋ถ(์ปจํ
์ด๋ ๋ด๋ถ)
- 8000:8000
volumes:
# ์ผ์ชฝ์ด ์ฐ๋ฆฌ ์ปดํจํฐ, ์ค๋ฅธ์ชฝ์ด ๋์ปค ์ปจํ
์ด๋
# ๋ฆฌ๋
์ค ์ปจํ
์ด๋์ ๋ฐฑ์๋ ํด๋์ ์ฐ๋ฆฌ ์ปดํจํฐ์ ๋ฐฑ์๋ ํด๋๋ฅผ ๊ณต์ ํ๊ฒ ๋ค.
# ์๋ก ๋ฐ๋ ๋ถ๋ถ ์ ์ฉ๋จ
- ./backend:/backend
- static_volume:/backend/staticfiles
depends_on:
- mysql
expose:
- 8000
# ๊ฐ์ ๋คํธ์ํฌ ์ฐ๊ฒฐ
networks:
- photoon
# mysql:
# image: mysql
# command: --lower_case_table_names=1
# container_name: mysql # ์ปจํ
์ด๋ ์ด๋ฆ ์ค์
# ports:
# - "3306:3306"
# env_file:
# - ./backend/.env
# # environment: # -e ์ต์
# # - MYSQL_DATABASE=${MYSQL_DATABASE}
# # # - MYSQL_USER=${MYSQL_USER}
# # - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} # MYSQL ํจ์ค์๋ ์ค์ ์ต์
# # - TZ=${TZ}
# # ๊ฐ์ ๋คํธ์ํฌ ์ฐ๊ฒฐ
# networks:
# - photoon
rabbitmq:
hostname: photoon_host
container_name: rabbitmq
image: rabbitmq:3-management
command: rabbitmq-server
restart: unless-stopped
env_file:
- ./.env
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_USER}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
- RABBITMQ_DEFAULT_VHOST=${RABBITMQ_VHOST}
ports:
- 5672:5672 # Default Port
- 15672:15672 # For UI
volumes:
- ./backend:/backend
networks:
- photoon
depends_on:
- backend
expose:
- "15672"
celery:
container_name: celery
build:
context: ./backend
restart: unless-stopped
# env_file:
# - ./.env
depends_on:
- backend
- rabbitmq
volumes:
- ./backend:/backend
networks:
- photoon
command: "celery -A config.celery worker --loglevel=info --pool=solo"
nginx:
build: ./nginx
container_name: nginx
ports:
- 80:8080
restart: unless-stopped
volumes:
- static_volume:/backend/staticfiles
- media_volume:/backend/mediafiles
- build_folder:/var/www/frontend
depends_on:
- backend
# ๊ฐ์ ๋คํธ์ํฌ ์ฐ๊ฒฐ
networks:
- photoon
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
container_name: prometheus
ports:
- 9090:9090
# ๊ฐ์ ๋คํธ์ํฌ ์ฐ๊ฒฐ
networks:
- photoon
grafana:
image: grafana/grafana
container_name: grafana
volumes:
- grafana_data:/var/lib/grafana
- ./grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
- ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
ports:
- 3001:3000
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
depends_on:
- prometheus
# ๊ฐ์ ๋คํธ์ํฌ ์ฐ๊ฒฐ
expose:
- 3001
networks:
- photoon
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.45.0
container_name: cadvisor
privileged: true
devices:
- /dev/kmsg:/dev/kmsg
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker:/var/lib/docker:ro
- /etc/machine-id:/etc/machine-id:ro
- /var/lib/dbus/machine-id:/var/lib/dbus/machine-id:ro
#- /cgroup:/cgroup:ro #doesn't work on MacOS only for Linux
restart: unless-stopped
expose:
- 8080
networks:
- photoon
networks:
photoon:
driver: bridge
volumes:
static_volume: null
media_volume: null
build_folder: null
prometheus_data: {}
grafana_data: {}