liquidd: use systemd startup notification

This commit is contained in:
Erik Arvstedt 2021-11-02 13:07:38 +01:00
parent b83fd845c2
commit 49086abcc5
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
2 changed files with 10 additions and 4 deletions

View File

@ -159,10 +159,10 @@ in {
lbtcnodeendpoint=${nbLib.addressWithPort liquidd.address bitcoind.whitelistedPort} lbtcnodeendpoint=${nbLib.addressWithPort liquidd.address bitcoind.whitelistedPort}
''} ''}
''; '';
in { in rec {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
requires = [ "bitcoind.service" ]; requires = [ "bitcoind.service" ] ++ optional cfg.btcpayserver.lbtc "liquidd.service";
after = [ "bitcoind.service" ]; after = requires;
preStart = '' preStart = ''
install -m 600 ${configFile} '${cfg.nbxplorer.dataDir}/settings.config' install -m 600 ${configFile} '${cfg.nbxplorer.dataDir}/settings.config'
{ {

View File

@ -168,6 +168,11 @@ let
bitcoind = config.services.bitcoind; bitcoind = config.services.bitcoind;
configFile = pkgs.writeText "elements.conf" '' configFile = pkgs.writeText "elements.conf" ''
# We're already logging via journald
nodebuglogfile=1
startupnotify=/run/current-system/systemd/bin/systemd-notify --ready
chain=${bitcoind.makeNetworkName "liquidv1" '' chain=${bitcoind.makeNetworkName "liquidv1" ''
regtest regtest
[regtest]'' # Add [regtest] config section [regtest]'' # Add [regtest] config section
@ -253,7 +258,8 @@ in {
} >> '${cfg.dataDir}/elements.conf' } >> '${cfg.dataDir}/elements.conf'
''; '';
serviceConfig = nbLib.defaultHardening // { serviceConfig = nbLib.defaultHardening // {
Type = "simple"; Type = "notify";
NotifyAccess = "all";
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
ExecStart = "${nbPkgs.elementsd}/bin/elementsd -datadir='${cfg.dataDir}'"; ExecStart = "${nbPkgs.elementsd}/bin/elementsd -datadir='${cfg.dataDir}'";