-
Notifications
You must be signed in to change notification settings - Fork 5
/
docker-compose.yml
235 lines (204 loc) · 6.17 KB
/
docker-compose.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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
x-server: &base_server_setup
image: ifrcgo/go-api:latest
build: .
# To attach to container with stdin `docker attach <container_name>`
# Used for python debugging.
stdin_open: true
tty: true
environment:
# Overwrite this using .env (for additional configuration, look at main/settings.py:env
# Database (from db.environment)
DJANGO_DB_HOST: ${DJANGO_DB_HOST:-db}
DJANGO_DB_NAME: ${DJANGO_DB_NAME:-test}
DJANGO_DB_USER: ${DJANGO_DB_USER:-test}
DJANGO_DB_PASS: ${DJANGO_DB_PASS:-test}
# Other development defaults configs
DJANGO_DEBUG: ${DJANGO_DEBUG:-true}
GO_ENVIRONMENT: ${GO_ENVIRONMENT:-development}
API_FQDN: ${API_FQDN:-localhost:8000}
FRONTEND_URL: ${FRONTEND_URL:-localhost:3000}
DEBUG_EMAIL: ${DEBUG_EMAIL:-true}
MOLNIX_API_BASE: ${MOLNIX_API_BASE:-https://api.ifrc-staging.rpm.molnix.com/api/}
ERP_API_ENDPOINT: ${ERP_API_ENDPOINT:-https://ifrctintapim001.azure-api.net/GoAPI/ExtractGoEmergency}
ERP_API_SUBSCRIPTION_KEY: ${ERP_API_SUBSCRIPTION_KEY:-abcdef}
CELERY_REDIS_URL: ${CELERY_REDIS_URL:-redis://redis:6379/0}
CACHE_REDIS_URL: ${CACHE_REDIS_URL:-redis://redis:6379/1}
CACHE_TEST_REDIS_URL: ${CACHE_TEST_REDIS_URL:-redis://redis:6379/11}
CACHE_MIDDLEWARE_SECONDS: ${CACHE_MIDDLEWARE_SECONDS:-600}
ELASTIC_SEARCH_HOST: ${ELASTIC_SEARCH_HOST:-elasticsearch://elasticsearch:9200}
# Appeal API
APPEALS_USER: ${APPEALS_USER:-}
APPEALS_PASS: ${APPEALS_PASS:-}
# Sentry
SENTRY_DSN: ${SENTRY_DSN:-}
SENTRY_SAMPLE_RATE: ${SENTRY_SAMPLE_RATE:-0.2}
# Maintenance mode
DJANGO_READ_ONLY: ${DJANGO_READ_ONLY:-false}
# DB resources
RESOURCES_DB_SERVER: ${RESOURCES_DB_SERVER:-}
RESOURCES_DB_NAME: ${RESOURCES_DB_NAME:-}
# Region
REGION: ${REGION:-}
# IFRC dynamic translation
AUTO_TRANSLATION_TRANSLATOR: ${AUTO_TRANSLATION_TRANSLATOR:-}
IFRC_TRANSLATION_DOMAIN: ${IFRC_TRANSLATION_DOMAIN:-}
IFRC_TRANSLATION_HEADER_API_KEY: ${IFRC_TRANSLATION_HEADER_API_KEY:-}
extra_hosts:
- "host.docker.internal:host-gateway"
env_file:
- .env
volumes:
- '.:/home/ifrc/go-api'
depends_on:
- db
- redis
- elasticsearch
services:
db:
image: postgis/postgis:15-3.4-alpine
environment:
POSTGRES_PASSWORD: test
POSTGRES_USER: test
POSTGRES_DB: test
volumes:
- './.db/pg-15:/var/lib/postgresql/data'
extra_hosts:
- "host.docker.internal:host-gateway"
redis:
image: redis:latest
volumes:
- redis-data:/data
# NOTE: Used Only for local development
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.0.0
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- http.cors.enabled=true
- http.cors.allow-origin=*
- discovery.type=single-node
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- elastic-search-data:/usr/share/elasticsearch/data
ports:
- 9200:9200
# NOTE: Used Only for local development
kibana:
image: 'docker.elastic.co/kibana/kibana:7.0.0'
container_name: kibana
environment:
SERVER_NAME: kibana.local
ELASTICSEARCH_URL: http://elasticsearch:9200
ports:
- '5601:5601'
depends_on:
- elasticsearch
profiles: [elasticsearch]
serve:
<<: *base_server_setup
ports:
- 8000:8000
command: python manage.py runserver 0.0.0.0:8000
# For development only
celery:
<<: *base_server_setup
command: python manage.py run_celery_dev
# ------------------ Helper CLI Commands
# Usage: `docker compose run --rm <service-name>`
# Example: `docker compose run --rm bash`
bash:
<<: *base_server_setup
entrypoint: /bin/bash
profiles: [cli]
shell:
<<: *base_server_setup
command: python manage.py shell
profiles: [cli]
loaddata:
<<: *base_server_setup
command: python manage.py loaddata Regions Countries Districts DisasterTypes Actions Groups
profiles: [cli]
ingest_databank:
<<: *base_server_setup
command: python manage.py ingest_databank
profiles: [cli]
collectstatic:
<<: *base_server_setup
command: python manage.py collectstatic --noinput -l
profiles: [cli]
createsuperuser:
<<: *base_server_setup
command: python manage.py createsuperuser
profiles: [cli]
ingest_appeals:
<<: *base_server_setup
command: python manage.py ingest_appeals
profiles: [cli]
ingest_appeal_docs:
<<: *base_server_setup
command: python manage.py ingest_appeal_docs
profiles: [cli]
user_registration_reminder:
<<: *base_server_setup
command: python manage.py user_registration_reminder
profiles: [cli]
ingest_appeal_docs_fullscan:
<<: *base_server_setup
command: python manage.py ingest_appeal_docs --fullscan
profiles: [cli]
ingest_mdb:
<<: *base_server_setup
command: python manage.py ingest_mdb
profiles: [cli]
migrate:
<<: *base_server_setup
command: python manage.py migrate
profiles: [cli]
makemigrations:
<<: *base_server_setup
command: python manage.py makemigrations
profiles: [cli]
makemigrations_merge:
<<: *base_server_setup
command: python manage.py makemigrations --merge
profiles: [cli]
make_permissions:
<<: *base_server_setup
command: python manage.py make_permissions
profiles: [cli]
test:
<<: *base_server_setup
command: pytest --durations=10
profiles: [cli]
test_snapshot_update:
<<: *base_server_setup
command: python manage.py test -k --snapshot-update
profiles: [cli]
testr:
<<: *base_server_setup
command: pytest --reuse-db --durations=10 -s
profiles: [cli]
coverage:
<<: *base_server_setup
command: coverage run --source='.' manage.py test -k
profiles: [cli]
coverage_report:
<<: *base_server_setup
command: coverage report
profiles: [cli]
coverage_html:
<<: *base_server_setup
command: coverage html
profiles: [cli]
triggers_to_db:
<<: *base_server_setup
command: python manage.py triggers_to_db
profiles: [cli]
volumes:
redis-data:
elastic-search-data: