Skip to content

Commit 0bb8cd8

Browse files
committed
regtest: adding aperture docker instance
1 parent e734d69 commit 0bb8cd8

File tree

2 files changed

+106
-5
lines changed

2 files changed

+106
-5
lines changed

regtest/docker-compose.yml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ services:
3030
- bitcoind:/home/bitcoin/.bitcoin
3131

3232
lndserver:
33-
image: lightninglabs/lnd:v0.17.0-beta
33+
image: lightninglabs/lnd:v0.18.5-beta
3434
container_name: lndserver
3535
restart: unless-stopped
3636
networks:
@@ -68,6 +68,7 @@ services:
6868
- loopserver
6969
volumes:
7070
- "lndserver:/root/.lnd"
71+
- "loopserver:/root/loopserver"
7172
depends_on:
7273
- lndserver
7374
command:
@@ -82,6 +83,30 @@ services:
8283
- "--bitcoin.zmqpubrawblock=tcp://bitcoind:28332"
8384
- "--bitcoin.zmqpubrawtx=tcp://bitcoind:28333"
8485

86+
aperture:
87+
build:
88+
context: https://github.com/lightninglabs/aperture.git
89+
dockerfile: Dockerfile
90+
container_name: aperture
91+
restart: unless-stopped
92+
depends_on:
93+
- loopserver
94+
- etcd
95+
networks:
96+
regtest:
97+
aliases:
98+
- aperture
99+
volumes:
100+
- "lndserver:/root/.lnd"
101+
- "loopserver:/root/loopserver"
102+
- "aperture:/root/.aperture"
103+
ports:
104+
- "11018:11018"
105+
entrypoint: [ "/bin/aperture" ]
106+
command:
107+
- "--configfile=/root/.aperture/aperture.yaml"
108+
109+
85110
lndclient:
86111
image: lightninglabs/lnd:v0.17.0-beta
87112
container_name: lndclient
@@ -124,22 +149,44 @@ services:
124149
- loopclient
125150
volumes:
126151
- "lndclient:/root/.lnd"
152+
- "aperture:/root/.aperture"
153+
- "loopclient:/root/.loop"
127154
depends_on:
128-
- lndclient
155+
- aperture
129156
command:
130157
- "loopd"
158+
- "--experimental"
131159
- "--network=regtest"
132160
- "--debuglevel=debug"
133-
- "--server.host=loopserver:11009"
134-
- "--server.notls"
161+
- "--server.host=aperture:11018"
162+
- "--server.tlspath=/root/.loop/aperture-tls.cert"
135163
- "--lnd.host=lndclient:10009"
136164
- "--lnd.macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon"
137165
- "--lnd.tlspath=/root/.lnd/tls.cert"
138166

167+
etcd:
168+
image: bitnami/etcd:3.3.12
169+
platform: linux/amd64
170+
container_name: etcd
171+
hostname: etcd
172+
networks:
173+
regtest:
174+
aliases:
175+
- etcd
176+
restart: unless-stopped
177+
ports:
178+
- "2379:2379"
179+
- "2380:2380"
180+
environment:
181+
- ALLOW_NONE_AUTHENTICATION=yes
182+
139183
networks:
140184
regtest:
141185

142186
volumes:
143187
bitcoind:
144188
lndserver:
145189
lndclient:
190+
loopserver:
191+
loopclient:
192+
aperture:

regtest/regtest.sh

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ function setup() {
7777

7878
lndclient openchannel --node_key $LNDSERVER --local_amt 16000000
7979
mine 6
80+
81+
docker cp aperture:/root/.aperture/tls.cert /tmp/aperture-tls.cert
82+
chmod 644 /tmp/aperture-tls.cert
83+
docker cp -a /tmp/aperture-tls.cert loopclient:/root/.loop/aperture-tls.cert
84+
8085
}
8186

8287
function stop() {
@@ -111,7 +116,6 @@ function copy_loopserver_files() {
111116
chmod 644 /tmp/loopserver-admin.macaroon
112117
docker cp -a /tmp/loopserver-admin.macaroon loopserver:/home/loopserver/admin.macaroon
113118

114-
115119
# copy invoices macaroon to loopserver
116120
docker cp lndserver:/root/.lnd/data/chain/bitcoin/regtest/invoices.macaroon /tmp/loopserver-invoices.macaroon
117121
chmod 644 /tmp/loopserver-invoices.macaroon
@@ -137,8 +141,58 @@ function copy_loopserver_files() {
137141
chmod 644 /tmp/loopserver-walletkit.macaroon
138142
docker cp -a /tmp/loopserver-walletkit.macaroon loopserver:/home/loopserver/walletkit.macaroon
139143

144+
docker cp loopserver:/home/loopserver/tls.cert /tmp/loopserver-tls.cert
145+
chmod 644 /tmp/loopserver-tls.cert
146+
docker cp -a /tmp/loopserver-tls.cert aperture:/root/.aperture/loopserver-tls.cert
147+
148+
# create the aperture config and copy it to the aperture container.
149+
write_aperture_config
150+
151+
docker cp /tmp/aperture.yaml aperture:/root/.aperture/aperture.yaml
140152
}
141153

154+
155+
function write_aperture_config() {
156+
rm -rf /tmp/aperture.yaml
157+
touch /tmp/aperture.yaml && cat > /tmp/aperture.yaml <<EOF
158+
listenaddr: '0.0.0.0:11018'
159+
staticroot: '/root/.aperture/static'
160+
servestatic: true
161+
debuglevel: trace
162+
insecure: false
163+
writetimeout: 0
164+
165+
servername: aperture
166+
autocert: false
167+
168+
authenticator:
169+
lndhost: lndserver:10009
170+
tlspath: /root/.lnd/tls.cert
171+
macdir: /root/.lnd/data/chain/bitcoin/regtest
172+
network: regtest
173+
174+
etcd:
175+
host: 'etcd:2379'
176+
user:
177+
password:
178+
179+
services:
180+
- name: loop
181+
hostregexp: '^.*$'
182+
pathregexp: '^/looprpc.*$'
183+
address: 'loopserver:11009'
184+
protocol: https
185+
tlscertpath: /root/.aperture/loopserver-tls.cert
186+
price: 1000
187+
authwhitelistpaths:
188+
- '^/looprpc.SwapServer/LoopOutTerms.*$'
189+
- '^/looprpc.SwapServer/LoopOutQuote.*$'
190+
- '^/looprpc.SwapServer/LoopInTerms.*$'
191+
- '^/looprpc.SwapServer/LoopInQuote.*$'
192+
EOF
193+
}
194+
195+
142196
if [[ $# -lt 1 ]]; then
143197
echo "Usage: $0 start|stop|restart|info|loop"
144198
fi

0 commit comments

Comments
 (0)