regtest: adding aperture docker instance

This commit is contained in:
Slyghtning 2025-02-20 11:17:25 +01:00
parent e734d69b18
commit 30832978c7
No known key found for this signature in database
GPG key ID: F82D456EA023C9BF
2 changed files with 109 additions and 6 deletions

View file

@ -30,7 +30,7 @@ services:
- bitcoind:/home/bitcoin/.bitcoin
lndserver:
image: lightninglabs/lnd:v0.17.0-beta
image: lightninglabs/lnd:v0.18.5-beta
container_name: lndserver
restart: unless-stopped
networks:
@ -68,6 +68,7 @@ services:
- loopserver
volumes:
- "lndserver:/root/.lnd"
- "loopserver:/root/loopserver"
depends_on:
- lndserver
command:
@ -82,8 +83,34 @@ services:
- "--bitcoin.zmqpubrawblock=tcp://bitcoind:28332"
- "--bitcoin.zmqpubrawtx=tcp://bitcoind:28333"
aperture:
build:
context: https://github.com/lightninglabs/aperture.git
dockerfile: Dockerfile
args:
checkout: v0.3.8-beta
container_name: aperture
restart: unless-stopped
depends_on:
- loopserver
- etcd
networks:
regtest:
aliases:
- aperture
volumes:
- "lndserver:/root/.lnd"
- "loopserver:/root/loopserver"
- "aperture:/root/.aperture"
ports:
- "11018:11018"
entrypoint: [ "/bin/aperture" ]
command:
- "--configfile=/root/.aperture/aperture.yaml"
lndclient:
image: lightninglabs/lnd:v0.17.0-beta
image: lightninglabs/lnd:v0.18.5-beta
container_name: lndclient
restart: unless-stopped
networks:
@ -124,18 +151,37 @@ services:
- loopclient
volumes:
- "lndclient:/root/.lnd"
- "aperture:/root/.aperture"
- "loopclient:/root/.loop"
depends_on:
- lndclient
- aperture
command:
- "loopd"
- "--experimental"
- "--network=regtest"
- "--debuglevel=debug"
- "--server.host=loopserver:11009"
- "--server.notls"
- "--server.host=aperture:11018"
- "--server.tlspath=/root/.loop/aperture-tls.cert"
- "--lnd.host=lndclient:10009"
- "--lnd.macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon"
- "--lnd.tlspath=/root/.lnd/tls.cert"
etcd:
image: bitnami/etcd:3.3.12
platform: linux/amd64
container_name: etcd
hostname: etcd
networks:
regtest:
aliases:
- etcd
restart: unless-stopped
ports:
- "2379:2379"
- "2380:2380"
environment:
- ALLOW_NONE_AUTHENTICATION=yes
networks:
regtest:
@ -143,3 +189,6 @@ volumes:
bitcoind:
lndserver:
lndclient:
loopserver:
loopclient:
aperture:

View file

@ -77,6 +77,11 @@ function setup() {
lndclient openchannel --node_key $LNDSERVER --local_amt 16000000
mine 6
docker cp aperture:/root/.aperture/tls.cert /tmp/aperture-tls.cert
chmod 644 /tmp/aperture-tls.cert
docker cp -a /tmp/aperture-tls.cert loopclient:/root/.loop/aperture-tls.cert
}
function stop() {
@ -111,7 +116,6 @@ function copy_loopserver_files() {
chmod 644 /tmp/loopserver-admin.macaroon
docker cp -a /tmp/loopserver-admin.macaroon loopserver:/home/loopserver/admin.macaroon
# copy invoices macaroon to loopserver
docker cp lndserver:/root/.lnd/data/chain/bitcoin/regtest/invoices.macaroon /tmp/loopserver-invoices.macaroon
chmod 644 /tmp/loopserver-invoices.macaroon
@ -137,8 +141,58 @@ function copy_loopserver_files() {
chmod 644 /tmp/loopserver-walletkit.macaroon
docker cp -a /tmp/loopserver-walletkit.macaroon loopserver:/home/loopserver/walletkit.macaroon
docker cp loopserver:/home/loopserver/tls.cert /tmp/loopserver-tls.cert
chmod 644 /tmp/loopserver-tls.cert
docker cp -a /tmp/loopserver-tls.cert aperture:/root/.aperture/loopserver-tls.cert
# create the aperture config and copy it to the aperture container.
write_aperture_config
docker cp /tmp/aperture.yaml aperture:/root/.aperture/aperture.yaml
}
function write_aperture_config() {
rm -rf /tmp/aperture.yaml
touch /tmp/aperture.yaml && cat > /tmp/aperture.yaml <<EOF
listenaddr: '0.0.0.0:11018'
staticroot: '/root/.aperture/static'
servestatic: true
debuglevel: trace
insecure: false
writetimeout: 0s
servername: aperture
autocert: false
authenticator:
lndhost: lndserver:10009
tlspath: /root/.lnd/tls.cert
macdir: /root/.lnd/data/chain/bitcoin/regtest
network: regtest
etcd:
host: 'etcd:2379'
user:
password:
services:
- name: loop
hostregexp: '^.*$'
pathregexp: '^/looprpc.*$'
address: 'loopserver:11009'
protocol: https
tlscertpath: /root/.aperture/loopserver-tls.cert
price: 1000
authwhitelistpaths:
- '^/looprpc.SwapServer/LoopOutTerms.*$'
- '^/looprpc.SwapServer/LoopOutQuote.*$'
- '^/looprpc.SwapServer/LoopInTerms.*$'
- '^/looprpc.SwapServer/LoopInQuote.*$'
EOF
}
if [[ $# -lt 1 ]]; then
echo "Usage: $0 start|stop|restart|info|loop"
fi