-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
244 lines (233 loc) · 7.79 KB
/
docker-compose.test.yml
File metadata and controls
244 lines (233 loc) · 7.79 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
networks:
tanda-ln-test-net:
driver: bridge
volumes:
bitcoind-data-test:
cln-coordinator-data-test:
cln-p0-data-test:
cln-p1-data-test:
cln-p2-data-test:
# Usage:
# docker compose -f docker-compose.test.yml up --build --exit-code-from test-runner
#
# The test-runner service replaces the demo coordinator: it runs pytest against
# the live CLN stack and exits 0 on success, 1 on failure.
#
# CLN nodes wipe their regtest/ database on every container start so the stack
# is always in a clean, consistent state regardless of previous runs.
# Bitcoind keeps its blockchain (persistent volume) so blocks aren't re-mined.
#
# NOTE: the elementsproject/lightningd image has an entrypoint script that
# calls `lightningd --network=... "$@"`. We override the entrypoint with
# ["sh", "-c"] so we can wipe stale state before starting lightningd.
services:
# ── Bitcoin Core ─────────────────────────────────────────────────────────────
bitcoind:
image: lncm/bitcoind:v27.0
networks:
- tanda-ln-test-net
volumes:
- bitcoind-data-test:/data/.bitcoin
- ./config/bitcoin-docker.conf:/data/.bitcoin/bitcoin.conf:ro
healthcheck:
test: ["CMD", "bitcoin-cli", "-datadir=/data/.bitcoin", "getblockchaininfo"]
interval: 5s
timeout: 5s
retries: 12
start_period: 10s
# ── CLN nodes ─────────────────────────────────────────────────────────────────
# Each CLN node wipes its regtest/ subdirectory on startup so it always starts
# from block 0, matching bitcoind even if the volume carried stale state.
cln-coordinator:
build:
context: .
dockerfile: Dockerfile.cln
image: cln-tanda-test
networks:
- tanda-ln-test-net
volumes:
- cln-coordinator-data-test:/data
- ./configs/cln-coordinator.conf:/etc/cln-coordinator.conf:ro
entrypoint: ["sh", "-c"]
command:
- "rm -rf /data/regtest && exec lightningd --lightning-dir=/data --conf=/etc/cln-coordinator.conf"
depends_on:
bitcoind:
condition: service_healthy
healthcheck:
test: ["CMD", "lightning-cli", "--lightning-dir=/data", "--network=regtest", "getinfo"]
interval: 5s
timeout: 10s
retries: 24
start_period: 20s
cln-p0:
build:
context: .
dockerfile: Dockerfile.cln
image: cln-tanda-test
networks:
- tanda-ln-test-net
volumes:
- cln-p0-data-test:/data
- ./configs/cln-participant.conf:/etc/cln-participant.conf:ro
entrypoint: ["sh", "-c"]
command:
- "rm -rf /data/regtest && exec lightningd --lightning-dir=/data --conf=/etc/cln-participant.conf"
depends_on:
bitcoind:
condition: service_healthy
healthcheck:
test: ["CMD", "lightning-cli", "--lightning-dir=/data", "--network=regtest", "getinfo"]
interval: 5s
timeout: 10s
retries: 24
start_period: 20s
cln-p1:
build:
context: .
dockerfile: Dockerfile.cln
image: cln-tanda-test
networks:
- tanda-ln-test-net
volumes:
- cln-p1-data-test:/data
- ./configs/cln-participant.conf:/etc/cln-participant.conf:ro
entrypoint: ["sh", "-c"]
command:
- "rm -rf /data/regtest && exec lightningd --lightning-dir=/data --conf=/etc/cln-participant.conf"
depends_on:
bitcoind:
condition: service_healthy
healthcheck:
test: ["CMD", "lightning-cli", "--lightning-dir=/data", "--network=regtest", "getinfo"]
interval: 5s
timeout: 10s
retries: 24
start_period: 20s
cln-p2:
build:
context: .
dockerfile: Dockerfile.cln
image: cln-tanda-test
networks:
- tanda-ln-test-net
volumes:
- cln-p2-data-test:/data
- ./configs/cln-participant.conf:/etc/cln-participant.conf:ro
entrypoint: ["sh", "-c"]
command:
- "rm -rf /data/regtest && exec lightningd --lightning-dir=/data --conf=/etc/cln-participant.conf"
depends_on:
bitcoind:
condition: service_healthy
healthcheck:
test: ["CMD", "lightning-cli", "--lightning-dir=/data", "--network=regtest", "getinfo"]
interval: 5s
timeout: 10s
retries: 24
start_period: 20s
# ── Participant FastAPI servers ────────────────────────────────────────────────
participant-p0:
build: .
networks:
- tanda-ln-test-net
environment:
CLN_RPC_PATH: /cln-data/regtest/lightning-rpc
volumes:
- cln-p0-data-test:/cln-data
command: uvicorn tanda.api_participant_ln:app --host 0.0.0.0 --port 8080
depends_on:
cln-p0:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c",
"import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
interval: 5s
timeout: 10s
retries: 12
start_period: 20s
participant-p1:
build: .
networks:
- tanda-ln-test-net
environment:
CLN_RPC_PATH: /cln-data/regtest/lightning-rpc
volumes:
- cln-p1-data-test:/cln-data
command: uvicorn tanda.api_participant_ln:app --host 0.0.0.0 --port 8080
depends_on:
cln-p1:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c",
"import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
interval: 5s
timeout: 10s
retries: 12
start_period: 20s
participant-p2:
build: .
networks:
- tanda-ln-test-net
environment:
CLN_RPC_PATH: /cln-data/regtest/lightning-rpc
volumes:
- cln-p2-data-test:/cln-data
command: uvicorn tanda.api_participant_ln:app --host 0.0.0.0 --port 8080
depends_on:
cln-p2:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c",
"import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
interval: 5s
timeout: 10s
retries: 12
start_period: 20s
# ── Test runner ───────────────────────────────────────────────────────────────
test-runner:
build: .
networks:
- tanda-ln-test-net
environment:
BITCOIND_RPC_URL: "http://user:password@bitcoind:18443"
CLN_COORDINATOR_RPC: /cln/coordinator/regtest/lightning-rpc
CLN_P0_RPC: /cln/p0/regtest/lightning-rpc
CLN_P1_RPC: /cln/p1/regtest/lightning-rpc
CLN_P2_RPC: /cln/p2/regtest/lightning-rpc
P0_URL: "http://participant-p0:8080"
P1_URL: "http://participant-p1:8080"
P2_URL: "http://participant-p2:8080"
P0_CLN_HOST: cln-p0
P1_CLN_HOST: cln-p1
P2_CLN_HOST: cln-p2
P0_CLN_P2P_PORT: "9735"
P1_CLN_P2P_PORT: "9735"
P2_CLN_P2P_PORT: "9735"
CONTRIBUTION_SATS: "10000"
N_CYCLES: "${N_CYCLES:-1}"
volumes:
- cln-coordinator-data-test:/cln/coordinator
- cln-p0-data-test:/cln/p0
- cln-p1-data-test:/cln/p1
- cln-p2-data-test:/cln/p2
command: >
python -m pytest tests/test_e2e_ln_docker.py -v -s
--tb=short --no-header
depends_on:
bitcoind:
condition: service_healthy
cln-coordinator:
condition: service_healthy
cln-p0:
condition: service_healthy
cln-p1:
condition: service_healthy
cln-p2:
condition: service_healthy
participant-p0:
condition: service_healthy
participant-p1:
condition: service_healthy
participant-p2:
condition: service_healthy