forked from buildingSMART/validate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.load_balanced.yml
140 lines (134 loc) · 4.89 KB
/
docker-compose.load_balanced.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
services:
# Frontend - React + nginx + Certbot
frontend:
image: buildingsmart/validationsvc-frontend:${VERSION}
build:
context: .
dockerfile: ./docker/frontend/Dockerfile
target: run
restart: unless-stopped
container_name: frontend
ports:
- 80:80
- 443:443
environment:
CERTBOT_DOMAIN: ${CERTBOT_DOMAIN}
CERTBOT_EMAIL: ${CERTBOT_EMAIL}
volumes:
- ./docker/frontend/letsencrypt:/etc/letsencrypt
- static_data:/app/backend/django_static
depends_on:
- backend
# Backend - Django (x2)
backend:
image: buildingsmart/validationsvc-backend:${VERSION}
build:
context: .
dockerfile: ./docker/backend/Dockerfile
target: run
entrypoint: /app/backend/server-entrypoint.sh
restart: unless-stopped
volumes:
- static_data:/app/backend/django_static
- files_data:/files_storage
expose:
- 8000
environment:
PUBLIC_URL: ${PUBLIC_URL} # for IAM links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
CELERY_RESULT_BACKEND_DB: "db+postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_NAME}"
DJANGO_DB: ${DJANGO_DB}
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY}
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS}
DJANGO_TRUSTED_ORIGINS: ${DJANGO_TRUSTED_ORIGINS}
DJANGO_GUNICORN_WORKERS: ${DJANGO_GUNICORN_WORKERS}
DJANGO_GUNICORN_THREADS_PER_WORKER: ${DJANGO_GUNICORN_THREADS_PER_WORKER}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_NAME: ${POSTGRES_NAME}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
B2C_CLIENT_ID: ${B2C_CLIENT_ID}
B2C_CLIENT_SECRET: ${B2C_CLIENT_SECRET}
B2C_AUTHORITY: ${B2C_AUTHORITY}
B2C_USER_FLOW: ${B2C_USER_FLOW}
USE_WHITELIST: ${USE_WHITELIST}
deploy: # example only
mode: replicated
replicas: 2
endpoint_mode: vip
depends_on:
- db
- redis
# Worker - Celery worker (x2)
worker:
image: buildingsmart/validationsvc-backend:${VERSION}
build:
context: .
dockerfile: ./docker/backend/Dockerfile
target: run
entrypoint: /app/backend/worker-entrypoint.sh
restart: unless-stopped
volumes:
- files_data:/files_storage
environment:
PUBLIC_URL: ${PUBLIC_URL} # for email links
ENV: ${ENV}
DEBUG: ${DEBUG}
CELERY_BROKER_URL: ${CELERY_BROKER_URL}
CELERY_RESULT_BACKEND: "django-db"
CELERY_RESULT_BACKEND_DB: "db+postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_NAME}"
CELERY_TASK_SOFT_TIME_LIMIT: ${CELERY_TASK_SOFT_TIME_LIMIT}
CELERY_TASK_TIME_LIMIT: ${CELERY_TASK_TIME_LIMIT}
TASK_TIMEOUT_LIMIT: ${TASK_TIMEOUT_LIMIT}
CELERY_CONCURRENCY: ${CELERY_CONCURRENCY}
DJANGO_DB: ${DJANGO_DB}
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY}
POSTGRES_HOST: ${POSTGRES_HOST}
POSTGRES_PORT: ${POSTGRES_PORT}
POSTGRES_NAME: ${POSTGRES_NAME}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
MAILGUN_API_URL: ${MAILGUN_API_URL}
MAILGUN_API_KEY: ${MAILGUN_API_KEY}
MAILGUN_FROM_NAME: ${MAILGUN_FROM_NAME}
MAILGUN_FROM_EMAIL: ${MAILGUN_FROM_EMAIL}
ADMIN_EMAIL: ${ADMIN_EMAIL}
CONTACT_EMAIL: ${CONTACT_EMAIL}
deploy: # example only
mode: replicated
replicas: 2
endpoint_mode: vip
depends_on:
- db
- redis
# Redis
redis:
image: redis:7.2-alpine
restart: unless-stopped
container_name: redis
expose:
- ${REDIS_PORT}
volumes:
- redis_data:/data
# PostgreSQL DB
db:
image: postgres:16.2-alpine
restart: unless-stopped
container_name: db
volumes:
- postgres_data:/var/lib/postgresql/data/
environment:
POSTGRES_DB: ${POSTGRES_NAME}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
expose:
- ${POSTGRES_PORT}
volumes:
static_data:
files_data:
postgres_data:
redis_data: