Repository navigation
Expand file tree
/
Copy pathdocker-compose.e2e.yml
More file actions
2117 lines (2060 loc) · 107 KB
/
Copy pathdocker-compose.e2e.yml
File metadata and controls
2117 lines (2060 loc) · 107 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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Local full-stack E2E compose: brings up Postgres, Redis, Exchange, Broker,
# Miniflare + Fastly + AWS edges, a mock publisher origin, one host serving the
# fixed identities' key directories, and the Identity service (Go MCP adapter)
# with its Zitadel + Vault + wildcard-DNS supporting cast.
#
# make test-e2e # a fresh stack under its own project name → pytest in `runner` → down
# make e2e-up # bring the stack up (project E2E_PROJECT, default <checkout>-e2e)
# make e2e-down # take it down, volumes and network included
#
# Self-contained by construction: no service publishes a host port, and the stack
# runs on a network of its own, so any number of stacks share one Docker daemon.
# The test runner is a container on that network and reaches every service by
# name, the demo-domain aliases and the wildcard zones included. A developer who
# wants to reach the stack from the host adds docker-compose.e2e.ports.yml (make
# e2e-up E2E_HOST_PORTS=1); nothing that grades a change does.
#
# Run it through scripts/e2e-stack.sh (the Makefile targets do), never with a bare
# `docker compose -f docker-compose.e2e.yml`: the network and its addresses are
# chosen per stack and handed to this file as two variables, see the address plan
# beside the `networks:` block at the bottom.
# The wildcard-DNS sidecar every FORA service resolves *.foramcp.org through.
# Anchored so the address has ONE owner in this file: it was previously written
# out at each consumer, and five copies of an IP is five places to miss when it
# moves. An overlay cannot read an anchor of this file, so a service an overlay
# adds writes the address again; tests/e2e/harness/test_guards_publisher_sites.py
# holds every such copy equal to this one.
x-wildcard-dns: &wildcard-dns
- "${FORA_E2E_NET}.153"
# The identity service's OAuth issuer identifier. Anchored for the same reason as
# the DNS address above: three services name it, and three copies is three places
# to miss when it changes.
x-identity-issuer: &identity-issuer "http://identity"
# The console's own origin on this network. Three settings have to agree about
# it: the redirect address registered at the provider, the console's own
# CONSOLE_PUBLIC_ORIGIN, and the directory the Exchange reads this console's
# signing key from. One anchor is what keeps them agreeing.
x-console-origin: &console-origin "http://console:8085"
# The Identity Service's KV mount and its scoped Vault token. identity-vault-init
# writes the policy for this mount and creates the token with this fixed id; the
# identity service is given the same two values. The runner's
# test_identity_vault_scope.py reads them from the running identity container
# and checks what that token may do. The id is not a secret: the token reaches
# only agent keys in a throwaway dev-mode Vault.
x-identity-kv-mount: &identity-kv-mount "secret"
x-identity-vault-token: &identity-vault-token "e2e-identity-scoped-token"
# The dev-mode Vault's root token. identity-vault-init uses it to set up, and the
# runner uses it to arrange and check state the scoped token must not reach.
x-identity-vault-root-token: &identity-vault-root-token "root"
# The runner's address on this network, and the only source each Exchange's admin
# listener admits (ADMIN_ALLOWED_CIDRS). The admin plane has no request signing
# and no operator identity: the source address is its only gate (ADR-022), so it
# is opened to one address rather than to a range. The address sits in the
# upper half of the stack's /24, outside Docker's automatic range (see the
# address plan beside `networks:` at the bottom), so Docker never hands it to
# another container, and no other service declares it. Anchored so the runner's
# address and the four allowlists are one value.
# test_admin_plane.py checks that every running Exchange admits the runner and
# no other container in the stack.
x-runner-address: &runner-address "${FORA_E2E_NET}.220"
# The capture proxy's address, and the hosts-file entries that send a service's
# requests through it (ADR-028 D8 H12). A service given these entries resolves
# each name to the proxy, which records the request with its bytes and forwards
# it unchanged to the party the name names on the network's own DNS (see
# tests/e2e/capture-proxy/main.go). Nothing else about the service changes: it
# is configured with the same names, signs the same URLs and sends the same Host.
#
# The proxy is also the stack's one TLS endpoint. The Web Bot Auth profile names
# every signer by an https origin and serves every key directory over https, and
# every service here speaks plain http, so https to any name below reaches the
# proxy and is forwarded over http to the service: on the port it arrived on, or
# for 443 on the port CAPTURE_TLS_PORTS names. Every port the proxy listens on
# answers both. The names are every party that signs or serves a
# key directory: the Broker, the four Exchanges and the impostor, the console,
# the publisher edges and the static key-directory hosts. The wildcard zones
# (the identity service's agents, the suite's per-test agents and sites) reach
# the proxy through the wildcard-DNS sidecar instead, because a hosts file holds
# no wildcard.
#
# Every service that calls one of these parties carries the list, and so does
# the runner. An Exchange's admin listener admits the runner's own address only
# (x-runner-address), and a request forwarded by the proxy arrives from the
# proxy's, so the runner reaches each admin listener by its -admin alias, which
# no hosts file names. The address sits beside the sites service's and the
# Exchange impostor's, in the upper half of the stack's /24 that Docker never
# assigns on its own (see the address plan beside `networks:` at the bottom), so
# no container started without a static address can take it first.
# harness/test_capture_proxy.py proves that the legs the wire obligations read
# run through it, and that every name here answers https under the local CA.
x-capture-proxy-address: &capture-proxy-address "${FORA_E2E_NET}.187"
x-through-capture-proxy: &through-capture-proxy
exchange: *capture-proxy-address
exchange-b: *capture-proxy-address
exchange-c: *capture-proxy-address
exchange-d: *capture-proxy-address
broker: *capture-proxy-address
console: *capture-proxy-address
misbehaving-exchange: *capture-proxy-address
unapproved-exchange: *capture-proxy-address
unlisted-exchange: *capture-proxy-address
demo.fora-protocol.org: *capture-proxy-address
music.demo.fora-protocol.org: *capture-proxy-address
sfx.demo.fora-protocol.org: *capture-proxy-address
archive.demo.fora-protocol.org: *capture-proxy-address
examplenews: *capture-proxy-address
catalog-contributor-e2e: *capture-proxy-address
agent-nobilling-e2e: *capture-proxy-address
test-signer-e2e.v1: *capture-proxy-address
# How a client trusts the local CA tls-keygen mints for the proxy. SSL_CERT_FILE
# is the setting Go and Python (OpenSSL and httpx) read, and it replaces the
# default bundle file, so it names the bundle that holds the system roots AND the
# local CA. NODE_EXTRA_CA_CERTS adds to Node's built-in roots, so it names the CA
# alone. Both files live on the tls-ca volume, which every client mounts
# read-only at /tls-ca.
x-tls-ca-file: &tls-ca-file "/tls-ca/ca.pem"
x-tls-ca-bundle: &tls-ca-bundle "/tls-ca/ca-bundle.pem"
# The two settings above, as one block, for the edge containers. Node reads
# NODE_EXTRA_CA_CERTS once, at process start; the Miniflare and Fastly runtimes
# do their outbound TLS outside Node, so they are given SSL_CERT_FILE as well.
x-tls-edge-trust: &tls-edge-trust
NODE_EXTRA_CA_CERTS: *tls-ca-file
SSL_CERT_FILE: *tls-ca-bundle
# A throwaway Postgres cluster, as one unit. `make e2e-down` runs `down -v` and
# every stack-up re-inits from scratch, so nothing in PGDATA has to survive.
# Keeping the data directory in RAM with the durability work switched off takes
# the stack's Postgres write traffic off the host disk entirely — on a laptop
# that traffic is what makes the machine unresponsive during a run. size= is a
# cap, not a reservation: tmpfs allocates only the pages actually written.
#
# OPTIMIZATION: Reduced tmpfs size from 2g to 1g for e2e tests.
# Test databases are small (few tables, minimal data), 1 GiB is more than sufficient.
# Saves ~1 GiB RAM. Production databases should use persistent storage.
#
# Anchored rather than repeated, for the same reason as everything else here:
# two services want it, and the second copy was coupled to the first by a
# comment saying "same reasoning as above", which nothing enforces.
x-ephemeral-postgres: &ephemeral-postgres
command:
["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off",
"-c", "full_page_writes=off"]
tmpfs:
- /var/lib/postgresql/data:rw,size=1g
# The timing every health check in the stack shares. Docker runs a check every
# start_interval while its container is starting and still inside start_period,
# and every interval once it is healthy. A container that starts again, after a
# restart or after a test stops it, is starting again, so it is checked often
# until it answers. Readiness is still seen within 2 s, while a healthy stack
# runs about one check every three seconds in all instead of a dozen a second,
# each of them a process Docker starts inside a container.
#
# Failures inside start_period do not count against retries. The period is long
# so the frequent checks outlast a slow start on a loaded CI host. The cost: a
# service that never comes up turns unhealthy only after start_period plus
# retries x interval, so locally the up --wait timeout (E2E_WAIT_TIMEOUT) ends
# the wait first.
#
# The timeout is ten seconds, not three: six checks start a node process (the
# three edge runtimes, the two Lambda emulators and the WBA oracle), and on a
# loaded CI host node alone can take longer than three seconds to start. A long
# timeout costs nothing, because Docker starts the next check only after the
# previous one ends.
#
# start_interval needs Docker Engine 25 or later and a Compose that passes it
# on; scripts/check-compose-version.sh refuses older tools before e2e-up.
# Anchors cannot cross files, so an overlay that defines a service writes these
# values out, and tests/e2e/harness/test_guards_health_timing.py holds every
# check in every file the stack loads to them.
x-health-timing: &health-timing
interval: 60s
timeout: 10s
retries: 3
start_period: 300s
start_interval: 2s
# The three edge runtimes' check: the edge's own /healthz answering 200, read
# through a node process because their images ship node but no curl or wget.
# Not the publisher's fora.json: the edge passes that address through to the
# origin, which has a healthcheck of its own.
x-edge-healthcheck: &edge-healthcheck
<<: *health-timing
test:
- "CMD-SHELL"
- 'node -e "require(''http'').get(''http://127.0.0.1:80/healthz'', r => process.exit(r.statusCode===200?0:1)).on(''error'', () => process.exit(1))"'
# Each demo publisher's origin: the publisher service on a port of its own. Every
# port serves the same content; the port picks whose discovery documents answer
# (/.well-known/fora.json and /rsl.txt, from tests/e2e/mock-publisher/documents/,
# routed in deploy/publisher/nginx.conf). The edge in front of each publisher
# forwards to its own port. test_guards_publisher_documents.py holds these ports,
# the nginx map and the documents to one another.
x-origin-philosophy: &origin-philosophy "http://publisher:8001"
x-origin-music: &origin-music "http://publisher:8002"
x-origin-sfx: &origin-sfx "http://publisher:8003"
# The billing settings every Exchange shares, the ledger's address included:
# every Exchange bills on the one TigerBeetle cluster (the tigerbeetle service),
# and adds only its own id namespace, EXCHANGE_BILLING_TB_ID_NAMESPACE (see that
# service for why). The address must be an IP and port: the TigerBeetle client
# does not resolve hostnames, so the ledger holds a static address on this
# network.
#
# EXCHANGE_BILLING_LEDGER lists the ISO 4217 numeric codes billed in, one ledger
# each: 840 is USD and 978 is EUR. The FIRST entry is what the manifest
# advertises as base_currency, so 840 stays first.
#
# EXCHANGE_DEFAULT_AGENT_CREDIT is the welcome credit an agent receives once per
# currency, at its first Register on an Exchange whose seat activates new
# agents. It is how every funded agent gets its money: a test registers its own
# agent through the SDK, and nothing writes a balance directly. The
# Exchange reads this value once at boot and grants from it.
# This is the only place the map is written.
x-exchange-billing: &exchange-billing
FORA_BILLING_ADAPTER: "tigerbeetle"
EXCHANGE_BILLING_TB_ADDRESS: "${FORA_E2E_NET}.211:3000"
EXCHANGE_BILLING_LEDGER: "840,978"
EXCHANGE_DEFAULT_AGENT_CREDIT: "USD=100.00,EUR=100.00"
# The denomination publishers' licensing is priced in: the currency and the
# metering unit of every arrangement registered through the console, and of every
# page the catalog importer imports. exchange-a (the seat the console registers
# publishers on) and the importer get this one value, as the production template
# gives both services the same two inputs: the price a publisher sets in the
# console is the price their imported pages carry.
#
# USD because it is the base currency this stack bills in (840 is first in
# EXCHANGE_BILLING_LEDGER above), and the console's revenue totals are read in
# the base currency: a sale priced in any other currency would settle and still
# show no amounts in the publisher's totals. Which currency the totals should
# default to when a deployment prices in another one is an open product
# question; this value does not answer it, it keeps the stack out of it.
x-terms-denomination: &terms-denomination
EXCHANGE_TERMS_CURRENCY: "USD"
EXCHANGE_TERMS_UNIT: "fetches"
# What an Exchange asks a registration to carry, published in its manifest.
#
# One value, two publishers: exchange-b is where the account suite registers,
# and exchange-c publishes the SAME schema so a refusal can be observed against
# an exchange no test ever opens an account at. Deliberately identical — the
# refusal under test is about a payload missing a published member, not about
# which members a given exchange asks for — and anchored so "identical" is a
# fact rather than a comment. The value is 269 characters as written here, 267
# once compose un-escapes the two $$ pairs; edit one copy of that and the suite
# does not notice, because the test that drives the refusal reads the schema from
# exchange-c's own manifest.
#
# $$schema, not $schema: compose interpolates $NAME in a value, so the
# single-dollar form is read as an unset variable and the member is served with
# an EMPTY key. The schema still compiles that way, which is what makes the
# mistake quiet — the document is simply not the one configured. $$ is compose's
# escape for a literal dollar. The trailing $ in the email pattern needs no
# escape: compose only interpolates $ followed by a name or a brace. Both
# escapes are now written once instead of twice each, which is exactly what a
# copy-edit gets wrong.
x-registration-schema: ®istration-schema '{"$$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","required":["company_name","billing_email"],"properties":{"company_name":{"type":"string","minLength":1},"billing_email":{"type":"string","pattern":"^[^@]+@[^@]+$$"},"vat_id":{"type":"string"}}}'
# The bearer-token issuer and signing seed, as one unit. Both the identity service
# (which MINTS and verifies bearers) and the runner (whose harness mints its own,
# in tests/e2e/harness/test_mcp_endpoint.py) must agree on them exactly. Anchored
# rather than repeated because the failure mode of a second spelling is silent: a
# rotated seed on one side surfaces as an unexplained 401, not as a mismatch
# anything reports.
x-identity-auth: &identity-auth
IDENTITY_AUTH_ISSUER: *identity-issuer
# Deterministic token key so a bearer stays valid across a restart within a
# run (32-byte Ed25519 seed, base64). e2e-only, not a real secret.
IDENTITY_TOKEN_SIGNING_KEY: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
# Build args passed to Go builder stages: concurrency cap, module proxy fallback, and sumdb.
x-go-build-args: &go-build-args
- GO_BUILD_P
- GOPROXY
- GOSUMDB
services:
postgres:
image: postgres:16-alpine
<<: *ephemeral-postgres
environment:
POSTGRES_USER: fora
POSTGRES_PASSWORD: fora
POSTGRES_DB: fora
volumes:
# Multi-exchange topology (ripdi): create exchange-b/c's separate catalog
# databases (fora_b, fora_c) at cluster init, before the socket opens for
# app connections. exchange-b/c gate on `condition: service_healthy`, so
# they never race a missing DB. `down -v` wipes the volume → re-runs init.
- ./deploy/storage/postgres/10-create-exchange-dbs.sql:/docker-entrypoint-initdb.d/10-create-exchange-dbs.sql:ro
healthcheck:
<<: *health-timing
# -h 127.0.0.1 forces a TCP check: during first-boot init (creating the
# extra databases) postgres listens only on the unix socket, and a
# socket-based pg_isready would report healthy while TCP 5432 is still
# closed — letting the exchanges start and hit connection-refused. Checking
# TCP keeps the container unhealthy until it actually accepts app connections.
test: ["CMD-SHELL", "pg_isready -U fora -d fora -h 127.0.0.1"]
redis:
image: redis:7-alpine
command: ["redis-server", "--save", "", "--loglevel", "warning"]
healthcheck:
<<: *health-timing
test: ["CMD", "redis-cli", "ping"]
publisher:
image: nginx:alpine
volumes:
- ./tests/e2e/mock-publisher/content:/usr/share/nginx/html:ro
# Phase-2 demo content tree, served by PATH alongside the baseline tree.
# Mounted under its OWN docroot (/usr/share/nginx/demo) — NOT under the
# read-only baseline docroot, which the daemon cannot create child
# mountpoints in. deploy/publisher/nginx.conf routes the demo path
# prefixes (/articles, /lyrics, /tracks, /sfx) to this tree. The edge
# forwards the signed-URL path verbatim to ORIGIN_URL (its publisher's
# port, x-origin-*), so these mounts are what the canary fetch reads.
- ./deploy/content/demo:/usr/share/nginx/demo:ro
# Each demo publisher's own discovery documents, one directory per
# publisher domain, answered on that publisher's port (x-origin-*).
- ./tests/e2e/mock-publisher/documents:/usr/share/nginx/documents:ro
- ./deploy/publisher/nginx.conf:/etc/nginx/nginx.conf:ro
healthcheck:
<<: *health-timing
test: ["CMD-SHELL", "wget -q -O- http://127.0.0.1/premium/article-42.html || exit 1"]
# ───── Static key directories: one host for every fixed identity ─────
# One nginx (deploy/publisher-jwks) serves the discovery documents of every
# identity the stack holds fixed: its Web Bot Auth key directory and its
# fora.json overlay. There is no static key registry: every signing identity
# publishes its own keys at its own host name, and the Exchanges and the Broker
# learn a key only by fetching the signer's directory, the same path production
# uses. So each identity keeps a host name of its own, one of the aliases below;
# for an agent it equals the identity's kid, which the harness sends as the
# covered Signature-Agent header. The entrypoint serves each identity's
# documents under its own name only, and a request under any other name gets
# 404 and no keys.
#
# Each key is mounted as its own read-only file at /keys/<host>.json, which is
# how the entrypoint learns the hosts. Never mount the fixtures directory: it
# would carry every private key in it, the broker relay key included, into a
# container whose job is serving public documents. A key mounted under the wrong
# host's name stops the container at start, because the entrypoint refuses a
# key whose issuer is not its host.
#
# The identities:
# * examplenews: the demo subscription publisher (its key comes from
# scripts/gen-examplenews-publisher-key.sh). Its fora.json lists the
# harness contributor and advertises exchange-a, because the Broker's
# publisher probe refuses a resolve with NOT_IN_CATALOG when a publisher
# lists no exchanges, even though the contributor is listed;
# * catalog-contributor-e2e: the third-party catalog contributor. The
# Exchange's self-signup (agentreg.RegisterFromDirectory) fetches its
# directory to learn the contributor's key, with NO fora.agents pre-seed,
# and the demo publishers list it in the fora.json their origin serves. A
# self-hosting
# contributor authorizes no third party of its own, so its list is empty;
# * archive.demo.fora-protocol.org: the archive publisher (Lyceum Archive, a
# fictional cast member like the other demo publishers), the one site
# exchange-d sells. It has no edge and no content route. Its directory
# holds the publisher's self-publish key, which exchange-d fetches to
# verify the seed's catalog push, and its fora.json names exchange-d,
# which is what the Broker reads to route a resolve of an archive URI;
# * agent-nobilling-e2e: the deliberately-unfunded buyer for the billing
# deny-path obligations;
# * test-signer-e2e.v1: a static agent identity that stays served, although
# no current test signs as it. Its dotted kid is why the entrypoint takes
# each manifest's domain from the key's issuer and never from the kid.
# PUBLISHER_HOSTS_JSON holds the manifest fields of the three publishers; a
# host it does not name is served as an agent.
key-directories:
build:
# Repo-root context (the same shape the service images use) so the
# Dockerfile can copy scripts/lib/ed25519_keys.py — the entrypoint renders
# each WBA directory through the same shared helpers the key-gen scripts
# use, instead of a shell-side copy kept in sync by hand.
context: .
dockerfile: deploy/publisher-jwks/Dockerfile
environment:
PUBLISHER_HOSTS_JSON: >-
{"examplenews": {"exchanges": [{"domain": "exchange:8081",
"endpoint": "http://exchange:8081",
"supported_profiles": ["fora-news-v1", "fora-comp-v1", "fora-music-v1"],
"ext": {"resource_owner_id": "demo-resource-owner"}}]},
"catalog-contributor-e2e": {"catalog_contributors": []},
"archive.demo.fora-protocol.org": {"exchanges": [{"domain": "exchange-d:8081",
"endpoint": "http://exchange-d:8081",
"supported_profiles": ["fora-news-v1", "fora-comp-v1", "fora-music-v1"],
"ext": {"resource_owner_id": "demo-resource-owner"}}]}}
volumes:
- ./deploy/publisher-keys/examplenews-subscription-key.json:/keys/examplenews.json:ro
- ./tests/e2e/harness/fixtures/catalog_contributor_key.json:/keys/catalog-contributor-e2e.json:ro
- ./tests/e2e/harness/fixtures/selfpub_archive_key.json:/keys/archive.demo.fora-protocol.org.json:ro
- ./tests/e2e/harness/fixtures/agent_nobilling_e2e_key.json:/keys/agent-nobilling-e2e.json:ro
- ./tests/e2e/harness/fixtures/test_signer_key.json:/keys/test-signer-e2e.v1.json:ro
healthcheck:
<<: *health-timing
test: ["CMD-SHELL", "wget -q -O- http://127.0.0.1/healthz || exit 1"]
networks:
default:
aliases:
- examplenews
- catalog-contributor-e2e
- archive.demo.fora-protocol.org
- agent-nobilling-e2e
- test-signer-e2e.v1
# One-shot: generate ephemeral signing keys into a shared volume at stack-up so
# nothing is committed to git. Mints (a) the AWS_CLOUDFRONT_RSA tenant RSA pair —
# the Exchange reads the private half (FORA_RSA_PRIVATE_PEM_FILE), the aws-edge
# CloudFront shim the public half (FORA_CF_PUBLIC_PEM_FILE); and (b) the Ed25519
# offer/URL signing key the Exchange reads via FORA_ED25519_PRIVATE_PEM_FILE.
# The Exchange no longer generates keys in-process (it fails closed when unset),
# so this one-shot is what provisions them for the stack. Mirrors the
# cold-start key derivation of the key-directories service.
rsa-keygen:
image: alpine:3.20
command:
- sh
- -c
- |
set -eu
apk add --no-cache openssl >/dev/null
# exchange-a keys (unchanged names — exchange-a's identity is preserved).
openssl genrsa -out /rsa-keys/rsa-private.pem 2048
openssl rsa -in /rsa-keys/rsa-private.pem -pubout -out /rsa-keys/rsa-public.pem
openssl genpkey -algorithm ED25519 -out /rsa-keys/ed25519-private.pem
# exchange-b / exchange-c keys (ripdi): distinct ed25519 offer keys +
# distinct RSA URL-signing keys per exchange, so each /.well-known/fora.json
# serves a DISTINCT offer key and an offer signed by one exchange cannot be
# verified against another's manifest.
openssl genrsa -out /rsa-keys/rsa-b-private.pem 2048
openssl rsa -in /rsa-keys/rsa-b-private.pem -pubout -out /rsa-keys/rsa-b-public.pem
openssl genpkey -algorithm ED25519 -out /rsa-keys/ed25519-b-private.pem
openssl genrsa -out /rsa-keys/rsa-c-private.pem 2048
openssl rsa -in /rsa-keys/rsa-c-private.pem -pubout -out /rsa-keys/rsa-c-public.pem
openssl genpkey -algorithm ED25519 -out /rsa-keys/ed25519-c-private.pem
# exchange-d: its own offer key, for the same reason. No RSA pair: its
# seat sells only an ED25519 site, and the Exchange boots without an RSA
# key, deferring the refusal to the first CloudFront-scheme mint.
openssl genpkey -algorithm ED25519 -out /rsa-keys/ed25519-d-private.pem
chmod 0444 /rsa-keys/rsa-private.pem /rsa-keys/rsa-public.pem /rsa-keys/ed25519-private.pem \
/rsa-keys/rsa-b-private.pem /rsa-keys/rsa-b-public.pem /rsa-keys/ed25519-b-private.pem \
/rsa-keys/rsa-c-private.pem /rsa-keys/rsa-c-public.pem /rsa-keys/ed25519-c-private.pem \
/rsa-keys/ed25519-d-private.pem
echo "rsa-keygen: wrote rsa+ed25519 keypairs for exchange a/b/c/d"
volumes:
- rsa-keys:/rsa-keys
restart: "no"
# One-shot: mint the local CA and the capture proxy's TLS certificate at
# stack-up, the same way rsa-keygen mints signing keys, so no private key is
# committed. The CA certificate goes to tls-ca, which every client mounts; the
# proxy's certificate and key go to tls-proxy-keys, which only the proxy
# mounts. See tests/e2e/capture-proxy/tls-keygen.sh.
tls-keygen:
image: alpine/openssl:3.3.2
entrypoint: ["sh", "/tls-keygen.sh"]
user: "0"
volumes:
- ./tests/e2e/capture-proxy/tls-keygen.sh:/tls-keygen.sh:ro
- tls-ca:/tls-ca
- tls-proxy-keys:/tls-proxy
restart: "no"
# ───── Billing ledger: one TigerBeetle for every Exchange ────────────
# One single-replica TigerBeetle cluster, which all four Exchanges bill on.
# TigerBeetle has no schemas: an account or transfer id is unique in the whole
# cluster, not per ledger. The platform fee and liquidity accounts are derived
# from fixed names, and a resource owner's revenue account from the owner's id
# alone, and every seat here sells for the same owner, so two Exchanges that
# derived the same ids would post into the same accounts, and every balance
# test would still pass. Each Exchange therefore salts every id it derives
# with its own namespace, EXCHANGE_BILLING_TB_ID_NAMESPACE, set to its own
# service name. Only the e2e build reads that setting; a production build
# refuses to start with it, so production ids stay unsalted.
#
# Every Exchange start registers a new client session, and the cluster keeps
# at most 64: once it is full, it evicts the session that committed a request
# longest ago. The suite's Exchange restarts stay far below that.
#
# The data file lives on a named volume that `make e2e-down` (`down -v`)
# deletes, so every stack starts with an empty ledger. Not tmpfs, unlike
# Postgres: `format` allocates the whole data file up front (about 1 GiB), and
# on tmpfs that is RAM. The format step is skipped when the file exists, so a
# restarted replica keeps its balances.
#
# seccomp=unconfined and IPC_LOCK are what TigerBeetle's Docker guide asks
# for: Docker >= 25 blocks io_uring in its default seccomp profile, and the
# capability lets the replica lock memory. --development relaxes the Direct IO
# requirement a Docker volume cannot meet. --cache-grid is the one memory knob
# that is not marked experimental, and the replica refuses a value of 32MiB or
# less. It still holds about 1.5 GiB, most of it buffers allocated at start
# whatever the load, which is why the stack runs one cluster and not one per
# Exchange.
#
# The static address sits in the upper half of the stack's /24, outside
# Docker's automatic range, so no dynamically addressed container can take it
# first.
#
# The health check proves the replica accepts connections, and format runs
# before start, so the port opening is the honest readiness edge. The
# Exchanges connect at boot and refuse to start when the ledger does not
# answer, which is why each waits for it to be healthy.
tigerbeetle:
image: ghcr.io/tigerbeetle/tigerbeetle:0.17.8
entrypoint: ["sh", "-c"]
command:
- |
set -e
[ -f /data/0_0.tigerbeetle ] || /tigerbeetle format --cluster=0 --replica=0 --replica-count=1 --development /data/0_0.tigerbeetle
exec /tigerbeetle start --addresses=0.0.0.0:3000 --cache-grid=64MiB --development /data/0_0.tigerbeetle
security_opt:
- "seccomp=unconfined"
cap_add:
- "IPC_LOCK"
healthcheck:
<<: *health-timing
test: ["CMD", "nc", "-z", "127.0.0.1", "3000"]
volumes:
- tigerbeetle-data:/data
networks:
default:
ipv4_address: ${FORA_E2E_NET}.211
# ───── FORA services ─────────────────────────────────────────────────
exchange:
build:
context: .
dockerfile: src/exchange/Dockerfile
# The e2e image: the binary is built with the e2e tag, so it carries the
# e2e-only control service on its admin listener (ADR-028 D6). Production
# builds the file's default target, which has no such route.
target: e2e
args: *go-build-args
dns: *wildcard-dns
# Its requests to the Broker and the Exchanges run through the capture
# proxy; see x-through-capture-proxy.
extra_hosts: *through-capture-proxy
# The TigerBeetle client inside the Exchange uses io_uring too, so the
# Exchange needs the same seccomp exception as its ledger, or the client
# fails to initialize its IO at boot.
security_opt:
- "seccomp=unconfined"
environment:
EXCHANGE_DSN: "postgres://fora:fora@postgres:5432/fora?sslmode=disable"
# Set explicitly (INFO is also the default) so every stack boot drives
# the level parser in the real container; the same holds for the
# Broker, Identity and the other Exchanges below.
EXCHANGE_LOG_LEVEL: "INFO"
# System-of-Record account registry. FORA_SOR_ADAPTER
# defaults to "postgres", which requires a SEPARATE logical database
# (distinct from EXCHANGE_DSN): the Exchange opens a second pool and runs
# the SoR migrations at boot, but never CREATE DATABASEs — fora_sor is
# pre-created by deploy/storage/postgres/10-create-exchange-dbs.sql at init.
EXCHANGE_SOR_DSN: "postgres://fora:fora@postgres:5432/fora_sor?sslmode=disable"
EXCHANGE_ADDR: ":8081"
# Re-package: Offer.exchange (minted from EXCHANGE_DOMAIN) is the
# broker's routing key — it must be a host the broker can fetch
# /.well-known/fora.json from in the compose network, so it is the
# service host:port (the well-known fetch URL carries no port). The manifest
# advertises EXCHANGE_PUBLIC_ORIGIN as the top-level endpoint; it MUST equal
# the endpoint the broker's registry and the demo publishers' fora.json
# name for this Exchange, for the post-resolve SSRF equality gate.
EXCHANGE_DOMAIN: "exchange:8081"
# The seat whose "activate new agents automatically" policy a registration
# reads. A tenant row is the Exchange seat, so its domain is this
# exchange's own hostname and this value repeats EXCHANGE_DOMAIN above.
# It is stated rather than left to the binary's EXCHANGE_DOMAIN fallback
# so the seat the exchange reads is written where its boot fixture and
# the compose guard can compare it. Point it at anything else — a
# publisher's domain, the way it read before the seat existed — and it
# matches no tenant row: every fora_register is then refused, and the
# exchange says so only in a boot warning.
EXCHANGE_DEFAULT_TENANT: "exchange:8081"
# The rows this exchange creates at start-up when they are absent: its
# seat, the second seat the tenant-isolation suite names, the payee, the
# site it sells and that site's ACTIVE listing (ADR-029). The file and the
# terms it names are mounted read-only below; the harness writes no row.
EXCHANGE_BOOT_FIXTURE_FILE: "/boot/fixture.yml"
EXCHANGE_PUBLIC_ORIGIN: "http://exchange:8081"
# The admin listener (:8082) admits the runner only; see x-runner-address.
ADMIN_ALLOWED_CIDRS: *runner-address
# Billing on the stack's one TigerBeetle cluster, under this exchange's
# own id namespace (see the tigerbeetle service and the
# x-exchange-billing anchor). A buyer holds money only after it registers
# here and receives the welcome credit; a buyer with no money is refused
# INSUFFICIENT_BALANCE, which is the deny path the credit-less-buyer
# obligation needs. The denomination is the console seat's (see
# x-terms-denomination); only this exchange registers publishers.
<<: [*exchange-billing, *terms-denomination]
EXCHANGE_BILLING_TB_ID_NAMESPACE: "exchange"
# Single scheme knob for the well-known / manifest-fetch resolver (HTTPS is
# the default; the services here serve plain http).
FORA_WELLKNOWN_SCHEME: "http"
# The SSRF guard on every outbound .well-known fetch (agent registration,
# contributor-authz, broker revocation poll) blocks private/loopback hosts
# by default; the compose network is private + http, so permit it here.
# MUST stay unset in production.
SKIP_SSRF: "true"
ALLOW_INSECURE: "true"
# Revocation-aware key resolution: the Exchange polls the Broker's
# well-known + invalidation_url so a Broker-revoked kid is rejected, and
# resolves the Broker relay key from the same directory. The Broker's
# directory is the revocation authority; when it is unreachable the
# Exchange fails closed (rejects) rather than trusting any other source.
EXCHANGE_BROKER_WELLKNOWN_URL: "https://broker/.well-known/fora.json"
# Turns the publisher-registration routes on, and names the directory the
# console's signing key is read from. The console serves it at its own
# origin, so these two settings and the console's CONSOLE_PUBLIC_ORIGIN
# name one place.
EXCHANGE_CONSOLE_WELLKNOWN_URL: "https://console/.well-known/http-message-signatures-directory"
# The catalogue contributor this deployment operates. Every manifest the
# console generates names it, and a domain check does not pass until the
# publisher's own file does.
EXCHANGE_CATALOG_CONTRIBUTOR_HOST: "catalog-contributor-e2e"
# Poll the Broker's revocation channel frequently so the revocation
# obligations (harness/obligations/test_revocation_scope.py) observe a
# freshly-published Broker list within a bounded wait. Production uses a
# longer interval.
EXCHANGE_REVOCATION_POLL_INTERVAL: "1s"
# EXCHANGE_CATALOG_URI_SCHEME overrides the https:// default that
# entryFromProto materializes into stored catalog URIs. The demo sites here
# serve plain http; production leaves this unset.
EXCHANGE_CATALOG_URI_SCHEME: "http"
# RSA private key for the AWS_CLOUDFRONT_RSA tenant scheme, read from a file
# the rsa-keygen one-shot writes into a shared volume at stack-up (the key
# is no longer committed to git). The aws-edge CloudFront shim reads the
# matching public half from the same volume — mirroring a CloudFront trusted
# key group now that the cdn-keys.json route is retired (D4). Production
# sources tenant signing keys from a secret store.
FORA_RSA_PRIVATE_PEM_FILE: "/rsa-keys/rsa-private.pem"
# Ed25519 offer/URL signing key, also written by the rsa-keygen one-shot.
# The Exchange fails closed when no key is configured (it no longer mints an
# ephemeral key in-process), so this file injection is mandatory for the
# stack. Production wires FORA_ED25519_PRIVATE_PEM from Secrets Manager.
FORA_ED25519_PRIVATE_PEM_FILE: "/rsa-keys/ed25519-private.pem"
# Trusts the local CA tls-keygen mints (x-tls-ca-bundle).
SSL_CERT_FILE: *tls-ca-bundle
volumes:
- rsa-keys:/rsa-keys:ro
- tls-ca:/tls-ca:ro
- ./tests/e2e/harness/fixtures/exchange-boot/exchange.yml:/boot/fixture.yml:ro
- ./testdata/free-listing-terms.json:/boot/free-listing-terms.json:ro
depends_on:
capture-proxy:
condition: service_healthy
dns:
condition: service_healthy
postgres:
condition: service_healthy
key-directories:
condition: service_healthy
rsa-keygen:
condition: service_completed_successfully
tigerbeetle:
condition: service_healthy
# No healthcheck: distroless image ships only the /exchange binary — no
# shell, no wget/curl. Downstream services use depends_on:service_started.
# The name the runner reaches this Exchange's admin listener by. No hosts
# file points it at the capture proxy, so the runner's admin calls arrive
# from the runner's own address (see x-through-capture-proxy).
networks:
default:
aliases:
- exchange-admin
# ───── exchange-b (music) — SEPARATE catalog DB fora_b (ripdi) ─────────────
# A copy of `exchange` (= exchange-a) with its OWN catalog database, OWN
# offer/URL signing keys, and OWN identity (EXCHANGE_DOMAIN/PUBLIC_ORIGIN). The
# music publisher's fora.json (served by its origin, behind fastly-edge) names
# exchange-b, so the broker routes music offers here. It bills on the shared ledger under
# its OWN id namespace. The httpsig key set, fetch overrides and
# broker-revocation poll are identical to exchange-a.
exchange-b:
build:
context: .
dockerfile: src/exchange/Dockerfile
target: e2e
args: *go-build-args
dns: *wildcard-dns
# Its requests to the Broker and the Exchanges run through the capture
# proxy; see x-through-capture-proxy.
extra_hosts: *through-capture-proxy
# io_uring for the ledger client; see exchange-a.
security_opt:
- "seccomp=unconfined"
environment:
EXCHANGE_DSN: "postgres://fora:fora@postgres:5432/fora_b?sslmode=disable"
EXCHANGE_LOG_LEVEL: "INFO"
# Own SoR registry DB (see exchange-a). fora_sor_b is pre-created at init.
EXCHANGE_SOR_DSN: "postgres://fora:fora@postgres:5432/fora_sor_b?sslmode=disable"
EXCHANGE_ADDR: ":8081"
EXCHANGE_DOMAIN: "exchange-b:8081"
# This exchange's own seat (see exchange-a).
EXCHANGE_DEFAULT_TENANT: "exchange-b:8081"
# Its seat, the payee, the site it sells and that site's ACTIVE listing,
# created at start-up when absent (ADR-029; see exchange-a).
EXCHANGE_BOOT_FIXTURE_FILE: "/boot/fixture.yml"
EXCHANGE_PUBLIC_ORIGIN: "http://exchange-b:8081"
# The admin listener (:8082) admits the runner only; see x-runner-address.
ADMIN_ALLOWED_CIDRS: *runner-address
# Its own id namespace on the shared ledger; see exchange-a.
<<: *exchange-billing
EXCHANGE_BILLING_TB_ID_NAMESPACE: "exchange-b"
FORA_WELLKNOWN_SCHEME: "http"
SKIP_SSRF: "true"
ALLOW_INSECURE: "true"
EXCHANGE_BROKER_WELLKNOWN_URL: "https://broker/.well-known/fora.json"
# The same one-second poll of the Broker's revocation list as exchange-a, so
# a revocation of the Broker's key, and its withdrawal, reach every Exchange
# within the revocation obligations' bounded waits.
EXCHANGE_REVOCATION_POLL_INTERVAL: "1s"
EXCHANGE_CATALOG_URI_SCHEME: "http"
# One of the two exchanges in this stack that ask for registration details,
# so the suites cover both contracts against something real: this one and
# exchange-c publish a schema and a terms revision, exchange-a publishes
# neither and keeps the pass-through behaviour every exchange had before
# the block existed. exchange-a is left bare deliberately — it is what
# every other suite transacts against, and changing it would change tests
# this has nothing to do with.
#
# This one is where the account suite REGISTERS. exchange-c publishes the
# same schema so a refusal can be observed against an exchange no test ever
# opens an account at; see the note there.
#
# NOTE: publishing the schema is what turns enforcement on, so this exchange
# refuses a payload that does not match it. The identity adapter also
# pre-checks against the same schema before it signs, so in practice a
# non-conforming payload is stopped there first and never reaches here.
EXCHANGE_REGISTRATION_SCHEMA: *registration-schema
EXCHANGE_TERMS_URI: "http://exchange-b:8081/terms/2026-04"
# SHA-256 of the string "test" — a real digest of a real input, so it can
# be reproduced rather than trusted.
EXCHANGE_TERMS_DIGEST: "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
# Distinct ed25519 + RSA key MATERIAL (per exchange) so the well-known
# serves a distinct offer key. Key REF names are kept identical to
# exchange-a so the per-DB seat rows, which each boot fixture declares with
# the same refs, resolve.
FORA_RSA_PRIVATE_PEM_FILE: "/rsa-keys/rsa-b-private.pem"
FORA_ED25519_PRIVATE_PEM_FILE: "/rsa-keys/ed25519-b-private.pem"
# Trusts the local CA tls-keygen mints (x-tls-ca-bundle).
SSL_CERT_FILE: *tls-ca-bundle
volumes:
- rsa-keys:/rsa-keys:ro
- tls-ca:/tls-ca:ro
- ./tests/e2e/harness/fixtures/exchange-boot/exchange-b.yml:/boot/fixture.yml:ro
- ./testdata/free-listing-terms.json:/boot/free-listing-terms.json:ro
depends_on:
capture-proxy:
condition: service_healthy
dns:
condition: service_healthy
postgres:
condition: service_healthy
key-directories:
condition: service_healthy
rsa-keygen:
condition: service_completed_successfully
tigerbeetle:
condition: service_healthy
# The name the runner reaches this Exchange's admin listener by. No hosts
# file points it at the capture proxy, so the runner's admin calls arrive
# from the runner's own address (see x-through-capture-proxy).
networks:
default:
aliases:
- exchange-b-admin
# ───── exchange-c (sfx) — SEPARATE catalog DB fora_c (ripdi) ───────────────
# A copy of `exchange` with its OWN catalog database (fora_c), OWN signing keys,
# and OWN identity. The sfx publisher's fora.json (served by its origin, behind
# aws-edge) names exchange-c, so the broker routes sfx offers here.
exchange-c:
build:
context: .
dockerfile: src/exchange/Dockerfile
target: e2e
args: *go-build-args
dns: *wildcard-dns
# Its requests to the Broker and the Exchanges run through the capture
# proxy; see x-through-capture-proxy.
extra_hosts: *through-capture-proxy
# io_uring for the ledger client; see exchange-a.
security_opt:
- "seccomp=unconfined"
environment:
EXCHANGE_DSN: "postgres://fora:fora@postgres:5432/fora_c?sslmode=disable"
EXCHANGE_LOG_LEVEL: "INFO"
# Own SoR registry DB (see exchange-a). fora_sor_c is pre-created at init.
EXCHANGE_SOR_DSN: "postgres://fora:fora@postgres:5432/fora_sor_c?sslmode=disable"
EXCHANGE_ADDR: ":8081"
EXCHANGE_DOMAIN: "exchange-c:8081"
# This exchange's own seat (see exchange-a).
EXCHANGE_DEFAULT_TENANT: "exchange-c:8081"
# Its seat, the payee, the site it sells and that site's ACTIVE listing,
# created at start-up when absent (ADR-029; see exchange-a).
EXCHANGE_BOOT_FIXTURE_FILE: "/boot/fixture.yml"
EXCHANGE_PUBLIC_ORIGIN: "http://exchange-c:8081"
# The admin listener (:8082) admits the runner only; see x-runner-address.
ADMIN_ALLOWED_CIDRS: *runner-address
# Its own id namespace on the shared ledger; see exchange-a.
<<: *exchange-billing
EXCHANGE_BILLING_TB_ID_NAMESPACE: "exchange-c"
FORA_WELLKNOWN_SCHEME: "http"
SKIP_SSRF: "true"
ALLOW_INSECURE: "true"
EXCHANGE_BROKER_WELLKNOWN_URL: "https://broker/.well-known/fora.json"
# The same one-second poll of the Broker's revocation list as exchange-a, so
# a revocation of the Broker's key, and its withdrawal, reach every Exchange
# within the revocation obligations' bounded waits.
EXCHANGE_REVOCATION_POLL_INTERVAL: "1s"
EXCHANGE_CATALOG_URI_SCHEME: "http"
# THE ACCOUNT SUITE'S AGENT NEVER REGISTERS HERE. This exchange is that
# agent's reserved never-registered target, and that reservation is what
# lets a refusal be asserted as a TOTAL — "no account exists here" —
# instead of as a before-and-after comparison that cannot fail. Other
# agents do hold accounts here: the seed registers its credit-less buyer,
# and tests register their own agents. Accounts are per agent, so none of them
# touches the reservation.
#
# It cannot fail against an exchange the suite already holds an account at,
# because Register is idempotent: a row that already carries a billing
# reference takes a fast path and returns the same handle whether or not
# the pre-check let the request through. So the comparison stays equal
# either way, and the assertion proves nothing.
#
# The same schema exchange-b publishes; see the anchor for why one value
# serves both. Publishing it turns enforcement on here too, but the identity
# adapter pre-checks against the same schema before signing, so a
# non-conforming payload is stopped there and never reaches this exchange.
EXCHANGE_REGISTRATION_SCHEMA: *registration-schema
EXCHANGE_TERMS_URI: "http://exchange-c:8081/terms/2026-04"
# SHA-256 of the single byte "b", so this exchange's terms revision is a
# different real digest from exchange-b's rather than a copy of it.
EXCHANGE_TERMS_DIGEST: "sha256:3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d"
FORA_RSA_PRIVATE_PEM_FILE: "/rsa-keys/rsa-c-private.pem"
FORA_ED25519_PRIVATE_PEM_FILE: "/rsa-keys/ed25519-c-private.pem"
# Trusts the local CA tls-keygen mints (x-tls-ca-bundle).
SSL_CERT_FILE: *tls-ca-bundle
volumes:
- rsa-keys:/rsa-keys:ro
- tls-ca:/tls-ca:ro
- ./tests/e2e/harness/fixtures/exchange-boot/exchange-c.yml:/boot/fixture.yml:ro
- ./testdata/free-listing-terms.json:/boot/free-listing-terms.json:ro
depends_on:
capture-proxy:
condition: service_healthy
dns:
condition: service_healthy
postgres:
condition: service_healthy
key-directories:
condition: service_healthy
rsa-keygen:
condition: service_completed_successfully
tigerbeetle:
condition: service_healthy
# The name the runner reaches this Exchange's admin listener by. No hosts
# file points it at the capture proxy, so the runner's admin calls arrive
# from the runner's own address (see x-through-capture-proxy).
networks:
default:
aliases:
- exchange-c-admin
# ───── exchange-d (archive) — the seat that REFUSES the Broker relay ────────
# A copy of `exchange` with its OWN catalog database (fora_d), OWN offer key,
# OWN identity and OWN id namespace on the shared ledger. It sells the archive
# publisher's site, whose manifest (served by key-directories) names this
# exchange.
#
# What sets it apart is in its boot fixture, not here: the fixture declares
# its seat with allow_broker_relay false, so a purchase the Broker relays here
# is refused with DENIAL_REASON_RELAY_NOT_ACCEPTED while the same offer bought
# directly succeeds. The opt-out is declared rather than toggled by a test, so
# no test can leave it flipped for the next one. Every other exchange's seat
# opts in.
exchange-d:
build:
context: .
dockerfile: src/exchange/Dockerfile
target: e2e
args: *go-build-args
dns: *wildcard-dns
# Its requests to the Broker and the Exchanges run through the capture
# proxy; see x-through-capture-proxy.
extra_hosts: *through-capture-proxy
# io_uring for the ledger client; see exchange-a.
security_opt:
- "seccomp=unconfined"
environment:
EXCHANGE_DSN: "postgres://fora:fora@postgres:5432/fora_d?sslmode=disable"
EXCHANGE_LOG_LEVEL: "INFO"
# Own SoR registry DB (see exchange-a). fora_sor_d is pre-created at init.
EXCHANGE_SOR_DSN: "postgres://fora:fora@postgres:5432/fora_sor_d?sslmode=disable"
EXCHANGE_ADDR: ":8081"
EXCHANGE_DOMAIN: "exchange-d:8081"
# This exchange's own seat (see exchange-a).
EXCHANGE_DEFAULT_TENANT: "exchange-d:8081"
# Its seat, the payee, the site it sells and that site's ACTIVE listing,
# created at start-up when absent (ADR-029; see exchange-a).
EXCHANGE_BOOT_FIXTURE_FILE: "/boot/fixture.yml"
EXCHANGE_PUBLIC_ORIGIN: "http://exchange-d:8081"
# The admin listener (:8082) admits the runner only; see x-runner-address.
ADMIN_ALLOWED_CIDRS: *runner-address
# Its own id namespace on the shared ledger; see exchange-a.
<<: *exchange-billing
EXCHANGE_BILLING_TB_ID_NAMESPACE: "exchange-d"
FORA_WELLKNOWN_SCHEME: "http"
SKIP_SSRF: "true"
ALLOW_INSECURE: "true"
EXCHANGE_BROKER_WELLKNOWN_URL: "https://broker/.well-known/fora.json"
# The same one-second poll of the Broker's revocation list as exchange-a, so
# a revocation of the Broker's key, and its withdrawal, reach every Exchange
# within the revocation obligations' bounded waits.
EXCHANGE_REVOCATION_POLL_INTERVAL: "1s"
EXCHANGE_CATALOG_URI_SCHEME: "http"
# No RSA key: the archive site is an ED25519 site (see rsa-keygen).
FORA_ED25519_PRIVATE_PEM_FILE: "/rsa-keys/ed25519-d-private.pem"
# Trusts the local CA tls-keygen mints (x-tls-ca-bundle).
SSL_CERT_FILE: *tls-ca-bundle
volumes:
- rsa-keys:/rsa-keys:ro
- tls-ca:/tls-ca:ro
- ./tests/e2e/harness/fixtures/exchange-boot/exchange-d.yml:/boot/fixture.yml:ro
- ./testdata/free-listing-terms.json:/boot/free-listing-terms.json:ro
depends_on:
capture-proxy:
condition: service_healthy
dns:
condition: service_healthy
postgres:
condition: service_healthy
# Among the directories it serves is the archive publisher's: the seed's
# ingest signs as that publisher, and this exchange learns the key only by
# fetching it.
key-directories:
condition: service_healthy
rsa-keygen:
condition: service_completed_successfully
tigerbeetle:
condition: service_healthy
# The name the runner reaches this Exchange's admin listener by. No hosts
# file points it at the capture proxy, so the runner's admin calls arrive
# from the runner's own address (see x-through-capture-proxy).
networks:
default:
aliases:
- exchange-d-admin
# ───── Fake Bedrock Runtime ──────────────────────────────────────
# Answers the Broker's Converse calls from a fixed script keyed on the query,
# so the catalog search runs through the real adapter and AWS SDK without a
# model. See tests/e2e/fake-bedrock/server.py for the script format.
fake-bedrock:
image: python:3.12-alpine
command: ["python", "/app/server.py"]
environment:
FAKE_BEDROCK_SCRIPT: "/app/script.json"
volumes:
- ./tests/e2e/fake-bedrock/server.py:/app/server.py:ro
- ./tests/e2e/harness/fixtures/bedrock_script.json:/app/script.json:ro
healthcheck:
<<: *health-timing
test: ["CMD-SHELL", "wget -q -O- http://127.0.0.1:8090/healthz || exit 1"]
broker:
build:
context: .
dockerfile: src/broker/Dockerfile
args: *go-build-args
dns: *wildcard-dns
extra_hosts:
# Its requests to the Exchanges run through the capture proxy; see
# x-through-capture-proxy.
<<: *through-capture-proxy
# On Linux, Docker doesn't auto-wire this; make it explicit so the
# Broker can probe edge URIs authored with host.docker.internal.
host.docker.internal: host-gateway
environment:
BROKER_DSN: "postgres://fora:fora@postgres:5432/fora?sslmode=disable"
BROKER_LOG_LEVEL: "INFO"
# The Exchanges the Broker routes to, upserted into its registry at every
# boot. The registry has no write API, so its configuration file is how
# this stack, like any deployment, tells the Broker which Exchanges exist.
BROKER_REGISTRY_FILE: "/registry/exchanges.yml"
REDIS_URL: "redis://redis:6379/0"
BROKER_ADDR: ":8082"
BROKER_ID: "broker-e2e"
BROKER_DOMAIN: "broker:8082"
# The https origin every request the Broker signs names as its