ops/nixos/seaweedfs: add sync

This commit is contained in:
Luke Granger-Brown 2024-10-20 18:19:22 +01:00
parent 00817732a3
commit 9133b7d11a
2 changed files with 46 additions and 1 deletions

View file

@ -138,6 +138,30 @@ in {
default = {}; 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 [{ config = lib.mkMerge [{
@ -226,5 +250,22 @@ in {
Restart = "always"; 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;
}];
} }

View file

@ -627,6 +627,10 @@ in {
master = "[${config.my.ip.tailscale6}]:21000"; 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"; system.stateVersion = "22.11";