lightninglabs / lightning-terminal

Lightning Terminal: Your Home for Lightning Liquidity
MIT License
506 stars 90 forks source link

Document how to specify RPC LISTEN port for litd #798

Closed MegalithicBTC closed 3 months ago

MegalithicBTC commented 3 months ago

In the API reference, we can see a suggestion of the default GRPC_HOST:

const GRPC_HOST = 'localhost:8443'

example: https://lightning.engineering/api-docs/api/lit/accounts/list-accounts

And when using litcli, this seems to work, for example:

litcli --network testnet --tlscertpath /home/user/.lit/tls.cert  --rpcserver localhost:8443 --macaroonpath /home/user/.lnd/data/chain/bitcoin/testnet/admin.macaroon

However the when I run "help"

user@aw60:~/lightning-terminal$ litd --help
Usage:
  litd [OPTIONS]

Application Options:
      --httpslisten=                                                   The host:port to listen for incoming HTTP/2 connections on for
                                                                       the web UI only. (default: 127.0.0.1:8443)

This seems to suggest that 8443 is for the "Web UI only".

And I can't yet find anything in litd --help which would tell me how to specify an RPC listen port for LITD.

guggero commented 3 months ago

Within litd there is only one single port that does everything! It might be called "web UI" only in some places, which would be outdated. But on the 8443 port you get everything: gRPC of all subservers (including lnd and tapd), REST (if you use --enablerest), the web UI (static HTML page and assets) and grpc-web (mostly used by the web UI itself).

This is documented here, but you're right, on the command line it's not obvious and we should probably update that.

MegalithicBTC commented 3 months ago

Got it. Was wondering specifically because was assuming I could run multiple instances of litd, like, one for Testnet and one for Mainnet, on the same machine. I'm used to doing this with lnd, just by specifying different RPC listen ports in the configuration. Maybe this isn't possible with litd, so the solution might be something fancy with docker where the ports outside the container are like 8443 for one, and 8444 for the other... but both map internally to 8443 inside the container.... If anyone has a better solution please advise...

guggero commented 3 months ago

No, you can still do that by simply changing the default 8443 port to something else with the --httpslisten=xyz flag. Just remember to also change the ports of all other daemons (--lnd.rpclisten=, --lnd.listen, --faraday.rpclisten, --loop.rpclisten and so on, run litd --help | grep listen to see all) to avoid collisions. If you don't want to deal with loop/pool/faraday for example, you can simply run with --faraday-mode=disable, --loop-mode=disable and so on.

MegalithicBTC commented 3 months ago

Ah ok. So the only confusion is with this --httpslisten flag. It also changes the RPC listen for litd, not just the HTTP.

guggero commented 3 months ago

Correct. It changes the main port that everything runs through. Will create a PR to update the CLI flag description.