Skip to content

Commit

Permalink
clightning: add TEoS watchtower plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
seberm committed Sep 7, 2022
1 parent 1ec82ae commit 509f3b8
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ NixOS modules ([src](modules/modules.nix))
* [prometheus](https://github.com/lightningd/plugins/tree/master/prometheus): lightning node exporter for the prometheus timeseries server
* [rebalance](https://github.com/lightningd/plugins/tree/master/rebalance): keeps your channels balanced
* [summary](https://github.com/lightningd/plugins/tree/master/summary): print a nice summary of the node status
* [teos-watchtower-plugin](https://github.com/talaia-labs/rust-teos/tree/master/watchtower-plugin): watchtower client plugin to interact with an Eye of Satoshi tower
* [zmq](https://github.com/lightningd/plugins/tree/master/zmq): publishes notifications via ZeroMQ to configured endpoints
* [clightning-rest](https://github.com/Ride-The-Lightning/c-lightning-REST): REST server for clightning
* [lnd](https://github.com/lightningnetwork/lnd) with support for announcing an onion service and [static channel backups](https://github.com/lightningnetwork/lnd/blob/master/docs/recovery.md)
Expand Down
1 change: 1 addition & 0 deletions modules/clightning-plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ in {
./feeadjuster.nix
./prometheus.nix
./summary.nix
./teos-watchtower-plugin.nix
./zmq.nix
];

Expand Down
52 changes: 52 additions & 0 deletions modules/clightning-plugins/teos-watchtower-plugin.nix
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;
};
};
}
1 change: 0 additions & 1 deletion pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ let self = {
secp256k1 = pkgs.callPackage ./secp256k1 { };
spark-wallet = pkgs.callPackage ./spark-wallet { };
teos = pkgs.callPackage ./teos { };
teos-watchtower-plugin = pkgs.callPackage ./teos { };

nbPython3Packages = (pkgs.python3.override {
packageOverrides = import ./python-packages self;
Expand Down
1 change: 1 addition & 0 deletions test/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ let
nbPkgs = config.nix-bitcoin.pkgs;
pluginPkgs = nbPkgs.clightning-plugins // {
clboss.path = "${nbPkgs.clboss}/bin/clboss";
teos-watchtower-plugin.path = "${nbPkgs.teos.teos-watchtower-plugin}/bin/watchtower-client";
};
in map (plugin: pluginPkgs.${plugin}.path) enabled;
# Torified 'dig' subprocesses of clboss don't respond to SIGTERM and keep
Expand Down

0 comments on commit 509f3b8

Please sign in to comment.