forked from bcgov/biohubbc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
204 lines (197 loc) · 7.53 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
version: "3.5"
services:
## Build postgres docker image
db:
image: ${DOCKER_PROJECT_NAME}-db-${DOCKER_NAMESPACE}-img
container_name: ${DOCKER_PROJECT_NAME}-db-${DOCKER_NAMESPACE}-container
build:
context: ./database/.docker/db
dockerfile: Dockerfile
args:
- POSTGRES_VERSION=${POSTGRES_VERSION}
- POSTGIS_VERSION=${POSTGIS_VERSION}
- TZ=${DB_TZ}
ports:
- ${DB_PORT}:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $DB_ADMIN -p 5432 -d $DB_DATABASE"]
interval: 5s
timeout: 5s
retries: 30
environment:
- NODE_ENV=${NODE_ENV}
- POSTGRES_USER=${DB_ADMIN}
- POSTGRES_PASSWORD=${DB_ADMIN_PASS}
- POSTGRES_DB=${DB_DATABASE}
- PORT=5432
networks:
- sims-network
volumes:
- postgres:/var/lib/postgresql/data
## Build the api docker image
api:
image: ${DOCKER_PROJECT_NAME}-api-${DOCKER_NAMESPACE}-img
container_name: ${DOCKER_PROJECT_NAME}-api-${DOCKER_NAMESPACE}-container
build:
context: ./api
dockerfile: ./.docker/api/Dockerfile
ports:
- ${API_PORT}:${API_PORT}
environment:
- NODE_ENV=${NODE_ENV}
- NODE_OPTIONS=${API_NODE_OPTIONS}
- API_HOST=${API_HOST}
- API_PORT=${API_PORT}
# Database
- TZ=${API_TZ}
- DB_HOST=${DB_HOST}
- DB_USER_API=${DB_USER_API}
- DB_USER_API_PASS=${DB_USER_API_PASS}
- DB_PORT=5432
- DB_DATABASE=${DB_DATABASE}
- DB_SCHEMA=${DB_SCHEMA}
# Seed
- PROJECT_SEEDER_USER_IDENTIFIER=${PROJECT_SEEDER_USER_IDENTIFIER}
- NUM_SEED_PROJECTS=${NUM_SEED_PROJECTS}
- NUM_SEED_SURVEYS_PER_PROJECT=${NUM_SEED_SURVEYS_PER_PROJECT}
- NUM_SEED_OBSERVATIONS_PER_SURVEY=${NUM_SEED_OBSERVATIONS_PER_SURVEY}
- NUM_SEED_SUBCOUNTS_PER_OBSERVATION=${NUM_SEED_SUBCOUNTS_PER_OBSERVATION}
# Keycloak
- KEYCLOAK_HOST=${KEYCLOAK_HOST}
- KEYCLOAK_REALM=${KEYCLOAK_REALM}
# Keycloak Service client
- KEYCLOAK_ADMIN_USERNAME=${KEYCLOAK_ADMIN_USERNAME}
- KEYCLOAK_ADMIN_PASSWORD=${KEYCLOAK_ADMIN_PASSWORD}
# Keycloak CSS API
- KEYCLOAK_API_TOKEN_URL=${KEYCLOAK_API_TOKEN_URL}
- KEYCLOAK_API_CLIENT_ID=${KEYCLOAK_API_CLIENT_ID}
- KEYCLOAK_API_CLIENT_SECRET=${KEYCLOAK_API_CLIENT_SECRET}
- KEYCLOAK_API_HOST=${KEYCLOAK_API_HOST}
- KEYCLOAK_API_ENVIRONMENT=${KEYCLOAK_API_ENVIRONMENT}
# Object Store (S3)
- OBJECT_STORE_URL=${OBJECT_STORE_URL}
- OBJECT_STORE_ACCESS_KEY_ID=${OBJECT_STORE_ACCESS_KEY_ID}
- OBJECT_STORE_SECRET_KEY_ID=${OBJECT_STORE_SECRET_KEY_ID}
- OBJECT_STORE_BUCKET_NAME=${OBJECT_STORE_BUCKET_NAME}
- S3_KEY_PREFIX=${S3_KEY_PREFIX}
# File Upload
- MAX_REQ_BODY_SIZE=${MAX_REQ_BODY_SIZE}
- MAX_UPLOAD_NUM_FILES=${MAX_UPLOAD_NUM_FILES}
- MAX_UPLOAD_FILE_SIZE=${MAX_UPLOAD_FILE_SIZE}
# Logging and Validation
- LOG_LEVEL=${LOG_LEVEL}
- API_RESPONSE_VALIDATION_ENABLED=${API_RESPONSE_VALIDATION_ENABLED}
- DATABASE_RESPONSE_VALIDATION_ENABLED=${DATABASE_RESPONSE_VALIDATION_ENABLED}
# Clamav
- CLAMAV_PORT=${CLAMAV_PORT}
- CLAMAV_HOST=${CLAMAV_HOST}
- ENABLE_FILE_VIRUS_SCAN=${ENABLE_FILE_VIRUS_SCAN}
# GCNotify
- GCNOTIFY_SECRET_API_KEY=${GCNOTIFY_SECRET_API_KEY}
- GCNOTIFY_ADMIN_EMAIL=${GCNOTIFY_ADMIN_EMAIL}
- GCNOTIFY_ONBOARDING_REQUEST_EMAIL_TEMPLATE=${GCNOTIFY_ONBOARDING_REQUEST_EMAIL_TEMPLATE}
- GCNOTIFY_ONBOARDING_REQUEST_SMS_TEMPLATE=${GCNOTIFY_ONBOARDING_REQUEST_SMS_TEMPLATE}
- GCNOTIFY_REQUEST_RESUBMIT_TEMPLATE=${GCNOTIFY_REQUEST_RESUBMIT_TEMPLATE}
- GCNOTIFY_EMAIL_URL=${GCNOTIFY_EMAIL_URL}
- GCNOTIFY_SMS_URL=${GCNOTIFY_SMS_URL}
- APP_HOST=${APP_HOST}
# BioHub Platform (aka: Backbone)
- BACKBONE_INTERNAL_API_HOST=${BACKBONE_INTERNAL_API_HOST}
- BACKBONE_PUBLIC_API_HOST=${BACKBONE_PUBLIC_API_HOST}
- BACKBONE_INTAKE_PATH=${BACKBONE_INTAKE_PATH}
- BACKBONE_ARTIFACT_INTAKE_PATH=${BACKBONE_ARTIFACT_INTAKE_PATH}
- BACKBONE_INTAKE_ENABLED=${BACKBONE_INTAKE_ENABLED}
- BIOHUB_TAXON_PATH=${BIOHUB_TAXON_PATH}
- BIOHUB_TAXON_TSN_PATH=${BIOHUB_TAXON_TSN_PATH}
# BCTW / Critterbase
- BCTW_API_HOST=${BCTW_API_HOST}
- CB_API_HOST=${CB_API_HOST}
volumes:
- ./api:/opt/app-root/src
- /opt/app-root/src/node_modules # prevents local node_modules overriding container node_modules
networks:
- sims-network
depends_on:
- db
- db_setup
# Build the clamav docker image
clamav:
image: mkodockx/docker-clamav:latest
container_name: ${DOCKER_PROJECT_NAME}-clamav-${DOCKER_NAMESPACE}-container
ports:
- ${CLAMAV_PORT}:3310
networks:
- sims-network
## Build the app docker image
app:
image: ${DOCKER_PROJECT_NAME}-app-${DOCKER_NAMESPACE}-img
container_name: ${DOCKER_PROJECT_NAME}-app-${DOCKER_NAMESPACE}-container
build:
context: ./app
dockerfile: ./.docker/app/Dockerfile
stdin_open: true
ports:
- ${APP_PORT}:${APP_PORT}
environment:
- NODE_ENV=${NODE_ENV}
- NODE_OPTIONS=${APP_NODE_OPTIONS}
- REACT_APP_NODE_ENV=${NODE_ENV}
- PORT=${APP_PORT}
- REACT_APP_API_HOST=${API_HOST}
- REACT_APP_API_PORT=${API_PORT}
- REACT_APP_MAX_UPLOAD_NUM_FILES=${MAX_UPLOAD_NUM_FILES}
- REACT_APP_MAX_UPLOAD_FILE_SIZE=${MAX_UPLOAD_FILE_SIZE}
- REACT_APP_SITEMINDER_LOGOUT_URL=${SITEMINDER_LOGOUT_URL}
- REACT_APP_KEYCLOAK_HOST=${KEYCLOAK_HOST}
- REACT_APP_KEYCLOAK_REALM=${KEYCLOAK_REALM}
- REACT_APP_KEYCLOAK_CLIENT_ID=${KEYCLOAK_CLIENT_ID}
# BioHub Platform (aka: Backbone)
- REACT_APP_BIOHUB_FEATURE_FLAG=${REACT_APP_BIOHUB_FEATURE_FLAG}
- REACT_APP_BACKBONE_PUBLIC_API_HOST=${BACKBONE_PUBLIC_API_HOST}
- REACT_APP_BIOHUB_TAXON_PATH=${BIOHUB_TAXON_PATH}
- REACT_APP_BIOHUB_TAXON_TSN_PATH=${BIOHUB_TAXON_TSN_PATH}
# Object Store (S3)
- OBJECT_STORE_URL=${OBJECT_STORE_URL}
- OBJECT_STORE_BUCKET_NAME=${OBJECT_STORE_BUCKET_NAME}
volumes:
- ./app:/opt/app-root/src
- /opt/app-root/src/node_modules # prevents local node_modules overriding container node_modules
networks:
- sims-network
## Run the database migrations and seeding
db_setup:
image: ${DOCKER_PROJECT_NAME}-db-setup-${DOCKER_NAMESPACE}-img
container_name: ${DOCKER_PROJECT_NAME}-db-setup-${DOCKER_NAMESPACE}-container
build:
context: ./database
dockerfile: ./.docker/db/Dockerfile.setup
environment:
- NODE_ENV=${NODE_ENV}
- DB_HOST=${DB_HOST}
- DB_ADMIN=${DB_ADMIN}
- DB_ADMIN_PASS=${DB_ADMIN_PASS}
- DB_PORT=5432
- DB_DATABASE=${DB_DATABASE}
- DB_SCHEMA=${DB_SCHEMA}
- DB_USER_API=${DB_USER_API}
- DB_USER_API_PASS=${DB_USER_API_PASS}
- DB_SCHEMA_DAPI_V1=${DB_SCHEMA_DAPI_V1}
- PROJECT_SEEDER_USER_IDENTIFIER=${PROJECT_SEEDER_USER_IDENTIFIER}
- NUM_SEED_PROJECTS=${NUM_SEED_PROJECTS}
- NUM_SEED_SURVEYS_PER_PROJECT=${NUM_SEED_SURVEYS_PER_PROJECT}
- NUM_SEED_OBSERVATIONS_PER_SURVEY=${NUM_SEED_OBSERVATIONS_PER_SURVEY}
- NUM_SEED_SUBCOUNTS_PER_OBSERVATION=${NUM_SEED_SUBCOUNTS_PER_OBSERVATION}
volumes:
- /opt/app-root/src/node_modules # prevents local node_modules overriding container node_modules
networks:
- sims-network
depends_on:
db:
condition: service_healthy
command: ["npm", "run", "setup"]
networks:
sims-network:
driver: bridge
volumes:
postgres:
name: ${DOCKER_PROJECT_NAME}-db-${DOCKER_NAMESPACE}-vol