forked from Akkarine/demo_cicd_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.production.yml
76 lines (69 loc) · 2.19 KB
/
docker-compose.production.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
version: '3.7'
# Данный файл предназначается для запуска образов на проде. Он только берет образы с тегом latest и запускает их.
volumes:
staticfiles:
name: staticfiles
driver: local
networks:
default:
external:
name: demo-production
services:
db:
image: ${CI_REGISTRY_IMAGE}/db:latest
container_name: db-prod
restart: 'always'
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- DB_NAME=demo
- DB_USER
- DB_PASSWORD
ports:
- 127.0.0.1:5432:5432
volumes:
- /srv/demo-prj/db/data:/var/lib/postgresql/data
- /srv/demo-prj/db/backupsrvkey:/backupsrvkey
shm_size: 128MB
command: ["postgres"]
.common_backend_code: &common_backend_code
image: ${CI_REGISTRY_IMAGE}/backend:latest
restart: 'always'
environment:
- BACKEND_HOSTNAME=backend-prod
- DB_HOST=db-prod
- DB_PORT=5432
- DB_USER
- DB_PASSWORD
- DEBUG=False
- ALLOWED_WEB_HOST
- NGINX_SERVER_HOSTNAME=${NGINX_SERVER_HOSTNAME}
- SECRET_KEY
- GUNICORN_WORKERS_NUM=${GUNICORN_WORKERS_NUM:-2}
depends_on:
- db
backend:
<<: *common_backend_code
container_name: backend-prod
command: gunicorn --access-logfile - src.core.wsgi:application --workers=2 --timeout 180 -b 0.0.0.0:8000
expose:
- 8000
volumes:
- staticfiles:/app/static
proxy:
image: ${CI_REGISTRY_IMAGE}/proxy:latest
restart: 'always'
environment:
- ALLOWED_WEB_HOST=${ALLOWED_WEB_HOST}
- PRODUCTION_ALLOWED_WEB_HOST=${PRODUCTION_ALLOWED_WEB_HOST}
- NGINX_BACKEND_CONTAINER_NAME=backend-prod
- NGINX_SERVER_HOSTNAME=${NGINX_SERVER_HOSTNAME}
- NGINX_ACCESS_LOG_SETTINGS=${NGINX_ACCESS_LOG_SETTINGS}
ports:
- ${PRODUCTION_ALLOWED_WEB_HOST}:8000:80
container_name: proxy-prod
command: /bin/bash -c "envsubst '$${NGINX_BACKEND_CONTAINER_NAME},$${NGINX_SERVER_HOSTNAME},$${NGINX_ACCESS_LOG_SETTINGS}' < /etc/nginx/demo.nginx > /etc/nginx/nginx.conf && exec nginx -g 'daemon off;'"
volumes:
- staticfiles:/static
depends_on:
- backend