-
Notifications
You must be signed in to change notification settings - Fork 251
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
256 lines (243 loc) · 6.69 KB
/
docker-compose.test.yml
File metadata and controls
256 lines (243 loc) · 6.69 KB
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# This file is an alternative to the original docker-compose.yml file.
# It is intended to be used for CI test workflows.
# DO NOT USE THIS IN PRODUCTION.
# Run with: `docker compose -f docker-compose.test.yml --env-file test.env up --build`.
services:
client-participation-alpha:
build:
context: ./client-participation-alpha
dockerfile: Dockerfile
args:
- OIDC_CACHE_KEY_ID_TOKEN_SUFFIX=${OIDC_CACHE_KEY_ID_TOKEN_SUFFIX}
- OIDC_CACHE_KEY_PREFIX=${OIDC_CACHE_KEY_PREFIX}
- PUBLIC_SERVICE_URL=${PUBLIC_SERVICE_URL}
depends_on:
- "server"
environment:
- INTERNAL_SERVICE_URL=${INTERNAL_SERVICE_URL}
- PUBLIC_OIDC_CACHE_KEY_ID_TOKEN_SUFFIX=${OIDC_CACHE_KEY_ID_TOKEN_SUFFIX}
- PUBLIC_OIDC_CACHE_KEY_PREFIX=${OIDC_CACHE_KEY_PREFIX}
- PUBLIC_SERVICE_URL=${PUBLIC_SERVICE_URL}
networks:
- polis-test
ports:
- "4321:4321"
restart: unless-stopped
server:
environment:
- DATABASE_SSL=false
- DATABASE_URL=${DATABASE_URL}
- NODE_ENV=development
- NODE_EXTRA_CA_CERTS=/root/.simulacrum/certs/rootCA.pem
env_file:
- test.env
build:
context: ./server
dockerfile: Dockerfile
target: prod
args:
NODE_ENV: production
labels:
polis_tag: test
networks:
- polis-test
volumes:
# Mount mkcert root CA for TLS verification
- ${AUTH_CERTS_PATH:-~/.simulacrum/certs}:/root/.simulacrum/certs:ro
restart: unless-stopped
depends_on:
- oidc-simulator
- postgres
- dynamodb-init
extra_hosts:
- "host.docker.internal:host-gateway"
math:
build:
context: ./math
labels:
polis_tag: test
environment:
- DATABASE_URL=${DATABASE_URL}
- DD_ENABLED=false
- LOGGING_LEVEL=${MATH_LOG_LEVEL:-warn}
- MATH_ENV=${MATH_ENV:-dev}
- WEBSERVER_USERNAME=${WEBSERVER_USERNAME}
- WEBSERVER_PASS=${WEBSERVER_PASS}
networks:
- polis-test
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
ses-local:
image: dasprid/aws-ses-v2-local:latest
ports:
- "8005:8005"
networks:
- "polis-test"
environment:
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-ses-local-key}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-ses-local-secret}
- AWS_REGION=${AWS_REGION:-us-east-1}
labels:
polis_tag: ${TAG:-test}
oidc-simulator:
build:
context: ./oidc-simulator
dockerfile: Dockerfile
environment:
- AUTH_AUDIENCE=users
- AUTH_CLIENT_ID=dev-client-id
- AUTH_NAMESPACE=https://pol.is/
- AUTH_SIMULATOR_PORT=3000
- CERT_DIR=/root/.simulacrum/certs
labels:
polis_tag: test
networks:
- polis-test
ports:
- 3000:3000
volumes:
- ${AUTH_CERTS_PATH:-~/.simulacrum/certs}:/root/.simulacrum/certs:ro
postgres:
build:
context: ./server
dockerfile: Dockerfile-db
labels:
polis_tag: test
environment:
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USER}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
networks:
- polis-test
ports:
- 5432:5432
restart: unless-stopped
# PostgreSQL configuration for development/testing
command: >
postgres
-c max_connections=${POSTGRES_MAX_CONNECTIONS:-300}
-c shared_buffers=256MB
-c effective_cache_size=1GB
-c work_mem=4MB
-c maintenance_work_mem=64MB
-c wal_buffers=16MB
-c checkpoint_completion_target=0.9
-c checkpoint_timeout=10min
-c log_connections=on
-c log_disconnections=on
-c autovacuum=on
-c autovacuum_max_workers=3
-c autovacuum_naptime=30s
nginx-proxy:
build:
context: ./file-server
dockerfile: nginx.Dockerfile
depends_on:
- client-participation-alpha
- server
environment:
- API_SERVER_PORT=5000
labels:
polis_tag: test
networks:
- polis-test
ports:
- 80:80
- 443:443
file-server:
build:
context: ./
dockerfile: file-server/Dockerfile
args:
ADMIN_UIDS: ${ADMIN_UIDS}
AUTH_AUDIENCE: users
AUTH_CLIENT_ID: dev-client-id
AUTH_ISSUER: https://localhost:3000/
AUTH_NAMESPACE: https://pol.is/
EMBED_SERVICE_HOSTNAME: localhost
GIT_HASH: test
NODE_ENV: production
OIDC_CACHE_KEY_ID_TOKEN_SUFFIX: ${OIDC_CACHE_KEY_ID_TOKEN_SUFFIX}
OIDC_CACHE_KEY_PREFIX: ${OIDC_CACHE_KEY_PREFIX}
environment:
- PORT=8080
labels:
polis_tag: test
networks:
- polis-test
delphi:
image: 050917022930.dkr.ecr.us-east-1.amazonaws.com/polis/delphi:latest
build:
context: ./delphi
target: test
args:
USE_CPU_TORCH: "true"
labels:
polis_tag: test
environment:
- DATABASE_HOST=${POSTGRES_HOST}
- DATABASE_PORT=${POSTGRES_PORT}
- DATABASE_NAME=${POSTGRES_DB}
- DATABASE_USER=${POSTGRES_USER}
- DATABASE_PASSWORD=${POSTGRES_PASSWORD}
- DYNAMODB_ENDPOINT=${DYNAMODB_ENDPOINT}
- AWS_S3_ENDPOINT=${AWS_S3_ENDPOINT}
- AWS_ACCESS_KEY_ID=minioadmin
- AWS_SECRET_ACCESS_KEY=minioadmin
- AWS_S3_BUCKET_NAME=polis-delphi
- LOG_LEVEL=DEBUG
networks:
- "polis-test"
depends_on:
- postgres
- dynamodb-init
command: tail -f /dev/null
restart: unless-stopped
dynamodb:
image: amazon/dynamodb-local:latest
ports:
- "8000:8000"
networks:
- polis-test
environment:
- JAVA_OPTS=-Xmx1G
user: root
labels:
polis_tag: test
extra_hosts:
- "host.docker.internal:host-gateway"
# This is the new line that fixes the error
command: "-jar DynamoDBLocal.jar -sharedDb -inMemory"
# One-time init container to create DynamoDB tables
dynamodb-init:
image: python:3.11-slim
networks:
- polis-test
environment:
- AWS_ACCESS_KEY_ID=DUMMYIDEXAMPLE
- AWS_SECRET_ACCESS_KEY=DUMMYEXAMPLEKEY
- AWS_REGION=us-east-1
- DYNAMODB_ENDPOINT=http://dynamodb:8000
volumes:
- ./delphi/create_dynamodb_tables.py:/create_dynamodb_tables.py:ro
depends_on:
- dynamodb
command: >
sh -c "
pip install boto3 --quiet &&
echo 'Waiting for DynamoDB to be ready...' &&
sleep 5 &&
python /create_dynamodb_tables.py --endpoint-url http://dynamodb:8000 --region us-east-1 &&
echo 'DynamoDB tables created successfully'
"
labels:
polis_tag: test
networks:
polis-test: