-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
132 lines (120 loc) · 3.71 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
name: alert-hub # NOTE: Define COMPOSE_PROJECT_NAME in .env to use custom name
x-server: &base_server_setup
build:
context: ./backend/
# To attach to container with stdin `docker attach <container_name>`
# Used for python debugging.
stdin_open: true
tty: true
extra_hosts:
- 'host.docker.internal:host-gateway'
env_file:
- .env
environment: &base_server_setup_environment
DJANGO_APP_ENVIRONMENT: ${DJANGO_APP_ENVIRONMENT:-development}
DJANGO_APP_TYPE: web
DJANGO_DEBUG: ${DJANGO_DEBUG:-true}
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY?error},
# -- Domain configurations
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS:-*}
APP_DOMAIN: localhost:8000
APP_HTTP_PROTOCOL: ${APP_HTTP_PROTOCOL:-http}
APP_FRONTEND_HOST: ${APP_FRONTEND_HOST:-http://localhost:3000}
SESSION_COOKIE_DOMAIN: ${SESSION_COOKIE_DOMAIN:-localhost}
CSRF_COOKIE_DOMAIN: ${CSRF_COOKIE_DOMAIN:-localhost}
# Database config
DB_HOST: ${DB_HOST:-db}
DB_PORT: ${DB_PORT:-5432}
DB_NAME: ${DB_NAME:-postgres}
DB_USER: ${DB_USER:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-postgres}
# Redis config
CELERY_BROKER_URL: ${CELERY_BROKER_URL:-redis://redis:6379/0}
CACHE_REDIS_URL: ${CACHE_REDIS_URL:-redis://redis:6379/1}
TEST_CACHE_REDIS_URL: ${TEST_CACHE_REDIS_URL:-redis://redis:6379/11}
# Email config
EMAIL_HOST: ${EMAIL_HOST:-mailpit}
EMAIL_PORT: ${EMAIL_PORT:-1025}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-mailpit}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD:-mailpit}
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-alert-hub-dev <info@alert-hub.ifrc.org>}
# Misc
HCAPTCHA_SECRET: ${HCAPTCHA_SECRET:-0x0000000000000000000000000000000000000000}
HCAPTCHA_SITEKEY: ${HCAPTCHA_SITEKEY:-10000000-ffff-ffff-ffff-000000000001}
volumes:
- ./backend/:/code
- backend_data:/data/
- ipython_data_local:/root/.ipython/profile_default # persist ipython data, including ipython history
depends_on:
- db
- redis
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
x-worker: &base_worker_setup
<<: *base_server_setup
environment:
<<: *base_server_setup_environment
DJANGO_APP_TYPE: worker
healthcheck:
test: ["CMD-SHELL", "celery -A main inspect ping -d celery@$$HOSTNAME || exit 1"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
services:
db:
image: postgis/postgis:13-3.1-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- postgres-data13:/var/lib/postgresql/data
# ports:
# - 127.0.0.1:50432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:6-alpine
volumes:
- redis-data:/data
healthcheck:
test: ["CMD-SHELL", "redis-cli ping"]
interval: 10s
timeout: 5s
retries: 5
mailpit:
image: axllent/mailpit
ports:
- 127.0.0.1:8025:8025 # HTTP
environment:
MP_MAX_MESSAGES: 5000
MP_DATA_FILE: /data/mailpit.db
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
volumes:
- mailpit-data:/data
web:
<<: *base_server_setup
command: bash -c 'wait-for-it $$DB_HOST:$$DB_PORT && ./manage.py runserver 0.0.0.0:8000'
ports:
- 127.0.0.1:8000:8000
worker:
<<: *base_worker_setup
# TODO: Use run_celery_dev
command: bash -c 'celery -A main worker -l info --pool=solo'
worker-beat:
<<: *base_worker_setup
command: bash -c 'celery -A main beat -l info'
volumes:
postgres-data13:
redis-data:
ipython_data_local:
mailpit-data:
backend_data: