forked from cfpb/consumerfinance.gov
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-stack.yml
143 lines (135 loc) · 3.38 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
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
141
142
143
# Docker Swarm compatible Compose file. Intended for use
# with this repo's Jenkinsfile, not local development.
version: '3.7'
services:
elasticsearch:
image: ${CFGOV_ES_IMAGE}
environment:
discovery.type: single-node
deploy:
placement:
constraints:
- node.role!=manager
restart_policy:
condition: any
delay: 10s
max_attempts: 3
window: 120s
resources:
limits:
memory: 2048M
reservations:
memory: 1024M
networks:
- app
postgres:
# Deliberately pin the Postgres image to a minor version so that
# upstream image updates don't trigger recreation of the database
# container when Docker stacks are redeployed.
image: postgres:10.18-alpine
user: postgres
deploy:
placement:
constraints:
- node.role!=manager
restart_policy:
condition: any
delay: 10s
max_attempts: 3
window: 120s
resources:
limits:
memory: 512M
reservations:
memory: 128M
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/consumerfinance.gov/cfgov/f/
PGDATABASE: cfgov
PGUSER: cfpb
PGPASSWORD: cfpb
POSTGRES_USER: cfpb
PGHOST: localhost
PGPORT: 5432
DJANGO_ADMIN_USERNAME: admin
ES_HOST: elasticsearch
GOVDELIVERY_BASE_URL: https://stage-api.govdelivery.com/
GOVDELIVERY_ACCOUNT_CODE: USCFPB
MEDIA_ROOT: /src/consumerfinance.gov/cfgov/f/
REFRESH_DB: ${REFRESH_DB}
ports:
- 8000
networks:
- app
- lb
secrets:
- CFGOV_PROD_DB_LOCATION
- DJANGO_ADMIN_PASSWORD
- GOVDELIVERY_USER
- GOVDELIVERY_PASSWORD
- PGPASSWORD
- SECRET_KEY
- MAPBOX_ACCESS_TOKEN
deploy:
placement:
constraints:
- node.role!=manager
restart_policy:
condition: any
delay: 10s
max_attempts: 3
window: 120s
labels:
- com.docker.lb.hosts=${CFGOV_HOSTNAME}
- com.docker.lb.port=8000
- com.docker.lb.network=${LB_NETWORK}
resources:
limits:
memory: 1024M
reservations:
memory: 512M
command: >
bash -c "
./cfgov/manage.py opensearch index --force rebuild
./cfgov/manage.py opensearch document --force --refresh --parallel index
httpd -d /src/consumerfinance.gov/cfgov/apache -f /src/consumerfinance.gov/cfgov/apache/conf/httpd.conf -D FOREGROUND"
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
GOVDELIVERY_USER:
name: staging_govdelivery_user
external: True
GOVDELIVERY_PASSWORD:
name: staging_govdelivery_password
external: True
MAPBOX_ACCESS_TOKEN:
name: mapbox_access_token
external: True