Skip to content

Add new subservers package #516

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

Merged
merged 11 commits into from
May 1, 2023
Merged

Conversation

positiveblue
Copy link
Contributor

@positiveblue positiveblue commented Mar 7, 2023

Note: substitutes part of the work in #442, server status will be added in a different PR

@guggero guggero self-requested a review March 7, 2023 19:37
@ellemouton ellemouton self-requested a review March 8, 2023 09:04
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this, @ellemouton and @positiveblue! Nothing major from my end, except for the missing additional itests around startup (and the new RPCs that were added).

Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this over! Great idea to split up the original PR a bit 👍 🙏

@dstadulis
Copy link

itest need to be added

@positiveblue positiveblue requested a review from guggero April 17, 2023 15:31
@positiveblue positiveblue marked this pull request as ready for review April 17, 2023 15:45
@lightninglabs-deploy
Copy link

@guggero: review reminder
@positiveblue, remember to re-request review from reviewers when ready

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update, LGTM 🎉

@guggero
Copy link
Member

guggero commented Apr 19, 2023

Needs a rebase though.

Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

a few nits & questions. The main thing that I think should be changed here is that we should keep the behaviour of the Litd startup process the same. In otherwords, if one of the subsystems fail to start, Lit should fail to start. We can change this behaviour once we add the 'status server' 👍

mid "github.com/lightninglabs/lightning-terminal/rpcmiddleware"
"github.com/lightninglabs/lightning-terminal/rules"
"github.com/lightninglabs/lightning-terminal/session"
"github.com/lightninglabs/lightning-terminal/subservers"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the main reason for moving the permissions logic? cause now the subserver package manages LiT's permissions which is kinda strange to me. Perhaps the permissions manager can remain where it is and then subservers can register their permissions with it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, the main idea was for the permission manager to be able to get and returns SubServerName(s) typed strings. But it may be worth keeping the permissions where they were + use simple strings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok I see - so moving things to avoid the circular dependency. But yeah, perhaps in this case a little bit of copying is better than the large code shift.

interested to hear what @guggero 's opinion is on this 🙏

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'd probably also go with having a separate list of the subserver names and keeping the permissions where they are.

@positiveblue positiveblue force-pushed the subservers branch 2 times, most recently from e5044d9 to 10edc66 Compare April 27, 2023 06:58
@positiveblue positiveblue requested a review from ellemouton April 27, 2023 06:58
Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff!!! 🚀 tACK

LGTM once the perms comment has been addressed & also think we can remove all the status related TODOs

terminal.go Outdated
@@ -430,30 +456,49 @@ func (g *LightningTerminal) Run() error {
case <-readyChan:

case err := <-g.errQueue.ChanOut():
// TODO(positiveblue): set error status for lnd.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we maybe not scatter all the TODOs for the status stuff? think it only makes sense if there is actually a status server

@positiveblue positiveblue force-pushed the subservers branch 2 times, most recently from a19c679 to ee29c85 Compare April 28, 2023 18:46
ellemouton added 6 commits May 1, 2023 00:15
Add a `started` variable to the rpcProxy that is used to indicate if the
proxy is ready to handle requests. This is because currently the
webserver is dependent on the rpcProxy to start and we want to be able
to start the webserver without being dependent on the rpcProxy so that
it can be used to handle status requests in a future commit. So with
this commit, we can now saftely start the webserver earlier on and then
if requests come through for the rpcProxy, an error will be displayed to
the user.
Remove the responsibility of creating an LND connection from the
rpcProxy and instead let the main LightningTerminal struct handle it.
All the lnd-connection specific functions are also moved into their own
file.
A pure refactor commit. It just splits various parts of the main Run
function out into helper functions in order to more clearly show the
steps taken to set up LiT.
Since all the relevant dependancies have been accouted for, we know move
the starting of the main webserver to earlier on in the Run function.
This is in preparation for later when the webserver will be "always-on"
and will be used to server status information about the rest of the LiT
subservers.
@ellemouton ellemouton merged commit f316bfe into lightninglabs:master May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants