wallet-server: update suggested systemd unit #370

Merged
derlaft merged 1 commit from patch-1 into master 2022-02-08 16:21:15 +01:00
derlaft commented 2022-01-10 17:39:44 +01:00 (Migrated from github.com)

Use Type=Forking. By default, Type=Simple is used and it expects that the daemon stays forking in the foreground. However, lbrycrdd does the opposite and forks/goes to background. This confuses systemd a little bit:

Dec 09 10:30:28 lbry.devass.club systemd[1]: lbrycrdd.service: Unit process 12237 (lbrycrdd) remains running after unit stopped.

So basically it thinks that the unit stops working instantly. When the correct type is used, systemd should be able to handle this situations, along with restarts, properly.

See also: AUR systemd service

Reopening https://github.com/lbryio/lbry.tech/pull/368

it should only fork if you use the -daemon flag or if you have daemon in your config file

This is not the case. The last version I tried was LBRYcrd Core Daemon version v0.17.3.3-7afc4c4

@derlaft how are you running lbrycrdd?

Exactly as in documentation: ExecStart=/home/user/lbrycrdd -datadir="/home/user/.lbrycrd"

Use `Type=Forking`. By default, `Type=Simple` is used and it expects that the daemon stays forking in the foreground. However, lbrycrdd does the opposite and forks/goes to background. This confuses systemd a little bit: ``` Dec 09 10:30:28 lbry.devass.club systemd[1]: lbrycrdd.service: Unit process 12237 (lbrycrdd) remains running after unit stopped. ``` So basically it thinks that the unit stops working instantly. When the correct type is used, systemd should be able to handle this situations, along with restarts, properly. See also: [AUR systemd service](https://aur.archlinux.org/cgit/aur.git/tree/lbrycrd.service?h=lbrycrd) Reopening https://github.com/lbryio/lbry.tech/pull/368 > it should only fork if you use the -daemon flag or if you have daemon in your config file This is not the case. The last version I tried was `LBRYcrd Core Daemon version v0.17.3.3-7afc4c4` > @derlaft how are you running lbrycrdd? Exactly as in documentation: `ExecStart=/home/user/lbrycrdd -datadir="/home/user/.lbrycrd"`
lyoshenka commented 2022-01-10 21:59:05 +01:00 (Migrated from github.com)

thanks for following up. i'll give this a try

thanks for following up. i'll give this a try
lyoshenka commented 2022-02-08 16:20:22 +01:00 (Migrated from github.com)

ok I dug into this and here's my conclusions:

I'm still not seeing how lbrycrd forks by default. The fork happens here, and only if -daemon is set. Please double-check that you don't have that flag in your config when you're running lbrycrd, or maybe point me to the code where it forks without that flag.

That said, you're right that Type=forking is the better way to set up the systemd unit because it gives lbrycrd a chance to start and signal readiness correctly. In fact that's the way bitcoin recommends doing it: 29cc82db45/contrib/init/bitcoind.service

I'll add in the recommended setup from that service file and merge this PR. Thanks for sticking with me on it. I'd love to show you some appreciation for your help.

ok I dug into this and here's my conclusions: I'm still not seeing how lbrycrd forks by default. The fork happens [here](https://github.com/lbryio/lbrycrd/blob/master/src/bitcoind.cpp#L137), and only if `-daemon` is set. Please double-check that you don't have that flag in your config when you're running lbrycrd, or maybe point me to the code where it forks without that flag. That said, you're right that `Type=forking` is the better way to set up the systemd unit because it gives lbrycrd a chance to start and [signal readiness](https://bbs.archlinux.org/viewtopic.php?pid=1489332#p1489332) correctly. In fact that's the way bitcoin recommends doing it: https://github.com/lbryio/lbrycrd/blob/29cc82db4583c8262f72e7137e6f10c8b2b072ba/contrib/init/bitcoind.service I'll add in the recommended setup from that service file and merge this PR. Thanks for sticking with me on it. I'd love to show you some [appreciation](https://lbry.com/faq/appreciation) for your help.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbry.tech#370
No description provided.