nix-bitcoin/modules
Erik Arvstedt 4aaef5fdf4
services: use wants dependency where possible
Let A be a service that depends on another service B.
When A can gracefully handle failures and restarts of B, use
```
wants = [ "B.service" ];
after = [ "B.service" ];
```
instead of
```
requires = [ "B.service" ];
after = [ "B.service" ];
```
in the definition of A.

This way, A keeps running when B is stopped or restarted after a failure.
With `requires`, A is instead stopped when B is stopped or restarted due to a failure.

This brings two benefits:

1. Improved uptime
Examples:
- RTL keeps running when one lightning node has failed
- btcpayserver keeps running and accepting on-chain payments when the lightning node has crashed

2. Avoids a systemd bug where depending units (`A.service` in the
above example) are not restarted when their dependency fails
(issue github/systemd#18856, no full link to avoid spamming the issue).
In real world nix-bitcoin deployments, this issue was only likely to
appear when clightning failed during activation, causing depending
units (like `RTL`) to stop and not be restarted.
All services depending on `clightning` have now been changed to use
`wants`, thereby avoiding the bug.

Services `electrs` and `lightning-loop` fail when their respective
dependencies stop, so these services have not been changed.
I also haven't changed services `joinmarket` and
`joinmarket-yieldgenerator`. Further manual testing is needed to
determine if they can be switched to `wants`.
2025-01-29 20:44:26 +01:00
..
clightning-plugins clightning.plugins.clnrest: init 2024-11-27 18:48:24 +01:00
deployment examples: add krops deployment method 2021-03-15 18:53:07 +01:00
presets lndconnect: add clnrest 2024-11-27 21:35:46 +01:00
secrets treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
backups.nix backups: fix for nixos 24.05 2024-07-20 22:41:18 +02:00
bitcoind-rpc-public-whitelist.nix bitcoind-rpc-public-whitelist: add getnodeaddresses 2024-07-31 18:13:29 +02:00
bitcoind.nix bitcoind.rpc.users: improve example 2024-07-31 18:13:29 +02:00
btcpayserver.nix services: use wants dependency where possible 2025-01-29 20:44:26 +01:00
charge-lnd.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
clightning-replication.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
clightning-rest.nix services: use wants dependency where possible 2025-01-29 20:44:26 +01:00
clightning.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
electrs.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
fulcrum.nix services: use wants dependency where possible 2025-01-29 20:44:26 +01:00
hardware-wallets.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
joinmarket-ob-watcher.nix joinmarket: add option settings 2024-08-11 20:16:56 +02:00
joinmarket.nix joinmarket: add option settings 2024-08-11 20:16:56 +02:00
lightning-loop.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
lightning-pool.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
liquid.nix services: use wants dependency where possible 2025-01-29 20:44:26 +01:00
lnd.nix update nixpkgs 2025-01-21 16:51:29 +00:00
lndconnect.nix lndconnect: add clnrest 2024-11-27 21:35:46 +01:00
mempool.nix services: use wants dependency where possible 2025-01-29 20:44:26 +01:00
modules.nix mempool: add module 2023-10-31 13:44:04 +01:00
netns-isolation.nix modules: update to NixOS 24.11 2024-12-14 10:52:26 +01:00
nix-bitcoin.nix nix-bitcoin: add example for option pkgOverlays 2024-01-15 23:05:26 +01:00
nodeinfo.nix clightning.plugins.clnrest: init 2024-11-27 18:48:24 +01:00
obsolete-options.nix joinmarket: remove deleted option txfee 2024-07-27 19:55:29 +02:00
onion-addresses.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
onion-services.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
operator.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
rtl.nix services: use wants dependency where possible 2025-01-29 20:44:26 +01:00
security.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00
versioning.nix treewide: remove obsolete mdDoc 2024-07-18 20:57:00 +02:00