-
Notifications
You must be signed in to change notification settings - Fork 7
/
docker-compose-production.yml
112 lines (105 loc) · 2.7 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
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
# -----------------------------------------------------------------------------
# DOCKER COMPOSE DEPLOYMENT
# -----------------------------------------------------------------------------
# set environment variables on server:
# set -a && source .env.
# setup or purge
# ./docker-purge.sh
# update
# ./docker-update.sh
# To update the frontend individually use:
# docker-compose -f $PKDB_DOCKER_COMPOSE_YAML up -d --no-deps --build frontend
# docker-compose -f $PKDB_DOCKER_COMPOSE_YAML up -d --no-deps --build backend
# -----------------------------------------------------------------------------
version: '3'
volumes:
django_static:
driver: local
django_media:
driver: local
postgres_data:
driver: local
elasticsearch_data:
driver: local
vue_dist:
driver: local
node_modules:
driver: local
services:
postgres:
restart: always
image: postgres:13.0
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
env_file:
- .env.production
environment:
- POSTGRES_DB=${PKDB_DB_NAME}
- POSTGRES_USER=${PKDB_DB_USER}
- POSTGRES_PASSWORD=${PKDB_DB_PASSWORD}
elasticsearch:
restart: always
image: elasticsearch:7.9.2
environment:
- "ES_JAVA_OPTS=-Xms3g -Xmx12g"
- bootstrap.memory_lock=true
- discovery.type=single-node
- cluster.name=elasticsearch
- cluster.routing.allocation.disk.threshold_enabled=false
- xpack.license.self_generated.type=trial
ulimits:
memlock:
soft: -1
hard: -1
ports:
- "9123:9200"
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
backend:
restart: always
build: ./backend
volumes:
- ./backend:/code
- django_static:/static
- django_media:/media
env_file:
- .env.production
expose:
- "8000"
- "25"
ports:
- "8000:8000"
- "1025:25"
links:
- postgres:postgres
- elasticsearch:elasticsearch
depends_on:
- postgres
- elasticsearch
command: bash -c "/usr/local/bin/gunicorn pkdb_app.wsgi:application --log-config gunicorn_logging.conf -w 4 --timeout 900 --bind 0.0.0.0:8000"
frontend:
build:
context: ./frontend
dockerfile: Dockerfile-production
command: tail -f /dev/null
volumes:
- ./frontend:/app
- node_modules:/app/node_modules/
- vue_dist:/vue
nginx:
restart: always
image: nginx:1.19.2
ports:
- 8888:80
volumes:
- ./nginx/config/conf.d:/etc/nginx/conf.d
- django_static:/static
- django_media:/media
- vue_dist:/vue
depends_on:
- backend
- frontend
links:
- backend:backend