Skip to content

Commit

Permalink
docker: Detect network subdirectory by the presence of 'lightning-rpc'
Browse files Browse the repository at this point in the history
This is less prune to misdetection compared to using the database file,
but also means that mounting the parent directory will not work if spark
is started before c-lightning is.

Because of this, the documentation was updated to instruct users to
mount the network subdirectory containing the RPC file directly, rather
than relying on the automatic detection mechanism (which is more
advisable anyway).

This appears to be the underlying cause for
btcpayserver/btcpayserver-docker#462,
due to BTCPay's unusual 'rpc-file' setting.
  • Loading branch information
shesek committed Aug 25, 2021
1 parent d7ea487 commit 498ea5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ You can use `--no-tls` to turn it off.
#### With existing `lightningd`

To connect to an existing `lightningd` instance running on the same machine,
mount the lightning data directory to `/etc/lightning`:
mount the lightning data subdirectory for the network (e.g. `~/.lightning/bitcoin`)
into `/etc/lightning`:

```bash
$ docker run -it -v ~/.spark-docker:/data -p 9737:9737 \
-v ~/.lightning:/etc/lightning \
-v ~/.lightning/bitcoin:/etc/lightning \
shesek/spark-wallet:standalone
```

Expand Down
2 changes: 1 addition & 1 deletion scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trap 'jobs -p | xargs -r kill' SIGTERM
if [ -d /etc/lightning ]; then
echo -n "Using lightningd directory mounted in /etc/lightning... "
LN_PATH=/etc/lightning
if [ ! -f $LN_PATH/lightningd.sqlite3 ] && [ -f $LN_PATH/$NETWORK/lightningd.sqlite3 ]; then
if [ ! -f $LN_PATH/lightning-rpc ] && [ -f $LN_PATH/$NETWORK/lightning-rpc ]; then
echo -n "Using $LN_PATH/$NETWORK... "
LN_PATH=$LN_PATH/$NETWORK
fi
Expand Down

0 comments on commit 498ea5d

Please sign in to comment.