Skip to content

Commit 47257bb

Browse files
committed
regtest: adding aperture docker instance
1 parent e734d69 commit 47257bb

File tree

2 files changed

+107
-5
lines changed

2 files changed

+107
-5
lines changed

regtest/docker-compose.yml

Lines changed: 53 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,32 @@ 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+
args:
91+
checkout: v0.3.8-beta
92+
container_name: aperture
93+
restart: unless-stopped
94+
depends_on:
95+
- loopserver
96+
- etcd
97+
networks:
98+
regtest:
99+
aliases:
100+
- aperture
101+
volumes:
102+
- "lndserver:/root/.lnd"
103+
- "loopserver:/root/loopserver"
104+
- "aperture:/root/.aperture"
105+
ports:
106+
- "11018:11018"
107+
entrypoint: [ "/bin/aperture" ]
108+
command:
109+
- "--configfile=/root/.aperture/aperture.yaml"
110+
111+
85112
lndclient:
86113
image: lightninglabs/lnd:v0.17.0-beta
87114
container_name: lndclient
@@ -124,22 +151,44 @@ services:
124151
- loopclient
125152
volumes:
126153
- "lndclient:/root/.lnd"
154+
- "aperture:/root/.aperture"
155+
- "loopclient:/root/.loop"
127156
depends_on:
128-
- lndclient
157+
- aperture
129158
command:
130159
- "loopd"
160+
- "--experimental"
131161
- "--network=regtest"
132162
- "--debuglevel=debug"
133-
- "--server.host=loopserver:11009"
134-
- "--server.notls"
163+
- "--server.host=aperture:11018"
164+
- "--server.tlspath=/root/.loop/aperture-tls.cert"
135165
- "--lnd.host=lndclient:10009"
136166
- "--lnd.macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon"
137167
- "--lnd.tlspath=/root/.lnd/tls.cert"
138168

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

142188
volumes:
143189
bitcoind:
144190
lndserver:
145191
lndclient:
192+
loopserver:
193+
loopclient:
194+
aperture:

regtest/regtest.sh

Lines changed: 54 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,57 @@ 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+
164+
servername: aperture
165+
autocert: false
166+
167+
authenticator:
168+
lndhost: lndserver:10009
169+
tlspath: /root/.lnd/tls.cert
170+
macdir: /root/.lnd/data/chain/bitcoin/regtest
171+
network: regtest
172+
173+
etcd:
174+
host: 'etcd:2379'
175+
user:
176+
password:
177+
178+
services:
179+
- name: loop
180+
hostregexp: '^.*$'
181+
pathregexp: '^/looprpc.*$'
182+
address: 'loopserver:11009'
183+
protocol: https
184+
tlscertpath: /root/.aperture/loopserver-tls.cert
185+
price: 1000
186+
authwhitelistpaths:
187+
- '^/looprpc.SwapServer/LoopOutTerms.*$'
188+
- '^/looprpc.SwapServer/LoopOutQuote.*$'
189+
- '^/looprpc.SwapServer/LoopInTerms.*$'
190+
- '^/looprpc.SwapServer/LoopInQuote.*$'
191+
EOF
192+
}
193+
194+
142195
if [[ $# -lt 1 ]]; then
143196
echo "Usage: $0 start|stop|restart|info|loop"
144197
fi

0 commit comments

Comments
 (0)