Repository navigation
clightning-replication: require the mounts for a local replica directory - #275
Merged
prusnak merged 2 commits intoNov 18, 2026
Merged
Conversation
viberaven
reviewed
Nov 16, 2026
viberaven
left a comment
Contributor
There was a problem hiding this comment.
Reviewed 240ce5439437.
No actionable findings. Both the direct local-replica service and the encrypted-replica mount service acquire the required mount dependencies. The quoting accounts for whitespace, quotes, backslashes and systemd specifiers; the docs clearly state the declared-mount and symlink limitations. The broader migration-notice condition avoids the documented module recursion. Local module-config and mdBook builds pass. I inspected the missing-disk VM test but did not rerun the replication VM locally.
Review performed with Codex (GPT-6 Astra).
ostermayer
force-pushed
the
clightning-replication-local-mount
branch
from
November 18, 2026 00:19
240ce54 to
393634e
Compare
With `local.directory`, nothing tied clightning to the disk or share that should hold the replica. When that mount was missing, tmpfiles created the directory on the filesystem below the mount point, and clightning wrote the replica there, usually to the primary disk. With `encrypt`, the mounts service also ran `gocryptfs -init` there. The node looked healthy, but a failure of the primary disk took both copies. Add `RequiresMountsFor` for the directory to clightning, and to clightning-replication-mounts when it's set. systemd then mounts the directory first and doesn't start these units while the mount fails. This works only for mounts that systemd knows, so the docs now say to declare the disk or share in `fileSystems`. A directory on the root filesystem has no mount to wait for and starts as before. systemd splits path settings at whitespace and expands `%` specifiers, so quote and escape the directory in `RequiresMountsFor` and in clightning's `ReadWritePaths`. Before, a directory with a space became two paths. clightning now stays down without the mount, so add a 0.2.0 notice for local replication. It isn't limited to directories below a `fileSystems` entry, because systemd also waits for mounts that aren't in `fileSystems`, like `systemd.mounts` entries. Fixes bitcoinix#122. Assisted-by: Claude Code (Claude Opus 5.5)
ostermayer
force-pushed
the
clightning-replication-local-mount
branch
from
November 18, 2026 01:01
393634e to
f5420b0
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #122.
With
services.clightning.replication.local.directory, nothing tied clightning to the disk or share that should hold the replica. Only the SSHFS setup had a dependency, throughbindsToonclightning-replication-mounts. When the mount for a local directory was missing, tmpfiles created the directory on the filesystem below the mount point, and clightning wrote the replica there, usually to the primary disk. Withencrypt, the mounts service ranmkdir -pandgocryptfs -initthere too. The node looked healthy, but a failure of the primary disk took both copies.docs/services.mdsaid that clightning doesn't start while the target is unavailable, which held only for SSHFS.This PR adds
RequiresMountsForforlocal.directorytoclightning.service, and toclightning-replication-mounts.servicewhenencryptis set. systemd then mounts the directory first and doesn't start these units while the mount fails. A directory on the root filesystem has no mount to wait for, so it starts as before.systemd splits
RequiresMountsForandReadWritePathsat whitespace, unquotes each word and expands%specifiers. So the module now writes the directory as a quoted word, with\and"escaped and%doubled, in both settings. Before, a directory with a space became two paths, and clightning failed with226/NAMESPACE.systemd can only wait for the mounts it knows, like
fileSystemsentries, and it doesn't follow symlinks. The docs now say this, with afileSystemsexample for an external disk. I didn't add an assertion or a warning for alocal.directoryoutside a declared mount. A replica on the root filesystem or a ZFS dataset that ZFS mounts itself is valid, so a check would break or nag valid configs.clightning now stays down without the mount, so there's a 0.2.0 notice for local replication, with upgrade notes and a release note. The notice shows for every local replica directory, also on the root filesystem, where nothing changes. A condition that reads
fileSystemswould miss the mounts that systemd knows from elsewhere, likesystemd.mounts.Testing
test/configuration.nix:testReplicationRequiresLocalMountschecksRequiresMountsForon both units for a local directory, with and withoutencrypt, and its absence with SSHFS.testReplicationQuotesLocalDirectorychecks the quoting of a path with a space,",\and%inRequiresMountsForandReadWritePaths.testVersioningReplicationLocalMountschecks the notice for local directories and its absence with SSHFS.checks.module-config(139 tests) andchecks.test-runnerpass.clightning-replicationVM scenario: passes. A new last subtest switches to a config that declares anofailmount at/mnt/replica diskwhose disk is missing. clightning's start fails with resultdependency, no replica appears under the mount point, andsystemctl showlists the path as one word inRequiresMountsForandReadWritePaths. Without the mount dependency (checked with/mnt/replica), the switch succeeds and clightning starts anyway. Without the quoting, systemd ignoresdiskas a relative path, and clightning fails with226/NAMESPACEinstead of the dependency. The subtest fails in both cases.nix eval .#ciTestInfo: passes.module-config,test-runner,ci-workflowsandclightning-replicationpass on the KVM host.acknowledgedreplacescurrent, because master now rejects config version 0.2.0 before the release. It checks that a config at 0.2.0 doesn't get the notice once 0.2.0 is released. On master, the notice is a warning until 0.2.0 is released, and the tests pass withversion.nixat 0.1.6 and at 0.2.0.Models
Claude Opus 5.5 wrote the change. Codex GPT-5.6 Sol, Codex GPT-6 Astra (two passes plus a recheck), Kimi K3.1 Pro (two passes), DeepSeek V4.1 Flash 1017 and GLM 5.3 reviewed it. Claude Opus 5.5 rebased it onto #224 and #283. Kimi K3.1 Pro (two passes) and Claude Fable 5.2 reviewed the first rebase.