forked from cfpb/consumerfinance.gov
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-stack.yml
100 lines (92 loc) · 2.31 KB
/
docker-stack.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
# Docker Swarm compatible Compose file. Intended for use
# with this repo's Jenkinsfile, not local development.
version: "3.7"
services:
elasticsearch:
image: elasticsearch:2.4-alpine
user: elasticsearch
deploy:
placement:
constraints:
- node.role!=manager
restart_policy:
condition: none
networks:
- app
postgres:
image: postgres:10-alpine
user: postgres
deploy:
placement:
constraints:
- node.role!=manager
restart_policy:
condition: none
environment:
POSTGRES_USER: cfpb
POSTGRES_PASSWORD_FILE: /var/run/secrets/PGPASSWORD
POSTGRES_DB: cfgov
ports:
- 5432
networks:
- app
secrets:
- PGPASSWORD
python:
image: ${CFGOV_PYTHON_IMAGE}
environment:
ALLOW_ADMIN_URL: "True"
APACHE_PORT: 8000
APACHE_UPLOADS_F_ALIAS: /src/cfgov-refresh/cfgov/f/
DATABASE_URL: postgres://cfpb@postgres/cfgov
DJANGO_ADMIN_USERNAME: admin
ES_HOST: elasticsearch
MEDIA_ROOT: /src/cfgov-refresh/cfgov/f/
REFRESH_DB: ${REFRESH_DB}
ports:
- 8000
networks:
- app
- lb
secrets:
- CFGOV_PROD_DB_LOCATION
- DJANGO_ADMIN_PASSWORD
- PGPASSWORD
- SECRET_KEY
deploy:
placement:
constraints:
- node.role!=manager
restart_policy:
condition: none
labels:
- com.docker.lb.hosts=${CFGOV_HOSTNAME}
- com.docker.lb.port=8000
- com.docker.lb.network=${LB_NETWORK}
command: >
bash -c "
psql $${DATABASE_URL} -c 'SELECT COUNT(*) FROM auth_user'
django_tables_exist=$$?
if [ $$django_tables_exist -gt 0 ] || [ $$REFRESH_DB == 'true' ]; then
./refresh-data.sh && httpd -d cfgov/apache -D FOREGROUND
else
httpd -d cfgov/apache -D FOREGROUND
fi"
networks:
app:
lb:
name: ${LB_NETWORK}
external: True
secrets:
CFGOV_PROD_DB_LOCATION:
name: cfgov_prod_db_location
external: True
DJANGO_ADMIN_PASSWORD:
name: cfgov_django_admin_password
external: True
PGPASSWORD:
name: cfgov_postgres_password
external: True
SECRET_KEY:
name: cfgov_django_secret_key
external: True