-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (77 loc) · 2.54 KB
/
docker-compose.yml
File metadata and controls
82 lines (77 loc) · 2.54 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
services:
web:
# web is a copy of the current Dockerfile.
extends:
file: docker-compose.project.yml
service: djocker
hostname: web
environment:
CELERY_BROKER: "amqp://djocker:djocker@broker:5672"
CELERY_BACKEND: "redis://resultbackend:6379"
DJANGO_SECRET_KEY: "2086830a-516b-48a4-9011-03999e8233d9@bb714614-7dcf-47d8-8e61-b2aa85a8e139"
PG_DATABASE_HOST: db
PG_DATABASE_PORT: 5432
PG_DATABASE_USER: postgres
PG_DATABASE_PASS: s3cret
PG_DATABASE_DB: postgres
command: "./manage.py runserver 0.0.0.0:8000"
# From the container perspective it is outside:inside
ports:
# Access the web-interface at port 8001 on your host.
- 8001:8000
depends_on:
- resultbackend
- broker
background:
# background should have the same capabilities as web in this project. The difference
# is the time and place where the code runs.
extends:
file: docker-compose.project.yml
service: djocker
hostname: background
environment:
# Make sure, at one way or another, that the environment is the same here as at the
# web container where it is about settings.
CELERY_BROKER: "amqp://djocker:djocker@broker:5672"
CELERY_BACKEND: "redis://resultbackend:6379"
DJANGO_SECRET_KEY: "django-insecure-4-owxu9ye=jy30y0qc3cv4u#mmkt3acupfy5j*%(zfar)&dd"
PG_DATABASE_HOST: db
PG_DATABASE_PORT: 5432
PG_DATABASE_USER: postgres
PG_DATABASE_PASS: s3cret
PG_DATABASE_DB: postgres
# Run celery instead of "manage.py runserver".
# The confusing part is the --app variable. You also defined the app in the library root
# above the djocker.settings. Not yet figured out why.
command: "celery --app=djocker.celery worker --loglevel=info --logfile=/var/log/project/celery.log"
depends_on:
- resultbackend
- broker
db:
image: postgres:14.2
hostname: db
restart: always
environment:
POSTGRES_PASSWORD: s3cret
volumes:
- db-storage:/var/lib/postgresql/data
ports:
# Access the database via port 8002 on your host.
- 8002:5432
resultbackend:
image: redis:6.2.6-alpine
restart: always
hostname: resultbackend
broker:
image: rabbitmq:3.9.14-management-alpine
hostname: broker
restart: always
environment:
HOSTNAME: broker
RABBITMQ_DEFAULT_USER: djocker
RABBITMQ_DEFAULT_PASS: djocker
ports:
# Access the management interface at port 8003 on your host.
- 8003:15672
volumes:
db-storage: