forked from Meet-the-past/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.prod.yml
117 lines (116 loc) · 2.64 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
#배포용, for production
version: "3"
services:
# db 컨테이너
db:
image: postgres:12.0-alpine
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
POSTGRES_USER: "eg_user"
POSTGRES_PASSWORD: "eg_pw"
POSTGRES_DB: "eg_db"
ports:
- 5432:5432
# Django 컨테이너
backend:
build:
context: ./backend
args:
DJANGO_ALLOWED_HOSTS: "*"
DJANGO_SECRET_KEY: "*"
DJANGO_CORS_ORIGIN_WHITELIST: "*"
command: gunicorn backend.wsgi --bind 0.0.0.0:8000
ports:
- 8000:8000
volumes:
- static_volume:/backend/staticfiles
- media_volume:/backend/mediafiles
- ./backend/:/backend/
expose:
- 8000
env_file:
- ./settings/prod/.env.prod
depends_on:
- db
frontend:
build:
context: ./frontend
args:
API_URL: "*"
stdin_open: true
tty: true #exit 0 Error
environment:
- REACT_APP_BACKEND_URL=http://localhost
volumes:
- ./frontend/:/frontend
- build_folder:/frontend/build
- ./frontend/node_modules/:/frontend/node_modules
rabbitmq:
container_name: rabbitmq
image: rabbitmq:3-management-alpine
environment:
- RABBITMQ_USER=guest
- RABBITMQ_PASSWORD=guest
ports:
- "5672:5672" #기본포트
- "15672:15672" # gui포트
expose:
- "15672"
celery_worker:
container_name: celery_worker
build:
context: ./backend
volumes:
- ./backend:/backend
ports: []
depends_on:
- rabbitmq
- redis
environment:
- C_FORCE_ROOT=true
env_file:
- ./settings/prod/.env.prod
command: sh -c "celery -A backend worker --loglevel=info"
redis:
container_name: redis
image: redis:latest
hostname: redis
ports:
- "6379:6379"
# nginx 컨테이너(서버)
nginx:
build: ./nginx
ports:
- 80:8080
volumes:
- static_volume:/backend/staticfiles
- media_volume:/backend/mediafiles
- build_folder:/var/www/frontend
depends_on:
- backend
- frontend
# 컨테이너 내려도 데이터 유지되도록 함
prometheus:
image: prom/prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- "--config.file=/etc/prometheus/prometheus.yml"
depends_on:
- backend
ports:
- "9090:9090"
grafana:
image: grafana/grafana:latest
ports:
- 3333:3000
volumes:
- ./datasource.yml:/etc/grafana/provisioning/datasource.yml
depends_on:
- prometheus
volumes:
postgres_data: null
static_volume: null
media_volume: null
build_folder: null