-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
134 lines (118 loc) · 2.84 KB
/
docker-compose.yml
File metadata and controls
134 lines (118 loc) · 2.84 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
133
version: '3.6'
services:
# RabbitMQ message queue service for Celery task broker
rabbitmq:
image: rabbitmq:3.10
container_name: ${COMPOSE_PROJECT_NAME}_rabbitmq
restart: always
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
ports:
- "127.0.0.1:5672:5672/tcp" # AMQP no TLS
networks:
- backend
# PostGIS server
postgres:
image: postgis/postgis:14-3.2
container_name: ${COMPOSE_PROJECT_NAME}_postgres
restart: always
environment:
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
PGUSER: ${DB_USER}
ports:
- "127.0.0.1:5432:5432/tcp"
shm_size: 8g
# Needed because the postgres container does not provide a healthcheck
healthcheck:
test: pg_isready
interval: 10s
timeout: 5s
retries: 5
volumes:
- postgresql:/var/lib/postgresql
networks:
- backend
# Celery container runs from the same image as the django container below
celery:
container_name: ${COMPOSE_PROJECT_NAME}_celery
build:
context: .
target: celery
restart: always
env_file:
- .env
depends_on:
- rabbitmq
volumes:
- uploads:/app/files/params/
networks:
- backend
# Handle scheduled tasks with Celery Beat
celery_beat:
build:
context: .
target: celery
restart: always
env_file:
- .env
command:
- "celery -A manyfews beat -l INFO --scheduler django_celery_beat.schedulers:DatabaseScheduler"
volumes:
- ./project/:/usr/src/app/
depends_on:
- rabbitmq
networks:
- backend
# Gunicorn container running Django app with uWSGI
#
# Run commands within the running container using:
# docker exec -it <container_id> /bin/bash
# Use `docker ps` to find the <container_id>
gunicorn:
container_name: ${COMPOSE_PROJECT_NAME}_gunicorn
build:
context: .
target: gunicorn
restart: always
env_file:
- .env
depends_on:
- postgres
- rabbitmq
- celery
volumes:
- uploads:/app/files/params/
networks:
- backend
# Web server container
web:
build:
context: .
target: web
container_name: ${COMPOSE_PROJECT_NAME}_nginx
restart: always
environment:
UPSTREAM_SERVER: "gunicorn"
UPSTREAM_PORT: "5000"
depends_on:
- gunicorn
networks:
- backend
- default
ports:
- "8000:80/tcp"
# Define networks and volumes
networks:
backend:
default:
volumes:
postgresql:
driver_opts:
type: none
device: ${PWD}/volumes/postgres
o: bind
uploads: