-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose-local.yml
115 lines (108 loc) · 2.92 KB
/
docker-compose-local.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
version: '3.7'
services:
django:
build:
context: .
dockerfile: Dockerfile
volumes:
- django_static_volume:/usr/src/app/static
expose:
- 8000
ports:
- "8000:8000"
env_file:
- .env
command: >
sh -c "# Build elasticsearch index
sleep 20 &&
python manage.py search_index --rebuild -f &&
pwd && gunicorn thr.wsgi:application --bind 0.0.0.0:8000 --timeout 120"
depends_on:
- mysql
- elasticsearch
networks:
- dbnet
- webnet
react:
build:
# Build from GitHub repo: https://docs.docker.com/engine/reference/commandline/build/#git-repositories
context: https://github.com/Ensembl/thr_frontend.git#chore/upgrade_react_and_mui
dockerfile: Dockerfile
args:
- API_SERVER=${ENV_API_SERVER}
volumes:
- react_static_volume:/usr/src/app/build/static
expose:
- 3000
env_file:
- .env
command: serve -s build -l 3000
depends_on:
- django
networks:
- webnet
mysql:
image: mysql:${MYSQL_VERSION}
command:
# Set max_allowed_packet to 256M
# Fix Aborted connection 11 to db: 'DB' user: 'USER' host: 'HOST' (Got an error reading communication packets)
- --max_allowed_packet=32505856
# wait_timeout may be need in case we get mysql timeout errors in the future
# - --wait_timeout=28800
ports:
- "3306:3306"
volumes:
# using 'mysql_data:/var/lib/mysql/' instead of 'mysql_data:/var/lib/mysql/data/'
# fixed '[ERROR] --initialize specified but the data directory has files in it. Aborting.'
- mysql_data:/var/lib/mysql
environment:
- MYSQL_DATABASE=${DB_DATABASE}
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_PASSWORD}
# fix 'Database is uninitialized and password option is not specified'
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
env_file:
- .env
networks:
- dbnet
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION}
ports:
- "9200:9200"
- "9300:9300"
expose:
- 9200
- 9300
environment:
# https://discuss.elastic.co/t/problems-with-access-to-elasticsearch-form-outside-machine/172450
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms2g -Xmx2g"
ulimits:
memlock:
soft: -1
hard: -1
networks:
- dbnet
nginx:
restart: always
build: ./nginx
volumes:
- django_static_volume:/usr/src/app/django_files/static
- react_static_volume:/usr/src/app/react_files/static
ports:
- "80:80"
depends_on:
- react
- django
networks:
- webnet
volumes:
mysql_data:
django_static_volume:
react_static_volume:
networks:
dbnet: {}
# fix 'nginx: [emerg] host not found in upstream' error
webnet:
driver: bridge