-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
clightning: add TEoS watchtower plugin
- Loading branch information
Showing
5 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ in { | |
./feeadjuster.nix | ||
./prometheus.nix | ||
./summary.nix | ||
./teos-watchtower-plugin.nix | ||
./zmq.nix | ||
]; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ config, lib, ... }: | ||
|
||
with lib; | ||
let cfg = config.services.clightning.plugins.teos-watchtower-plugin; in | ||
{ | ||
options.services.clightning.plugins.teos-watchtower-plugin = { | ||
enable = mkEnableOption "TEoS - watchtower (clightning plugin)"; | ||
package = mkOption { | ||
type = types.package; | ||
default = config.nix-bitcoin.pkgs.teos.teos-watchtower-plugin; | ||
defaultText = "config.nix-bitcoin.pkgs.teos.teos-watchtower-plugin"; | ||
description = "The package providing TEoS watchtower plugin binaries."; | ||
}; | ||
port = mkOption { | ||
type = types.int; | ||
default = config.services.teos.api.port; | ||
description = "tower API port."; | ||
}; | ||
dataDir = mkOption { | ||
type = types.path; | ||
default = "${config.services.clightning.dataDir}/.watchtower"; | ||
description = "The data directory for teos-watchtower-plugin."; | ||
}; | ||
watchtowerMaxRetryTime = mkOption { | ||
type = types.int; | ||
default = 900; | ||
description = "the maximum time a retry strategy will try to reach a temporary unreachable tower before giving up."; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
services.clightning.extraConfig = '' | ||
plugin=${cfg.package}/bin/watchtower-client | ||
watchtower-port=${toString cfg.port} | ||
watchtower-max-retry-time=${toString cfg.watchtowerMaxRetryTime} | ||
''; | ||
|
||
# FIXME: Some better way to propagate this env variable to clightning | ||
# service? Unfortunately it seems the teos-watchtower-plugin does not | ||
# support specifying the data directory using a plugin configuration in | ||
# clightning's config. | ||
# | ||
# Ref.: https://github.com/talaia-labs/rust-teos/blob/master/watchtower-plugin/README.md#config-file-data-folder-and-first-bootstrap | ||
# Without this configuration, the plugin fails to load because it can't | ||
# access its home directory - thanks to service hardening, specifically | ||
# options: | ||
# ProtectHome=true, isSystemUser=true | ||
systemd.services.clightning.environment = { | ||
TOWERS_DATA_DIR = cfg.dataDir; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters