ops/nixos/seaweedfs: add sync
This commit is contained in:
parent
00817732a3
commit
9133b7d11a
2 changed files with 46 additions and 1 deletions
|
@ -138,6 +138,30 @@ in {
|
|||
default = {};
|
||||
};
|
||||
};
|
||||
|
||||
sync = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
options = {
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = cfg.package;
|
||||
};
|
||||
|
||||
earlyOptions = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
freeformType = commandLineType;
|
||||
};
|
||||
default = {};
|
||||
};
|
||||
options = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
freeformType = commandLineType;
|
||||
};
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [{
|
||||
|
@ -226,5 +250,22 @@ in {
|
|||
Restart = "always";
|
||||
};
|
||||
};
|
||||
})];
|
||||
}) {
|
||||
systemd.services = lib.mapAttrs' (k: v: lib.nameValuePair "seaweedfs-sync-${k}" {
|
||||
wantedBy = [ "seaweedfs.target" ];
|
||||
unitConfig = {
|
||||
StartLimitIntervalSec = "0";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${v.package}/bin/weed ${makeCommandLine v.earlyOptions} filer.sync ${makeCommandLine v.options}";
|
||||
User = "seaweedfs-sync";
|
||||
DynamicUser = true;
|
||||
Restart = "always";
|
||||
|
||||
RestartSec = "100ms";
|
||||
RestartSteps = 10;
|
||||
RestartMaxDelaySec = "1min";
|
||||
};
|
||||
}) cfg.sync;
|
||||
}];
|
||||
}
|
||||
|
|
|
@ -627,6 +627,10 @@ in {
|
|||
master = "[${config.my.ip.tailscale6}]:21000";
|
||||
};
|
||||
};
|
||||
sync.rexxar.options = {
|
||||
a = "rexxar.int.as205479.net:21010";
|
||||
b = "totoro.int.as205479.net:21010";
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "22.11";
|
||||
|
|
Loading…
Reference in a new issue