-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
238 lines (225 loc) · 7.36 KB
/
Copy pathdocker-compose.yml
File metadata and controls
238 lines (225 loc) · 7.36 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
name: htmltrust
networks:
htmltrust:
driver: bridge
volumes:
mongo-data:
wp-db-data:
wp-1-data:
wp-2-data:
wp-3-data:
wp-4-data:
wp-5-data:
services:
mongodb:
image: mongo:7
networks:
- htmltrust
volumes:
- mongo-data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.runCommand('ping').ok"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
trust-server:
build:
context: ..
dockerfile: htmltrust-e2e/Dockerfile.trust-server
networks:
- htmltrust
depends_on:
mongodb:
condition: service_healthy
environment:
MONGO_URI: mongodb://mongodb:27017/htmltrust
# Overridable per run, e.g.
# HTMLTRUST_GENERAL_API_KEY=$(openssl rand -hex 24) \
# HTMLTRUST_ADMIN_API_KEY=$(openssl rand -hex 24) docker compose up
# (or the same two lines in htmltrust-e2e/.env, which compose reads).
#
# Scenario loading applies the same environment variables, so callers can
# replace the checked-in simulation credentials for a run.
GENERAL_API_KEY: ${HTMLTRUST_GENERAL_API_KEY:-sim_general_key}
ADMIN_API_KEY: ${HTMLTRUST_ADMIN_API_KEY:-sim_admin_key}
AUTHOR_API_KEY_PEPPER: ${HTMLTRUST_AUTHOR_API_KEY_PEPPER:-sim_author_api_key_pepper}
# Signed key URLs must be reachable by a production-policy verifier,
# which accepts HTTPS only. Nginx proxies this test hostname internally.
DIRECTORY_BASE_URL: ${HTMLTRUST_DIRECTORY_BASE_URL:-https://trust.htmltrust.test}
PORT: "3000"
ports:
# Loopback only. "3000:3000" publishes on 0.0.0.0, exposing the trust
# directory API -- including the admin key's endpoints -- to anything
# that can reach this machine.
- "127.0.0.1:${HTMLTRUST_TRUST_PORT:-3000}:3000"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
wp-db:
image: mariadb:11
networks:
- htmltrust
volumes:
- wp-db-data:/var/lib/mysql
# Creates wp1..wp5 and scopes the `wordpress` account to them. See the
# file for the one-time `docker compose down -v` note.
- ./wp-db-init.sql:/docker-entrypoint-initdb.d/10-wp-users.sql:ro
environment:
# root stays reachable inside the compose network because
# src/phases/infrastructure.ts and src/smoke-test.ts create the wp*
# databases with the configured root password. Nothing else uses it,
# and this service publishes no ports.
MYSQL_ROOT_PASSWORD: ${WP_DB_ROOT_PASSWORD:-rootpass}
# The unprivileged account the five WordPress containers connect as.
MYSQL_USER: wordpress
MYSQL_PASSWORD: ${WP_DB_PASSWORD:-wp_sim_local_only}
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
wp-1:
build:
context: .
dockerfile: Dockerfile.wordpress
networks:
- htmltrust
depends_on:
wp-db:
condition: service_healthy
environment:
WORDPRESS_DB_HOST: wp-db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD:-wp_sim_local_only}
WORDPRESS_DB_NAME: wp1
volumes:
- wp-1-data:/var/www/html
- ../htmltrust-cms-reference/wordpress:/var/www/html/wp-content/plugins/content-signing
wp-2:
build:
context: .
dockerfile: Dockerfile.wordpress
networks:
- htmltrust
depends_on:
wp-db:
condition: service_healthy
environment:
WORDPRESS_DB_HOST: wp-db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD:-wp_sim_local_only}
WORDPRESS_DB_NAME: wp2
volumes:
- wp-2-data:/var/www/html
- ../htmltrust-cms-reference/wordpress:/var/www/html/wp-content/plugins/content-signing
wp-3:
build:
context: .
dockerfile: Dockerfile.wordpress
networks:
- htmltrust
depends_on:
wp-db:
condition: service_healthy
environment:
WORDPRESS_DB_HOST: wp-db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD:-wp_sim_local_only}
WORDPRESS_DB_NAME: wp3
volumes:
- wp-3-data:/var/www/html
- ../htmltrust-cms-reference/wordpress:/var/www/html/wp-content/plugins/content-signing
wp-4:
build:
context: .
dockerfile: Dockerfile.wordpress
networks:
- htmltrust
depends_on:
wp-db:
condition: service_healthy
environment:
WORDPRESS_DB_HOST: wp-db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD:-wp_sim_local_only}
WORDPRESS_DB_NAME: wp4
volumes:
- wp-4-data:/var/www/html
- ../htmltrust-cms-reference/wordpress:/var/www/html/wp-content/plugins/content-signing
wp-5:
build:
context: .
dockerfile: Dockerfile.wordpress
networks:
- htmltrust
depends_on:
wp-db:
condition: service_healthy
environment:
WORDPRESS_DB_HOST: wp-db
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: ${WP_DB_PASSWORD:-wp_sim_local_only}
WORDPRESS_DB_NAME: wp5
volumes:
- wp-5-data:/var/www/html
- ../htmltrust-cms-reference/wordpress:/var/www/html/wp-content/plugins/content-signing
# Playwright container: runs on demand via `docker compose run playwright`
# Resolves *.htmltrust.test via Docker DNS, no host state needed
playwright:
image: mcr.microsoft.com/playwright:v1.59.1-jammy
working_dir: /workspace
volumes:
- .:/workspace
- ../htmltrust-browser-reference/build/chromium:/extension:ro
# npm records sibling file dependencies as relative symlinks. From
# /workspace/node_modules those links resolve to these root paths.
- ../htmltrust-browser-client:/htmltrust-browser-client:ro
- ../htmltrust-canonicalization:/htmltrust-canonicalization:ro
networks:
- htmltrust
environment:
E2E_DIR: /workspace
EXTENSION_PATH: /extension
NPM_CONFIG_CACHE: /tmp/.npm
# Override default command so the container stays idle; we launch scripts via `docker compose run`
entrypoint: ["sleep", "infinity"]
profiles: ["tools"] # Only starts when explicitly requested
nginx:
build:
context: .
dockerfile: Dockerfile.nginx
networks:
htmltrust:
aliases:
- author1.htmltrust.test
- author2.htmltrust.test
- author3.htmltrust.test
- author4.htmltrust.test
- author5.htmltrust.test
- author6.htmltrust.test
- author7.htmltrust.test
- author8.htmltrust.test
- author9.htmltrust.test
- author10.htmltrust.test
- trust.htmltrust.test
depends_on:
- trust-server
- wp-1
- wp-2
- wp-3
- wp-4
- wp-5
ports:
# Loopback only. This fronts five WordPress installs whose admin
# credentials are fixed sim values; publishing these ports to the whole
# network the host is on.
- "127.0.0.1:${HTMLTRUST_PROXY_PORT:-18080}:80"
- "127.0.0.1:${HTMLTRUST_TLS_PROXY_PORT:-18443}:443"
volumes:
- ./.runtime/nginx.conf:/etc/nginx/nginx.conf:ro
- ./hugo-sites:/var/www/hugo:ro