compose.yml raw
1 # A virtual network proving the swap stack: two rendezvous relays, three mock chain back ends
2 # behind two gateways, two clients that know only a relay address.
3 #
4 # relay-a, relay-b torly instances with the swaprelay write policy (tests/../deploy/policy)
5 # node-btc, node-blake, node-alt deterministic P2P nodes (nostrino-testnode)
6 # gw-a one gateway, one key, two chains (btc on node-btc, blake on node-blake)
7 # gw-b second gateway, own key, chain alt on node-alt
8 # client-a, client-b two clients on the relay network only: they cannot reach the nodes
9 #
10 # The chain networks are separate from the relay network; only the gateways join both, which is
11 # the topology the product assumes.
12
13 name: blake-swap-rig
14
15 x-torly: &torly
16 image: alpine:3.20
17 command: ["/torly", "serve"]
18 volumes:
19 - ./bin/torly:/torly:ro
20 - ./policy.json:/policy.json:ro
21 - torly-data:/data
22 environment: &torly-env
23 TORLY_LISTEN: 0.0.0.0
24 TORLY_PORT: "3334"
25 TORLY_DATA_DIR: /data
26 TORLY_POLICY_FILE: /policy.json
27 TORLY_BLOSSOM_ENABLED: "false"
28 TORLY_LOG_LEVEL: info
29 TORLY_AUTH_REQUIRED: "false"
30 TORLY_INBOUND_BYTES_PER_SEC: "16777216"
31 TORLY_QUERY_PER_SEC: "20"
32 TORLY_QUERY_BURST: "40"
33 TORLY_MAX_EVENT_BYTES: "131072"
34 networks: [relays]
35 healthcheck:
36 test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:3334/health"]
37 interval: 2s
38 timeout: 2s
39 retries: 30
40
41 x-node: &node
42 image: alpine:3.20
43 volumes:
44 - ./bin/nostrino-testnode:/nostrino-testnode:ro
45 networks: [chains]
46
47 x-gateway: &gateway
48 image: alpine:3.20
49 command:
50 - /nostrino-bridge
51 - -relay
52 - ws://relay-a:3334
53 - -relay
54 - ws://relay-b:3334
55 - -allow-command
56 - getdata,block
57 - -max-bytes-per-sec
58 - "0"
59 - -v
60 volumes:
61 - ./bin/nostrino-bridge:/nostrino-bridge:ro
62 - ./profiles:/profiles:ro
63 - gateway-data:/data
64 depends_on:
65 relay-a:
66 condition: service_healthy
67 relay-b:
68 condition: service_healthy
69 networks: [relays, chains]
70
71 services:
72 relay-a:
73 <<: *torly
74 environment:
75 <<: *torly-env
76 TORLY_RELAY_URL: ws://relay-a:3334/
77 relay-b:
78 <<: *torly
79 environment:
80 <<: *torly-env
81 TORLY_RELAY_URL: ws://relay-b:3334/
82
83 node-btc:
84 <<: *node
85 command: ["/nostrino-testnode", "-listen", "0.0.0.0:18444", "-blocks", "20"]
86 node-blake:
87 <<: *node
88 command: ["/nostrino-testnode", "-listen", "0.0.0.0:19444", "-blocks", "25"]
89 node-alt:
90 <<: *node
91 command: ["/nostrino-testnode", "-listen", "0.0.0.0:20444", "-blocks", "30"]
92
93 gw-a:
94 <<: *gateway
95 command:
96 - /nostrino-bridge
97 - -relay
98 - ws://relay-a:3334
99 - -relay
100 - ws://relay-b:3334
101 - -node
102 - btc=node-btc:18444
103 - -node
104 - blake=node-blake:19444
105 - -profile
106 - btc=/profiles/btc.json
107 - -profile
108 - blake=/profiles/blake.json
109 - -key
110 - "2222222222222222222222222222222222222222222222222222222222222222"
111 - -allow-command
112 - getdata,block
113 - -max-bytes-per-sec
114 - "0"
115 - -data
116 - /data
117 - -v
118 gw-b:
119 <<: *gateway
120 command:
121 - /nostrino-bridge
122 - -relay
123 - ws://relay-a:3334
124 - -relay
125 - ws://relay-b:3334
126 - -node
127 - alt=node-alt:20444
128 - -profile
129 - alt=/profiles/alt.json
130 - -key
131 - "3333333333333333333333333333333333333333333333333333333333333333"
132 - -allow-command
133 - getdata,block
134 - -max-bytes-per-sec
135 - "0"
136 - -data
137 - /data
138 - -v
139
140 client-a:
141 image: alpine:3.20
142 profiles: ["clients"]
143 command: ["/bin/sh", "/client.sh", "ws://relay-a:3334"]
144 volumes:
145 - ./bin:/bin-rig:ro
146 - ./client.sh:/client.sh:ro
147 - ./profiles:/profiles:ro
148 environment:
149 PATH: /bin-rig:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
150 networks: [relays]
151 client-b:
152 image: alpine:3.20
153 profiles: ["clients"]
154 command: ["/bin/sh", "/client.sh", "ws://relay-b:3334"]
155 volumes:
156 - ./bin:/bin-rig:ro
157 - ./client.sh:/client.sh:ro
158 - ./profiles:/profiles:ro
159 environment:
160 PATH: /bin-rig:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
161 networks: [relays]
162
163 networks:
164 relays:
165 chains:
166
167 volumes:
168 torly-data:
169 gateway-data:
170