-
Notifications
You must be signed in to change notification settings - Fork 15
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
Added sample systemd service file #54
base: master
Are you sure you want to change the base?
Conversation
Great addition! |
Wants=network-online.target | ||
After=network-online.target | ||
# alternatively, wait until bitcoind is up | ||
#After=bitcoind.service |
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.
Currently, datum_gateway will fail to start if bitcoind isn't responsive - so maybe this should be uncommented?
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.
Well, it starts if bitcoind is unresponsive. It just doesn't do anything useful, except log a lot of errors. But the reason for leaving After=bitcoind.service
line uncommented was simply that someone might be configuring datum to run via systemd without configuring bitcoind to run via systemd. But could leave it uncommented and have the comment say instead to remove it if bitcoind isn't configured via systemd.
contrib/init/datum_gateway.service
Outdated
|
||
Type=simple | ||
NotifyAccess=all | ||
PIDFile=/run/datum/datum_gateway.pid |
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.
Does systemd create the directory 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.
Yes, systemd dynamically creates the directory on start and then deletes it on stop.
Group=datum | ||
|
||
# /run/datum_gateway | ||
RuntimeDirectory=datum_gateway |
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.
This doesn't match PIDFile above
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.
Typo in the path for PIDFile. Would fix, but… Actually, PIDFile isn't even needed when running with Type=simple
. Will delete PIDFile instead.
contrib/init/datum_gateway.service
Outdated
ConfigurationDirectoryMode=0710 | ||
|
||
# /var/lib/datum_gateway | ||
StateDirectory=datum_gateway |
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.
What is this for?
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.
A case of me following the bitcoind example too closely, I think. Removing this section and replacing with LogsDirectory pointed at /var/log/datum_gateway instead.
…ogsDirectory. Remove NotifyAccess.
OK, much cleaner version just pushed. I think the only unresolved question now is whether to uncomment NGL, I miss pre-systemd init. |
Added sample systemd service file patterned after bitcoind example file. Includes hardening options and comments with guide to expected file locations. Also creates
contrib/init
path in repo.Possible enhancement would be to use
Type=notify
instead ofType=simple
and wrap datum_gateway in a script that notifies systemd. But chose to stick with this simpler approach, as notification might better be implemented by datum_gateway itself.