-
Notifications
You must be signed in to change notification settings - Fork 112
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
WIP: Add clightning backup plugin #415
Conversation
419ef99
to
2db179c
Compare
This should not affect an existing networkDir.
9ddd3e6
to
1e3d99e
Compare
Was able to fix this by using Now need to figure out a good way to give clightning (and clightning-backup-init) permissions to write into an arbitrary directory and not just clightnings dataDir. |
cfg = config.services.clightning.plugins.backup; | ||
nbLib = config.nix-bitcoin.lib; | ||
nbPkgs = config.nix-bitcoin.pkgs; | ||
clightningCfg = config.services.clightning; |
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.
We call this clightning
in other modules...
config = mkIf cfg.enable { | ||
assertions = [ | ||
{ assertion = cfg.backendURL != ""; | ||
message = "You must set system.services.clightning.plugins.backup.backendURL"; |
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.
Shouldn't this be config.services.clightning.plugins.backup.backendURL
?
backupLock="${clightningCfg.networkDir}/backup.lock" | ||
if [[ ! -e $backupLock || $backendURL != $(cat $backupLock | ${pkgs.jq}/bin/jq -r .backend_url) ]]; then | ||
umask u=rw,go= | ||
${backupPkg}/backup-cli init --lightning-dir "${clightningCfg.networkDir}" ${cfg.backendURL} |
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.
Can you add ${backupPkg}/backup-cli
to the system packages for restores?
@jonasnick Line 58 in 3f844c0
Thanks for your work! |
script = '' | ||
backendURL="${cfg.backendURL}" | ||
backupLock="${clightningCfg.networkDir}/backup.lock" | ||
if [[ ! -e $backupLock || $backendURL != $(cat $backupLock | ${pkgs.jq}/bin/jq -r .backend_url) ]]; then |
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 if backups get deleted on the remote? Shouldn't this script check the presence of the files, and reinit if necessary?
Tested the backup plugin in production with a EDIT: Apparently the file gets edited on every update, so it is reuploaded every single time. This makes it unusable with remote backends without something like EDIT2: Tried it with SSHFS, working smoothly now. |
Superseded by #415. |
No description provided.