-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
134 lines (125 loc) · 3.37 KB
/
Copy pathdocker-compose.yml
File metadata and controls
134 lines (125 loc) · 3.37 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
services:
# This is the Nginx container that acts as a reverse proxy
nginx:
container_name: kf_nginx
image: kartflip/nginx
build:
context: .
dockerfile: _containers/nginx/Dockerfile.nginx
depends_on:
- daphne
volumes:
- ./_containers/nginx/conf.d:/etc/nginx/conf.d
- ./app/staticfiles:/app/staticfiles
- ./app/mediafiles:/app/mediafiles
ports:
- "9000:8080"
networks:
- frontend_network
restart: on-failure:3
# This is the Daphne server which serves our Django application using ASGI (async & websockets)
daphne:
container_name: kf_daphne
image: kartflip/daphne
build:
context: .
dockerfile: _containers/django/Dockerfile.django_daphne
depends_on:
- postgresql
volumes:
- ./app:/app
env_file:
- ./_containers/django/.env_django
networks:
- frontend_network
- backend_network
restart: on-failure:3
secrets:
- postgresql_db
- postgresql_user
- postgresql_password
- django_secretkey
- redis_tasks_password
# This is our PostgreSQL container that acts as our primary data store aka Database
postgresql:
container_name: kf_postgresql
image: kartflip/postgresql
build:
context: .
dockerfile: _containers/postgresql/Dockerfile.postgresql
volumes:
- KF_postgresql_data:/var/lib/postgresql/data
- ./_containers/postgresql/init_scripts:/docker-entrypoint-initdb.d
environment:
POSTGRES_DB_FILE: /run/secrets/postgresql_db
POSTGRES_USER_FILE: /run/secrets/postgresql_user
POSTGRES_PASSWORD_FILE: /run/secrets/postgresql_password
networks:
- backend_network
restart: on-failure:3
secrets:
- postgresql_db
- postgresql_user
- postgresql_password
# This is the Celery worker & scheduler container for handling tasks
celery_tasks:
container_name: kf_celery_tasks
image: kartflip/celery_tasks
build:
context: .
dockerfile: _containers/tasks/Dockerfile.celery_tasks
depends_on:
- postgresql
- redis_tasks
volumes:
- ./app:/app
env_file:
- ./_containers/django/.env_django
- ./_containers/tasks/.env_redis_tasks
networks:
- backend_network
- tasks_network
restart: on-failure:3
secrets:
- postgresql_db
- postgresql_user
- postgresql_password
- django_secretkey
- redis_tasks_password
# This is our Redis container that acts as a message broker for Celery tasks
redis_tasks:
container_name: kf_redis_tasks
image: kartflip/redis_tasks
build:
context: .
dockerfile: _containers/tasks/Dockerfile.redis_tasks
volumes:
- KF_redis_tasks_data:/data
networks:
- tasks_network
restart: on-failure:3
secrets:
- redis_tasks_password
volumes:
KF_postgresql_data:
external: true
KF_redis_tasks_data:
external: true
networks:
frontend_network:
driver: bridge
backend_network:
driver: bridge
tasks_network:
driver: bridge
secrets:
postgresql_db:
file: ./_secrets/postgresql_db_v1.txt
postgresql_user:
file: ./_secrets/postgresql_user_v1.txt
postgresql_password:
file: ./_secrets/postgresql_password_v1.txt
django_secretkey:
file: ./_secrets/django_secretkey_v1.txt
redis_tasks_password:
file: ./_secrets/redis_tasks_password_v1.txt