-
Notifications
You must be signed in to change notification settings - Fork 103
multi: introduce status server and sub-server manager #442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a6e0e3c
multi: always use Lit's TLS cert
ellemouton d044b9f
multi: add StopDaemon method to lit
ellemouton db2d522
rpc_proxy: add hasStarted method to rpcProxy
ellemouton f06d735
multi: split out LND connection from rpcProxy
ellemouton 5b1e5fd
terminal: modularise the Run function
ellemouton 5bae925
terminal: start the webserver as soon as possible
ellemouton 82230fd
litrpc: add Status server protos
ellemouton 00fda36
multi: implement the status server
ellemouton e998ad4
cmd/litcli: commands for status server
ellemouton 7934730
multi: refactor perms IsURI methods
ellemouton 77a9db7
multi: define a SubServer and add a subServer manager
ellemouton 26415d4
multi: plug in subserverMgr into LightningTerminal
ellemouton fbf009a
lit: add a faraday SubServer
ellemouton b9863f1
lit: add a loop SubServer
ellemouton ae563c6
lit: add a pool SubServer
ellemouton 76e11a9
multi: track LiT and LND status
ellemouton 486fae3
rpc_proxy: allow Litd's StopDaemon call at any time
ellemouton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/lightninglabs/lightning-terminal/litrpc" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
var litCommands = []cli.Command{ | ||
{ | ||
Name: "stop", | ||
Usage: "shutdown the LiT daemon", | ||
Category: "LiT", | ||
Action: shutdownLit, | ||
}, | ||
} | ||
|
||
func shutdownLit(ctx *cli.Context) error { | ||
clientConn, cleanup, err := connectClient(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
defer cleanup() | ||
client := litrpc.NewLitServiceClient(clientConn) | ||
|
||
ctxb := context.Background() | ||
_, err = client.StopDaemon(ctxb, &litrpc.StopDaemonRequest{}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
fmt.Println("Successfully shutdown LiTd") | ||
|
||
return nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/lightninglabs/lightning-terminal/litrpc" | ||
"github.com/urfave/cli" | ||
) | ||
|
||
var statusCommands = []cli.Command{ | ||
{ | ||
Name: "status", | ||
Usage: "info about litd status", | ||
Category: "Status", | ||
Action: getStatus, | ||
}, | ||
} | ||
|
||
func getStatus(ctx *cli.Context) error { | ||
clientConn, cleanup, err := connectClient(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
defer cleanup() | ||
client := litrpc.NewStatusClient(clientConn) | ||
|
||
ctxb := context.Background() | ||
resp, err := client.SubServerState( | ||
ctxb, &litrpc.SubServerStatusReq{}, | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
printRespJSON(resp) | ||
|
||
return nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also update
doc/config-lnd-integrated.md
and perhaps explain the difference (and reasoning) between thelnd 10009
(gRPC only) and thelitd 8443
(grpc-web, REST, gRPC proxy, UI) a bit more explicitly?Also this change should be made very explicit in the release notes (not sure where to put the reminder for us).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah good call here, as it would also be a breaking change (CLI/config wise).