feat(host/faunus-ater): slicify seaweedfs
This commit is contained in:
parent
7fca8a6402
commit
8af9f19ab2
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
|
lib,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
|
@ -20,8 +21,6 @@
|
||||||
in {
|
in {
|
||||||
enable = true;
|
enable = true;
|
||||||
description = "SeaweedFS Volume ${builtins.toString number}";
|
description = "SeaweedFS Volume ${builtins.toString number}";
|
||||||
after = ["network.target"];
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${weed} volume -dir=. -mserver=${master.ip}:${master.port} -ip=${master.ip} -port ${builtins.toString port} -dataCenter=home1 -rack=rack1 -minFreeSpace=50G -max=0 -disk=${disk}";
|
ExecStart = "${weed} volume -dir=. -mserver=${master.ip}:${master.port} -ip=${master.ip} -port ${builtins.toString port} -dataCenter=home1 -rack=rack1 -minFreeSpace=50G -max=0 -disk=${disk}";
|
||||||
|
@ -30,7 +29,9 @@
|
||||||
Group = "seaweed";
|
Group = "seaweed";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
SyslogIdentifier = "seaweedfs-volume-${builtins.toString number}";
|
SyslogIdentifier = "seaweedfs-volume-${builtins.toString number}";
|
||||||
|
Slice = "system-seaweedfs.slice";
|
||||||
};
|
};
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
};
|
};
|
||||||
|
|
||||||
filerConfig = pkgs.writeText "filer.toml" ''
|
filerConfig = pkgs.writeText "filer.toml" ''
|
||||||
|
@ -90,13 +91,22 @@ in {
|
||||||
"L+ /data/dirty/seaweedfs/master.toml - - - - ${masterConfig}"
|
"L+ /data/dirty/seaweedfs/master.toml - - - - ${masterConfig}"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
systemd.slices."system-seaweedfs" = let
|
||||||
|
systemdDeps = lib.throwIfNot config.services.tailscale.enable "Tailscale is not enabled, but the seaweed services depend on it. Fix the dependencies or enable tailscale" ["network.target" "tailscaled.service"];
|
||||||
|
in {
|
||||||
|
enable = true;
|
||||||
|
description = "SeaweedFS Systemd Slice";
|
||||||
|
documentation = ["https://github.com/seaweedfs/seaweedfs/wiki"];
|
||||||
|
after = systemdDeps;
|
||||||
|
requires = systemdDeps;
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services = {
|
systemd.services = {
|
||||||
# Master
|
# Master
|
||||||
seaweedfs-master = {
|
seaweedfs-master = {
|
||||||
enable = true;
|
enable = true;
|
||||||
description = "SeaweedFS Server Master";
|
description = "SeaweedFS Server Master";
|
||||||
after = ["network.target"];
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${weed} master -mdir=. -ip=${master.ip} -port=${master.port} -volumeSizeLimitMB=1024";
|
ExecStart = "${weed} master -mdir=. -ip=${master.ip} -port=${master.port} -volumeSizeLimitMB=1024";
|
||||||
|
@ -105,7 +115,9 @@ in {
|
||||||
Group = "seaweed";
|
Group = "seaweed";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
SyslogIdentifier = "seaweedfs-master";
|
SyslogIdentifier = "seaweedfs-master";
|
||||||
|
Slice = "system-seaweedfs.slice";
|
||||||
};
|
};
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
};
|
};
|
||||||
# volumes
|
# volumes
|
||||||
seaweedfs-volume-dirty = seaweedfsVolume {
|
seaweedfs-volume-dirty = seaweedfsVolume {
|
||||||
|
@ -142,8 +154,6 @@ in {
|
||||||
seaweedfs-filer = {
|
seaweedfs-filer = {
|
||||||
enable = true;
|
enable = true;
|
||||||
description = "SeaweedFS Filer";
|
description = "SeaweedFS Filer";
|
||||||
after = ["network.target"];
|
|
||||||
wantedBy = ["multi-user.target"];
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
# TODO: Restrict s3 access and expose filer?
|
# TODO: Restrict s3 access and expose filer?
|
||||||
|
@ -153,18 +163,26 @@ in {
|
||||||
Group = "seaweed";
|
Group = "seaweed";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
SyslogIdentifier = "seaweedfs-filer";
|
SyslogIdentifier = "seaweedfs-filer";
|
||||||
|
Slice = "system-seaweedfs.slice";
|
||||||
};
|
};
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.mounts = [
|
# This sucks, as weed forks and systemd doesn't like that for mounts.. I'm clueless though
|
||||||
|
systemd.mounts = let
|
||||||
|
deps = [
|
||||||
|
"seaweedfs-master.service"
|
||||||
|
"seaweedfs-filer.service"
|
||||||
|
];
|
||||||
|
in [
|
||||||
{
|
{
|
||||||
what = "fuse";
|
what = "fuse";
|
||||||
where = "/data/media";
|
where = "/data/media";
|
||||||
type = "weed";
|
type = "weed";
|
||||||
options = "filer=localhost:8888,filer.path=/archive/media";
|
options = "filer=localhost:8888,filer.path=/archive/media";
|
||||||
after = ["seaweedfs-filer.service"];
|
after = deps;
|
||||||
requires = ["seaweedfs-filer.service"];
|
requires = deps;
|
||||||
wantedBy = ["multi-user.target"];
|
wantedBy = ["multi-user.target"];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue