Skip to content

Commit b15ad20

Browse files
authored
Merge pull request #116 from lightninglabs/grub-v2
Allow remote lnd connection
2 parents a6c0074 + da194d0 commit b15ad20

File tree

12 files changed

+1803
-617
lines changed

12 files changed

+1803
-617
lines changed

README.md

Lines changed: 27 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ archives as well.
4040

4141
| LiT | LND | Loop | Faraday |
4242
| ---------------- | ------------ | ----------- | ------------ |
43+
| **v0.2.0-alpha** | v0.11.1-beta | v0.9.0-beta | v0.2.1-alpha |
4344
| **v0.1.1-alpha** | v0.11.0-beta | v0.8.1-beta | v0.2.0-alpha |
4445
| **v0.1.0-alpha** | v0.10.3-beta | v0.6.5-beta | v0.2.0-alpha |
4546

@@ -75,10 +76,10 @@ installed on your machine.
7576
Once you have the necessary prerequisites, LiT can be compiled by running the following
7677
commands:
7778

78-
```
79-
git clone https://github.com/lightninglabs/lightning-terminal.git
80-
cd lightning-terminal
81-
make install
79+
```shell script
80+
$ git clone https://github.com/lightninglabs/lightning-terminal.git
81+
$ cd lightning-terminal
82+
$ make install
8283
```
8384

8485
This will produce the `litd` executable and add it to your `GOPATH`. The CLI binaries for
@@ -94,12 +95,12 @@ since the daemons are now integrated into `lnd`'s GRPC server.
9495

9596
Examples:
9697

97-
```
98-
loop --rpcserver=localhost:10009 --tlscertpath=$HOME/.lnd/tls.cert --macaroonpath=$HOME/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
98+
```shell script
99+
$ loop --rpcserver=localhost:10009 --tlscertpath=$HOME/.lnd/tls.cert --macaroonpath=$HOME/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
99100
```
100101

101-
```
102-
frcli --rpcserver=localhost:10009 --tlscertpath=$HOME/.lnd/tls.cert --macaroonpath=$HOME/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
102+
```shell script
103+
$ frcli --rpcserver=localhost:10009 --tlscertpath=$HOME/.lnd/tls.cert --macaroonpath=$HOME/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
103104
```
104105

105106
## Configuration
@@ -134,7 +135,7 @@ port 80 without needing to run the daemon as root.
134135
> browser-to-server communication. Web browsers will display a warning when using the
135136
> self-signed certificate.
136137
137-
```
138+
```text
138139
Application Options:
139140
--httpslisten= host:port to listen for incoming HTTP/2 connections on (default: 127.0.0.1:8443)
140141
--uipassword= the password that must be entered when using the loop UI. use a strong
@@ -147,191 +148,26 @@ Application Options:
147148
certificate (default: /Users/<username>/Library/Application Support/Lnd/letsencrypt)
148149
```
149150

150-
In addition to the LiT specific parameters, you must also provide configuration to the
151-
`lnd`, `loop` and `faraday` daemons. For `lnd`, each flag must be prefixed with `lnd.`
152-
(ex: `lnd.lnddir=~/.lnd`). Please see the
153-
[sample-lnd.conf](https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf)
154-
file for more details on the available parameters. Note that `loopd` and `faraday` will
155-
automatically connect to the in-process `lnd` node, so you do not need to provide them
156-
with any additional parameters unless you want to override them. If you do override them,
157-
be sure to add the `loop.` and `faraday.` prefixes.
158-
159-
Here is an example command to start `litd` on testnet with a local `bitcoind` node:
160-
161-
```
162-
$ ./litd \
163-
--httpslisten=0.0.0.0:443 \
164-
--uipassword=My$trongP@ssword \
165-
--letsencrypt \
166-
--letsencrypthost=loop.merchant.com \
167-
--lnd.lnddir=/root/.lnd \
168-
--lnd.alias=merchant \
169-
--lnd.externalip=loop.merchant.com \
170-
--lnd.rpclisten=0.0.0.0:10009 \
171-
--lnd.listen=0.0.0.0:9735 \
172-
--lnd.bitcoin.active \
173-
--lnd.bitcoin.testnet \
174-
--lnd.bitcoin.node=bitcoind \
175-
--lnd.bitcoind.rpchost=localhost \
176-
--lnd.bitcoind.rpcuser=testnetuser \
177-
--lnd.bitcoind.rpcpass=testnetpw \
178-
--lnd.bitcoind.zmqpubrawblock=localhost:28332 \
179-
--lnd.bitcoind.zmqpubrawtx=localhost:28333 \
180-
--lnd.debuglevel=debug \
181-
--loop.loopoutmaxparts=5 \
182-
--faraday.min_monitored=48h
183-
```
184-
185-
You can also store the configuration in a persistent `lnd.conf` file so you do not need to
186-
type in the command line arguments every time you start the server. Just remember to use
187-
the appropriate prefixes as necessary.
188-
189-
Do not include section headers, such as `[Application Options]` or `[Bitcoin]`, in the
190-
config file. Doing so will produce an error on startup.
191-
192-
Example `lnd.conf`:
193-
194-
```
195-
httpslisten=0.0.0.0:443
196-
letsencrypt=1
197-
letsencrypthost=loop.merchant.com
198-
199-
lnd.lnddir=~/.lnd
200-
lnd.alias=merchant
201-
lnd.externalip=loop.merchant.com
202-
lnd.rpclisten=0.0.0.0:10009
203-
lnd.listen=0.0.0.0:9735
204-
lnd.debuglevel=debug
205-
206-
lnd.bitcoin.active=1
207-
lnd.bitcoin.testnet=1
208-
lnd.bitcoin.node=bitcoind
209-
210-
lnd.bitcoind.rpchost=localhost
211-
lnd.bitcoind.rpcuser=testnetuser
212-
lnd.bitcoind.rpcpass=testnetpw
213-
lnd.bitcoind.zmqpubrawblock=localhost:28332
214-
lnd.bitcoind.zmqpubrawtx=localhost:28333
215-
216-
loop.loopoutmaxparts=5
217-
218-
faraday.min_monitored=48h
219-
220-
```
221-
222-
The default location for the `lnd.conf` file will depend on your operating system:
223-
224-
- **On MacOS**: `~/Library/Application Support/Lnd/lnd.conf`
225-
- **On Linux**: `~/.lnd/lnd.conf`
226-
- **On Windows**: `~/AppData/Roaming/Lnd/lnd.conf`
227-
228-
### Upgrade Existing Nodes
229-
230-
If you already have existing `lnd`, `loop`, or `faraday` nodes, you can easily upgrade
231-
them to the LiT single executable while keeping all of your past data.
232-
233-
For `lnd`:
234-
235-
- if you use an `lnd.conf` file for configurations, add the `lnd.` prefix to each of the
236-
configuration parameters.
237-
238-
Before:
151+
### Lnd mode
239152

240-
```
241-
[Application Options]
242-
alias=merchant
243-
```
153+
Starting with LiT `v0.2.0-alpha`, you now have the choice of either running an
154+
`lnd` node in the same process as the UI (which is called the "integrated" `lnd`
155+
mode) or connect the UI to an already running `lnd` node (called "remote" mode).
244156

245-
After:
157+
Because that single decision has an impact on the configuration options that
158+
need to be used, the documentation has been split into two parts, each
159+
explaining one mode in detail.
246160

247-
```
248-
[Application Options]
249-
lnd.alias=merchant
250-
```
161+
* Lnd mode **"remote"**
162+
+ Connect to a remote `lnd` instance, start the rest (the UI, `loop`,
163+
`faraday`) in the same process.
164+
+ [Please read the `lnd` **remote** mode configuration guide here.](doc/config-lnd-remote.md)
165+
+ This is the default mode that is used if the `--lnd-mode=` command line
166+
or `lnd-mode=` configuration option is not set explicitly.
251167

252-
- if you use command line arguments for configuration, add the `lnd.` prefix to each
253-
argument to `litd`
254-
255-
Before:
256-
257-
```
258-
$ lnd --lnddir=~/.lnd --alias=merchant ...
259-
```
260-
261-
After:
262-
263-
```
264-
$ litd lnd.lnddir=~/.lnd --lnd.alias=merchant ...
265-
```
266-
267-
For `loop`:
268-
269-
- if you use an `loop.conf` file for configurations, copy the parameters into the
270-
`lnd.conf` file that `litd` uses, and add the `loop.` prefix to each of the
271-
configuration parameters.
272-
273-
Before: (in `loop.conf`)
274-
275-
```
276-
[Application Options]
277-
loopoutmaxparts=5
278-
```
279-
280-
After: (in `lnd.conf`)
281-
282-
```
283-
[Loop]
284-
loop.loopoutmaxparts=5
285-
```
286-
287-
- if you use command line arguments for configuration, add the `loop.` prefix to each
288-
argument to `litd`
289-
290-
Before:
291-
292-
```
293-
$ loop --loopoutmaxparts=5 --debuglevel=debug ...
294-
```
295-
296-
After:
297-
298-
```
299-
$ litd --loop.loopoutmaxparts=5 --loop.debuglevel=debug ...
300-
```
301-
302-
For `faraday`:
303-
304-
- the standalone `faraday` daemon does not load configuration from a file, but you can now
305-
store the parameters into the `lnd.conf` file that `litd` uses. Just add the `faraday.`
306-
prefix to each of the configuration parameters.
307-
308-
Before: (from command line)
309-
310-
```
311-
$ faraday --min_monitored=48h
312-
```
313-
314-
After: (in `lnd.conf`)
315-
316-
```
317-
[Faraday]
318-
faraday.min_monitored=48h
319-
```
320-
321-
- if you use command line arguments for configuration, add the `faraday.` prefix to each
322-
argument to `litd`
323-
324-
Before:
325-
326-
```
327-
$ faraday --min_monitored=48h --debuglevel=debug ...
328-
```
329-
330-
After:
331-
332-
```
333-
$ litd --faraday.min_monitored=48h --faraday.debuglevel=debug...
334-
```
168+
* Lnd mode **"integrated"**
169+
+ Start everything (the UI, `lnd`, `loop`, `faraday`) in one single process.
170+
+ [Please read the `lnd` **integrated** mode configuration guide here.](doc/config-lnd-integrated.md)
335171

336172
### Troubleshooting
337173

@@ -356,7 +192,7 @@ Client-side logs are disabled by default in production builds. Logging can be tu
356192
adding a couple keys to your browser's `localStorage`. Simply run these two JS statements
357193
in you browser's DevTools console then refresh the page:
358194

359-
```
195+
```js
360196
localStorage.setItem('debug', '*'); localStorage.setItem('debug-level', 'debug');
361197
```
362198

cmd/litd/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
"errors"
45
"fmt"
56
"os"
67

@@ -11,9 +12,9 @@ import (
1112
// main starts the lightning-terminal application.
1213
func main() {
1314
err := terminal.New().Run()
14-
if e, ok := err.(*flags.Error); err != nil &&
15-
(!ok || e.Type != flags.ErrHelp) {
16-
15+
var flagErr *flags.Error
16+
isFlagErr := errors.As(err, &flagErr)
17+
if err != nil && (!isFlagErr || flagErr.Type != flags.ErrHelp) {
1718
_, _ = fmt.Fprintln(os.Stderr, err)
1819
os.Exit(1)
1920
}

0 commit comments

Comments
 (0)