From 0913b5fab3834b2b5d07eff0b2a324cf3f7f2049 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 20 Oct 2024 18:01:51 +0100 Subject: [PATCH] totoro: set up seaweedfs --- ops/nixos/totoro/default.nix | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/ops/nixos/totoro/default.nix b/ops/nixos/totoro/default.nix index 438482e6df..c41845edfd 100644 --- a/ops/nixos/totoro/default.nix +++ b/ops/nixos/totoro/default.nix @@ -18,6 +18,7 @@ in { ../lib/plex.nix ../lib/tumblrandom.nix ../lib/freeswitch.nix + ../lib/seaweedfs.nix ./home-assistant.nix ./authentik.nix ./adsb.nix @@ -47,6 +48,12 @@ in { "/store" = zfs "tank/local/store"; "/store/run/containers" = zfs "tank/local/store/containers"; + "/var/lib/private/seaweedfs-filer" = zfs "tank/safe/seaweedfs/filer"; + "/var/lib/private/seaweedfs-master" = zfs "tank/safe/seaweedfs/master"; + "/var/lib/private/seaweedfs-volume" = zfs "tank/safe/seaweedfs/volume"; + "/var/lib/private/seaweedfs-volume/data" = zfs "tank/safe/seaweedfs/volume/data"; + "/var/lib/private/seaweedfs-volume/idx" = zfs "tank/safe/seaweedfs/volume/idx"; + "/boot" = { device = "/dev/disk/by-uuid/D178-4E19"; fsType = "vfat"; @@ -566,5 +573,61 @@ in { port = 3002; }; + my.services.seaweedfs = { + securitySettings = { + cors.allowed_origins.values = "*"; + }; + + master = { + enable = true; + options = { + port = 21000; + ip = config.my.ip.tailscale6; + mdir = "/var/lib/seaweedfs-master/metadata"; + defaultReplication = "000"; + }; + }; + filer = { + enable = true; + earlyOptions = { + v = 4; + }; + options = { + port = 21010; + ip = config.my.ip.tailscale6; + master = "[${config.my.ip.tailscale6}]:21000"; + encryptVolumeData = true; + + defaultReplicaPlacement = "000"; + }; + settings = { + leveldb2 = { + enabled = true; + dir = "/var/lib/seaweedfs-filer/leveldb2"; + }; + }; + }; + volume = { + enable = true; + earlyOptions = { + v = 4; + }; + options = { + port = 21100; + ip = config.my.ip.tailscale6; + dataCenter = "home"; + rack = "home"; + max = 0; + mserver = "[${config.my.ip.tailscale6}]:21000"; + }; + }; + cli.settings = { + cluster.default = "totoro"; + cluster.totoro = { + master = "[${config.my.ip.tailscale6}]:21000"; + }; + }; + }; + system.stateVersion = "22.11"; }