Skip to content

Commit

Permalink
Merge pull request #8 from guggero/pool-daemon-only
Browse files Browse the repository at this point in the history
mod+terminal: add poold
  • Loading branch information
guggero committed Nov 2, 2020
2 parents 7487a2f + ef624d8 commit 5d5b3d6
Show file tree
Hide file tree
Showing 15 changed files with 256 additions and 57 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ RUN apk add --no-cache --update alpine-sdk \
&& make install \
&& go install -v -trimpath github.com/lightningnetwork/lnd/cmd/lncli \
&& go install -v -trimpath github.com/lightninglabs/faraday/cmd/frcli \
&& go install -v -trimpath github.com/lightninglabs/loop/cmd/loop
&& go install -v -trimpath github.com/lightninglabs/loop/cmd/loop \
&& go install -v -trimpath github.com/lightninglabs/pool/cmd/pool

# Start a new, final image to reduce size.
FROM alpine as final
Expand All @@ -48,6 +49,7 @@ COPY --from=builder /go/bin/litd /bin/
COPY --from=builder /go/bin/lncli /bin/
COPY --from=builder /go/bin/frcli /bin/
COPY --from=builder /go/bin/loop /bin/
COPY --from=builder /go/bin/pool /bin/

# Add bash.
RUN apk add --no-cache \
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Lightning Terminal (LiT) is a browser-based interface for managing channel liqui
- Visualize your channels and balances
- Perform submarine swaps via the [Lightning Loop](https://lightning.engineering/loop) service
- Classify channels according to your node's operating mode
- Run a single binary that integrates both [`loopd`](https://github.com/lightninglabs/loop) and [`faraday`](https://github.com/lightninglabs/faraday) daemons all in one
- Run a single binary that integrates [`loopd`](https://github.com/lightninglabs/loop),
[`poold`](https://github.com/lightninglabs/pool) and
[`faraday`](https://github.com/lightninglabs/faraday) daemons all in one

## Installation
Download the latest binaries from the [releases](https://github.com/lightninglabs/lightning-terminal/releases) page.
Expand Down Expand Up @@ -60,17 +62,18 @@ If you’d prefer to compile from source code please follow [these instructions]

## Compatibility

Lightning Terminal is backwards compatible with `lnd` back to version v0.11.0-beta
Lightning Terminal is backwards compatible with `lnd` back to version v0.11.1-beta

| LiT | LND |
| ---------------- | ------------ |
| **v0.3.0-alpha** | v0.11.1-beta |
| **v0.2.0-alpha** | v0.11.0-beta |

## Daemon Versions packaged with LiT

| LiT | LND | Loop | Faraday |
| ---------------- | ------------ | ----------- | ------------ |
| **v0.2.0-alpha** | v0.11.1-beta | v0.10.0-beta | v0.2.1-alpha |
| **v0.1.1-alpha** | v0.11.0-beta | v0.8.1-beta | v0.2.0-alpha |
| **v0.1.0-alpha** | v0.10.3-beta | v0.6.5-beta | v0.2.0-alpha |

| LiT | LND | Loop | Faraday | Pool |
| ---------------- | ------------ | ----------- | ------------ |---------------|
| **v0.3.0-alpha** | v0.11.1-beta | v0.11.0-beta | v0.2.2-alpha | v0.3.2-alpha |
| **v0.2.0-alpha** | v0.11.1-beta | v0.10.0-beta | v0.2.1-alpha | n/a |
| **v0.1.1-alpha** | v0.11.0-beta | v0.8.1-beta | v0.2.0-alpha | n/a |
| **v0.1.0-alpha** | v0.10.3-beta | v0.6.5-beta | v0.2.0-alpha | n/a |
9 changes: 9 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/lightninglabs/faraday/frdrpc"
"github.com/lightninglabs/lndclient"
"github.com/lightninglabs/loop/loopd"
"github.com/lightninglabs/pool"
"github.com/lightningnetwork/lnd"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/cert"
Expand Down Expand Up @@ -64,6 +65,7 @@ var (
lndDefaultConfig = lnd.DefaultConfig()
faradayDefaultConfig = faraday.DefaultConfig()
loopDefaultConfig = loopd.DefaultConfig()
poolDefaultConfig = pool.DefaultConfig()

// defaultLitDir is the default directory where LiT tries to find its
// configuration file and store its data (in remote lnd node). This is a
Expand Down Expand Up @@ -128,6 +130,7 @@ type Config struct {

Faraday *faraday.Config `group:"Faraday options" namespace:"faraday"`
Loop *loopd.Config `group:"Loop options" namespace:"loop"`
Pool *pool.Config `group:"pool" namespace:"pool"`

Lnd *lnd.Config `group:"Integrated lnd (use when lnd-mode=integrated)" namespace:"lnd"`

Expand Down Expand Up @@ -237,6 +240,7 @@ func defaultConfig() *Config {
Faraday: &faradayDefaultConfig,
faradayRpcConfig: &frdrpc.Config{},
Loop: &loopDefaultConfig,
Pool: &poolDefaultConfig,
}
}

Expand Down Expand Up @@ -321,6 +325,11 @@ func loadAndValidateConfig() (*Config, error) {
return nil, err
}

cfg.Pool.Network = cfg.network
if err := pool.Validate(cfg.Pool); err != nil {
return nil, err
}

cfg.Faraday.Network = cfg.network
if err := faraday.ValidateConfig(cfg.Faraday); err != nil {
return nil, err
Expand Down
8 changes: 5 additions & 3 deletions doc/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ $ make install
```

This will produce the `litd` executable and add it to your `GOPATH`. The CLI binaries for
`lncli`, `loop`, and `frcli` are not created by `make install`. You will need to download
those binaries from the [lnd](https://github.com/lightningnetwork/lnd/releases),
[loop](https://github.com/lightninglabs/loop/releases), and
`lncli`, `loop`, `pool`, and `frcli` are not created by `make install`. You will
need to download those binaries from the
[lnd](https://github.com/lightningnetwork/lnd/releases),
[loop](https://github.com/lightninglabs/loop/releases),
[pool](https://github.com/lightninglabs/pool/releases), and
[faraday](https://github.com/lightninglabs/faraday/releases) repos manually.
32 changes: 27 additions & 5 deletions doc/config-lnd-integrated.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

The "integrated" mode means that `lnd` is started within the same process as
`litd`, alongside the UI server. Once the integrated `lnd` has been unlocked,
`litd` then goes ahead and starts `faraday` and `loop` and connects them to the
integrated `lnd` node.
`litd` then goes ahead and starts `faraday`, `pool` and `loop` and connects them
to the integrated `lnd` node.

Currently the UI server cannot connect to `loop` or `faraday` daemons that
aren't running in the same process. But that feature will also be available in
future versions.
Currently the UI server cannot connect to `loop`, `pool` or `faraday` daemons
that aren't running in the same process. But that feature will also be available
in future versions.

## Use command line parameters only

Expand Down Expand Up @@ -99,6 +99,9 @@ lnd.bitcoind.zmqpubrawtx=localhost:28333
# Loop
loop.loopoutmaxparts=5
# Pool
pool.newnodesonly=true
# Faraday
faraday.min_monitored=48h
Expand Down Expand Up @@ -314,6 +317,25 @@ You can easily create an alias for this by adding the following line to your
alias lit-loop="loop --rpcserver=localhost:10009 --tlscertpath=~/.lnd/tls.cert --macaroonpath=~/.loop/testnet/loop.macaroon"
```
### Example `pool` command
Again, `poold` also runs on the same gRPC server as `lnd` and we have to specify
the `host:port` and the TLS certificate of `lnd` but use the macaroon from the
`.pool` directory.
```shell script
$ pool --rpcserver=localhost:10009 --tlscertpath=~/.lnd/tls.cert \
--macaroonpath=~/.pool/testnet/pool.macaroon \
accounts list
```
You can easily create an alias for this by adding the following line to your
`~/.bashrc` file:
```shell script
alias lit-pool="pool --rpcserver=localhost:10009 --tlscertpath=~/.lnd/tls.cert --macaroonpath=~/.pool/testnet/pool.macaroon"
```
### Example `frcli` command
Faraday's command line tool follows the same pattern as loop. We also have to
Expand Down
66 changes: 46 additions & 20 deletions doc/config-lnd-remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,34 +54,36 @@ Visit https://localhost:8443 to access LiT.

The "remote" mode means that `lnd` is started as a standalone process, possibly on another
host, and `litd` connects to it, right after starting its UI server. Once the connection
to the remote `lnd` node has been established, `litd` then goes ahead and starts `faraday`
and `loop` and connects them to that `lnd` node as well.
to the remote `lnd` node has been established, `litd` then goes ahead and starts
`faraday`, `pool` and `loop` and connects them to that `lnd` node as well.

Currently the UI server cannot connect to `loop` or `faraday` daemons that aren't running
in the same process. But that feature will also be available in future versions.
Currently the UI server cannot connect to `loop`, `pool` or `faraday` daemons
that aren't running in the same process. But that feature will also be available
in future versions.

## Use command line parameters only

In addition to the LiT specific and remote `lnd` parameters, you must also provide
configuration to the `loop` and `faraday` daemons. For the remote `lnd` node, all
configuration to the `loop`, `pool`, and `faraday` daemons. For the remote `lnd` node, all
`remote.lnd` flags must be specified. Note that `loopd` and `faraday` will automatically
connect to the same remote `lnd` node, so you do not need to provide them with any
additional parameters unless you want to override them. If you do override them, be sure
to add the `loop.` and `faraday.` prefixes.
to add the `loop.`, `pool.`, and `faraday.` prefixes.

To see all available command line options, run `litd --help`.

The most minimal example command to start `litd` and connect it to a local `lnd` node that
is running with default configuration settings is:
The most minimal example command to start `litd` and connect it to a local `lnd`
node that is running with default configuration settings is:

```shell script
$ litd --uipassword=My$trongP@ssword
```

All other command line flags are only needed to overwrite the default behavior.

Here is an example command to start `litd` connected to a testnet `lnd` that is running on
another host and overwrites a few default settings in `loop` and `faraday` (optional):
Here is an example command to start `litd` connected to a testnet `lnd` that is
running on another host and overwrites a few default settings in `loop`, `pool`,
and `faraday` (optional):

```shell script
$ litd \
Expand All @@ -96,17 +98,19 @@ $ litd \
--remote.lnd.macaroondir=/some/folder/with/lnd/data \
--remote.lnd.tlscertpath=/some/folder/with/lnd/data/tls.cert \
--loop.loopoutmaxparts=5 \
--pool.newnodesonly=true \
--faraday.min_monitored=48h \
--faraday.connect_bitcoin \
--faraday.bitcoin.host=some-other-host \
--faraday.bitcoin.user=testnetuser \
--faraday.bitcoin.password=testnetpw
```

NOTE: Even though LiT itself only needs `lnd`'s `admin.macaroon`, the `loop` and `faraday`
daemons will require other macaroons and will look for them in the folder specified with
`--remote.lnd.macaroondir`. It is advised to copy all `*.macaroon` files and the
`tls.cert` file from the remote host to the host that is running `litd`.
NOTE: Even though LiT itself only needs `lnd`'s `admin.macaroon`, the `loop`,
`pool`, and `faraday` daemons will require other macaroons and will look for
them in the folder specified with `--remote.lnd.macaroondir`. It is advised to
copy all `*.macaroon` files and the `tls.cert` file from the remote host to the
host that is running `litd`.

## Use a configuration file

Expand All @@ -130,8 +134,8 @@ uipassword=My$trongP@ssword
All other configuration settings are only needed to overwrite the default behavior.

Here is an example `~/.lit/lit.conf` file that connects LiT to a testnet `lnd` node
running on another host and overwrites a few default settings in `loop` and `faraday`
(optional):
running on another host and overwrites a few default settings in `loop`, `pool`,
and `faraday` (optional):

```text
# Application Options
Expand All @@ -153,6 +157,9 @@ remote.lnd.tlscertpath=/some/folder/with/lnd/data/tls.cert
# Loop
loop.loopoutmaxparts=5
# Pool
pool.newnodesonly=true
# Faraday
faraday.min_monitored=48h
Expand Down Expand Up @@ -189,10 +196,10 @@ remote.lnd.macaroondir=/some/folder/with/lnd/data
remote.lnd.tlscertpath=/some/folder/with/lnd/data/tls.cert
```

Because in the remote `lnd` mode all other LiT components (`loop`, `faraday` and the UI
server) listen on the same port (`443` in this example) and use the same TLS certificate
(`~/.lit/tls.cert` in this example), some command line calls now need some extra options
that weren't necessary before.
Because in the remote `lnd` mode all other LiT components (`loop`, `pool`,
`faraday` and the UI server) listen on the same port (`443` in this example) and
use the same TLS certificate (`~/.lit/tls.cert` in this example), some command
line calls now need some extra options that weren't necessary before.

**NOTE**: All mentioned command line tools have the following behavior in common: You
either specify the `--network` flag and the `--tlscertpath` and `--macaroonpath` are
Expand Down Expand Up @@ -233,6 +240,25 @@ file:
alias lit-loop="loop --rpcserver=localhost:443 --tlscertpath=~/.lit/tls.cert --macaroonpath=~/.loop/testnet/loop.macaroon"
```

### Example `pool` command

Again, `poold` also runs on the same port as the UI server and we have to
specify the `host:port` and the TLS certificate of LiT but use the macaroon from
the `.pool` directory.

```shell script
$ pool --rpcserver=localhost:443 --tlscertpath=~/.lit/tls.cert \
--macaroonpath=~/.pool/testnet/pool.macaroon \
accounts list
```

You can easily create an alias for this by adding the following line to your
`~/.bashrc` file:

```shell script
alias lit-pool="pool --rpcserver=localhost:443 --tlscertpath=~/.lit/tls.cert --macaroonpath=~/.pool/testnet/pool.macaroon"
```

### Example `frcli` command

Faraday's command line tool follows the same pattern as loop. We also have to specify the
Expand Down
21 changes: 21 additions & 0 deletions doc/letsencrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,27 @@ file:
alias lit-loop="loop --rpcserver=terminal.mydomain.com:8443 --tlscertpath=~/.lit/letsencrypt/terminal.mydomain.com --macaroonpath=~/.loop/testnet/loop.macaroon"
```

### Example `pool` command

Since `poold` also runs on the same gRPC server as `lnd`, we have to specify the
**LetEncrypt** `host:port` and TLS certificate. But `poold` verifies its own
macaroon, so we have to specify that one from the `.pool` directory.

```shell script
$ pool \
--rpcserver=terminal.mydomain.com:8443 \
--tlscertpath=~/.lit/letsencrypt/terminal.mydomain.com \
--macaroonpath=~/.pool/testnet/pool.macaroon \
accounts list
```

You can easily create an alias for this by adding the following line to your
`~/.bashrc` file:

```shell script
alias lit-pool="pool --rpcserver=terminal.mydomain.com:8443 --tlscertpath=~/.lit/letsencrypt/terminal.mydomain.com --macaroonpath=~/.loop/testnet/loop.macaroon"
```

### Example `frcli` command

Faraday's command line tool follows the same pattern as loop. We also have to specify the
Expand Down
1 change: 1 addition & 0 deletions doc/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ If you have trouble running your node, please first check the logs for warnings
If there are errors relating to one of the embedded servers, then you should open an issue
in their respective GitHub repos ([lnd](https://github.com/lightningnetwork/lnd/issues),
[loop](https://github.com/lightninglabs/loop/issues),
[pool](https://github.com/lightninglabs/pool/issues),
[faraday](https://github.com/lightninglabs/faraday/issues). If the issue is related to the
web app, then you should open an
[issue](https://github.com/lightninglabs/lightning-terminal/issues) here in this repo.
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ require (
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/btcsuite/btcutil v1.0.2
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/grpc-ecosystem/grpc-gateway v1.14.3
github.com/grpc-ecosystem/grpc-gateway v1.14.6
github.com/improbable-eng/grpc-web v0.12.0
github.com/jessevdk/go-flags v1.4.0
github.com/lightninglabs/faraday v0.2.1-alpha.0.20201012084956-438cb323aa24
github.com/lightninglabs/lndclient v0.11.0-0
github.com/lightninglabs/loop v0.10.0-beta
github.com/lightningnetwork/lnd v0.11.1-beta.rc3
github.com/lightninglabs/aperture v0.1.3-beta
github.com/lightninglabs/faraday v0.2.2-alpha
github.com/lightninglabs/lndclient v0.11.0-3
github.com/lightninglabs/loop v0.11.0-beta.0.20201030095204-66eff361c2ef
github.com/lightninglabs/pool v0.3.2-alpha
github.com/lightningnetwork/lnd v0.11.1-beta
github.com/lightningnetwork/lnd/cert v1.0.3
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76
Expand All @@ -20,11 +22,9 @@ require (
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e // indirect
golang.org/x/sys v0.0.0-20200406155108-e3b113bbe6a4 // indirect
google.golang.org/grpc v1.28.0
google.golang.org/grpc v1.29.1
gopkg.in/macaroon-bakery.v2 v2.1.0
gopkg.in/macaroon.v2 v2.1.0
)

replace github.com/lightningnetwork/lnd => github.com/lightningnetwork/lnd v0.11.1-beta

go 1.13
Loading

0 comments on commit 5d5b3d6

Please sign in to comment.