lightninglabs / lightning-terminal

Lightning Terminal: Your Home for Lightning Liquidity
MIT License
487 stars 82 forks source link

add systemd `Type=notify` support #585

Open AndySchroder opened 1 year ago

AndySchroder commented 1 year ago

Is your feature request related to a problem? Please describe. litd doesn't do systemd notify like lnd does (https://github.com/lightningnetwork/lnd/blob/86e7b4e1e02e29117dcebba319b0da98e66a3365/contrib/init/lnd.service#L22) so we don't know when litd is ready to use. With Type=notify, systemctl start litd.service just hangs.

Describe the solution you'd like Be able to use Type=notify in systemd service files.

While you are adding this, it would be good to add an example systemd service file so that people know the best way to launch litd.

Describe alternatives you've considered Type=simple works, but we don't have consistency with lnd and we don't know when litd is fully up and running for dependent services to use.

Additional context Would like systemd service files for all lightning labs products to be nearly identical.

I think lnd is implementing this here: https://github.com/lightningnetwork/lnd/blob/86e7b4e1e02e29117dcebba319b0da98e66a3365/signal/signal.go#L25 .

See also, https://manpages.debian.org/bookworm/systemd/systemd.service.5.en.html#OPTIONS .

levmi commented 1 year ago

Seems reasonable. The right folks to think through this fully are likely OOO for the remainder of the week. But, general ack of the concept from me. I'll circle up with them next week and think through how we could move forward here. Just responding so you know we're looking at it and on it.

ellemouton commented 12 months ago

good idea!

All we need is a daemon.SdNotify(false, daemon.SdNotifyReady) call once all the subservers are started up.

Some inspiration here: https://github.com/lightningnetwork/lnd/blob/master/signal/signal.go#L28