-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
189 lines (142 loc) · 4.2 KB
/
docker-compose.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
version: "3.2"
services:
# Create a composed Django-Postgres-NGINX instance
db:
# a custom image for django
build: ./postgres
# Set db environment
environment:
# these passwords will be taken from .env file (not tracked in GIT)
PGPASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
IMAGE_USER: ${IMAGE_USER}
IMAGE_PASSWORD: ${IMAGE_PASSWORD}
CRYOWEB_INSERT_ONLY_PW: ${CRYOWEB_INSERT_ONLY_PW}
# to export volume, as recommeded in https://registry.hub.docker.com/u/library/mysql/
volumes:
- type: bind
source: ./postgres-data/
target: /var/lib/postgresql/data
# all scripts and sql file inside this directory will be executed after database initialization
- type: bind
source: ./postgres/docker-entrypoint-initdb.d/
target: /docker-entrypoint-initdb.d/
ports:
- "25432:5432"
redis:
# a custom redis image
build: ./redis
volumes:
- type: volume
source: redis-data
target: /data
uwsgi:
# a custom image for django
build: ./uwsgi
# You can pass multiple environment variables from an external file through
# to a service’s containers with the ‘env_file’ option
env_file:
- .env
# exec a different command from image
command: uwsgi --ini /var/uwsgi/image_uwsgi.ini --memory-report
# set working dir for uwsgi
working_dir: /var/uwsgi/image/
# define volumes
volumes:
- type: bind
source: ./django-data/
target: /var/uwsgi/
- type: bind
source: ./.git/
target: /var/uwsgi/.git/
read_only: true
# Expose the default port
# link container to database
links:
- db
- redis
- asgi
asgi:
# a custom image for django
build: ./uwsgi
# You can pass multiple environment variables from an external file through
# to a service’s containers with the ‘env_file’ option
env_file:
- .env
# exec a different command from image
command: daphne -b 0.0.0.0 -p 8001 --proxy-headers --verbosity 2 image.asgi:application
# set working dir for uwsgi
working_dir: /var/uwsgi/image/
# define volumes
volumes:
- type: bind
source: ./django-data/
target: /var/uwsgi/
# expose a port outside for websocket connections
ports:
- "28001:8001"
# link container to database
links:
- db
- redis
celery-worker:
# the same django image of uwsgi
build: ./uwsgi
# You can pass multiple environment variables from an external file through
# to a service’s containers with the ‘env_file’ option
env_file:
- .env
# exec a different command uwsgi
command: celery -A image worker -l info -E --uid www-data --max-tasks-per-child 100 --max-memory-per-child 512000 --autoscale=4,2 --pidfile /var/run/celery/celery.pid
# set working dir for uwsgi
working_dir: /var/uwsgi/image/
# define volumes
volumes:
- type: bind
source: ./django-data/
target: /var/uwsgi/
# Expose the default port
# link container to database
links:
- db
- redis
celery-beat:
# the same django image of uwsgi
build: ./uwsgi
# You can pass multiple environment variables from an external file through
# to a service’s containers with the ‘env_file’ option
env_file:
- .env
command: celery -A image beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler --pidfile /var/run/celery/celerybeat.pid
# set working dir for uwsgi
working_dir: /var/uwsgi/image/
# define volumes
volumes:
- type: bind
source: ./django-data/
target: /var/uwsgi/
# Expose the default port
# link container to database
links:
- db
- redis
nginx:
# a custom image for NGINX
build: ./nginx
volumes:
- type: bind
source: ./nginx/conf.d/
target: /etc/nginx/conf.d/
- type: bind
source: ./django-data/
target: /var/uwsgi/
ports:
- "26080:80"
# link container uwsgi
links:
- uwsgi
- asgi
volumes:
redis-data:
networks:
default: