txoo: connect to vls and cln

- set env var for vls frontend
- set arg for vlsd2
- create txoo-server service
- cln uses http source
- vls fetch public key using curl with retries fail if not set
- update README for vls standalone
Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
This commit is contained in:
Lakshya Singh 2024-07-06 18:06:32 +05:30
parent a406c2a7ec
commit e46298a6f8
No known key found for this signature in database
GPG Key ID: 6491470634BAE613
7 changed files with 65 additions and 8 deletions

View File

@ -65,19 +65,28 @@ Required command arguments:
For information on all possible arguments to `vlsd` see [documentation](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/vls-proxy/src/config.rs?ref_type=heads).
### Build Arguments
For building the container its required to provide following build arguments:
- `VLS_REPO` url for git repo to use for building binaries.
- `VLS_GIT_HASH` commit sha/tag/branch to use from git repo.
- `TXOO_PUBLIC_KEY` public key for trusted TXOO.
### Running container
There is a `docker-compose.yml` in the `vlsd` folder which can be used to run a standalone `vlsd` service with `network_mode` set to host.
```bash
cd vlsd
export VLS_REPO=$VLS_REPO
export VLS_GIT_HASH=$VLS_GIT_HASH
export TXOO_PUBLIC_KEY=$TXOO_PUBLIC_KEY
docker compose up
```
**_Note_**: Make sure to set `BITCOIND_RPC_URL`, `VLS_GIT_HASH` and `CLN_RMEOTE_HSMD_URL` as either environment variables or in the `docker-compose.yml` file before running the above command. You can take `VLS_GIT_HASH` from [.env](./.env) or from the main [repo](https://gitlab.com/lightning-signer/validating-lightning-signer)
**_Note_**: Make sure to set `BITCOIND_RPC_URL` and `CLN_RMEOTE_HSMD_URL` as either environment variables or in the `docker-compose.yml` file before running the above command.
If you wish to run it as a standalone container without using `docker-compose` you can use the following command:
If you wish to run it as a standalone container without using `docker compose` you can use the following command:
```bash
docker run \
@ -86,6 +95,8 @@ docker run \
--name vlsd \
--network host \
--build_arg VLS_GIT_HASH=$VLS_GIT_HASH
--build_arg VLS_REPO=$VLS_REPO
--build_arg TXOO_PUBLIC_KEY=$TXOO_PUBLIC_KEY
-e VLS_NETWORK=testnet \
-e BITCOIND_RPC_URL=$BITCOIND_RPC_URL \
--mount 'type=volume,src=vls_data,dst=/home/vls/.lightning-signer' \

View File

@ -40,6 +40,15 @@ services:
- BITCOIN_NETWORK=regtest
- BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:38332
txoo-server:
container_name: txoo-server-regtest
volumes:
- type: volume
source: txoo_regtest
target: /usr/share/nginx/html
volume:
subpath: regtest/public
vls:
container_name: vlsd-regtest
volumes:

View File

@ -50,8 +50,11 @@ services:
depends_on:
bitcoin-core:
condition: service_healthy
txoo-server:
condition: service_started
environment:
- BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:18332
- TXOO_SOURCE_URL=http://txoo-server:80
- RUST_LOG=info
- VLS_NETWORK=testnet
- VLS_BIND=0.0.0.0
@ -78,6 +81,23 @@ services:
- BITCOIN_NETWORK=testnet
- BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:18332
txoo-server:
image: nginx:1.27-alpine3.20
container_name: txoo-server-test
networks:
- lightning
depends_on:
txoo:
condition: service_started
volumes:
- type: volume
source: txoo_data
target: /usr/share/nginx/html
volume:
subpath: testnet/public
ports:
- "8080:80"
lss:
build:
context: ./lss
@ -109,11 +129,12 @@ services:
args:
- VLS_REPO
- VLS_GIT_HASH
- TXOO_PUBLIC_KEY
image: vlsd:${IMAGE_TAG:-latest}
container_name: vlsd-test
profiles:
- vls
command:
command:
--log-level=info
--connect=http://core-lightning:7701
${LSS_REMOTE_URL:+--lss=$LSS_REMOTE_URL}
@ -121,15 +142,18 @@ services:
- lightning
volumes:
- vls_data:/home/vls/.lightning-signer
depends_on:
txoo-server:
condition: service_started
lss:
condition: service_started
required: false
environment:
- LSS_REMOTE_URL
- VLS_NETWORK=testnet
- VLS_PERMISSIVE=1
- RUST_LOG=info
- BITCOIND_RPC_URL=http://rpcuser:VLSsigner1@bitcoind:18332
depends_on:
lss:
condition: service_started
required: false
volumes:
bitcoin_data:

View File

@ -4,6 +4,7 @@ set -e
cp -u /testnet-config ${LIGHTNINGD_DATA}/testnet-config
cp -u /regtest-config ${LIGHTNINGD_DATA}/regtest-config
# this is kept for backward compatibility purposes
export GREENLIGHT_VERSION=$(lightningd --version)
export VLS_CLN_VERSION=$(lightningd --version)

View File

@ -28,6 +28,8 @@ ARG VLSD_UID=100 \
VLSD_GID=101 \
VLSD_USER=vls
ARG VLSD_HOME=/home/${VLSD_USER}
ARG TXOO_PUBLIC_KEY
ENV TXOO_PUBLIC_KEY=${TXOO_PUBLIC_KEY}
LABEL maintainer.0="Lakshya Singh (@king-11)" \
maintainer.1="Dev Random (@devrandom01)"
@ -39,6 +41,7 @@ RUN apk update && \
apk add \
build-base \
curl-dev \
curl \
protobuf \
bind-tools \
tini
@ -58,6 +61,8 @@ ENV VLSD_DATA=/home/vls/.lightning-signer
RUN mkdir -p ${VLSD_DATA} && \
chown ${VLSD_USER}:${VLSD_USER} ${VLSD_DATA}
RUN mkdir -p ${VLSD_HOME}/.txoo
ENV REMOTE_SIGNER_ALLOWLIST=${VLSD_DATA}/ALLOWLIST
RUN touch ${REMOTE_SIGNER_ALLOWLIST}

View File

@ -5,7 +5,9 @@ services:
context: .
dockerfile: Dockerfile
args:
- VLS_REPO
- VLS_GIT_HASH
- TXOO_PUBLIC_KEY
image: vlsd
container_name: vlsd-standalone
command:

View File

@ -4,6 +4,10 @@ set -e
cp /vlsd2.toml $VLSD_DATA/
sed -i "1s/^/network = \"$VLS_NETWORK\"\n/" $VLSD_DATA/vlsd2.toml
TXOO_PUBLIC_KEY=${TXOO_PUBLIC_KEY:=$(curl -s --retry 5 --retry-all-errors --fail http://txoo-server:80/config | grep public_key | cut -d ' ' -f 2)}
test -n "$TXOO_PUBLIC_KEY" || (echo "TXOO_PUBLIC_KEY build arg not set" && false)
if [ $(echo "$1" | cut -c1) = "-" ]; then
echo "$0: assuming arguments for vlsd2"
@ -13,7 +17,8 @@ fi
if [ $(echo "$1" | cut -c1) = "-" ] || [ "$1" = "vlsd2" ]; then
echo "$0: setting config to $VLSD_DATA/vlsd2.toml"
set -- "$@" --config=$VLSD_DATA/vlsd2.toml
echo "$0: using $TXOO_PUBLIC_KEY as trusted oracle pubkey"
set -- "$@" --config=$VLSD_DATA/vlsd2.toml -t=$TXOO_PUBLIC_KEY
fi
echo