From 2077f1f9a35b8df30ba3be4780df3608487b95fb Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Thu, 23 May 2024 21:34:29 +0200 Subject: [PATCH] Migrate syncthing data to longhorn --- kubenix-modules/syncthing.nix | 75 ++++++++++++++++++---------------- kubenix-modules/volumes.nix | 8 ++-- nixos-modules/data-sharing.nix | 1 - 3 files changed, 44 insertions(+), 40 deletions(-) diff --git a/kubenix-modules/syncthing.nix b/kubenix-modules/syncthing.nix index 8aa12c4..1c47d93 100644 --- a/kubenix-modules/syncthing.nix +++ b/kubenix-modules/syncthing.nix @@ -6,46 +6,51 @@ TZ = "Europe/Amsterdam"; }; - # deployments.syncthing = { - # metadata.labels.app = "syncthing"; + deployments.syncthing = { + metadata.labels.app = "syncthing"; - # spec = { - # selector.matchLabels.app = "syncthing"; + spec = { + selector.matchLabels.app = "syncthing"; - # template = { - # metadata.labels.app = "syncthing"; + template = { + metadata.labels.app = "syncthing"; - # spec = { - # containers.syncthing = { - # image = "lscr.io/linuxserver/syncthing:1.23.6"; - # envFrom = [{ configMapRef.name = "syncthing"; }]; - # ports.web.containerPort = 8384; + spec = { + containers.syncthing = { + image = "lscr.io/linuxserver/syncthing:1.23.6"; + envFrom = [{ configMapRef.name = "syncthing"; }]; + ports.web.containerPort = 8384; - # volumeMounts = [ - # { - # name = "config"; - # mountPath = "/config"; - # } - # { - # name = "nextcloud-data"; - # mountPath = "/data"; - # } - # { - # name = "music"; - # mountPath = "/music"; - # } - # ]; - # }; + volumeMounts = [ + { + name = "config"; + mountPath = "/config"; + } + { + name = "nextcloud-data"; + mountPath = "/data"; + } + { + name = "music"; + mountPath = "/music"; + } + ]; + }; - # volumes = { - # config.persistentVolumeClaim.claimName = "syncthing"; - # nextcloud-data.persistentVolumeClaim.claimName = "nextcloud"; - # music.persistentVolumeClaim.claimName = "music"; - # }; - # }; - # }; - # }; - # }; + volumes = { + config.persistentVolumeClaim.claimName = "syncthing"; + nextcloud-data.persistentVolumeClaim.claimName = "nextcloud"; + music.persistentVolumeClaim.claimName = "music"; + }; + + securityContext = { + fsGroup = 33; + fsGroupChangePolicy = "OnRootMismatch"; + }; + }; + }; + }; + }; services.syncthing.spec = { selector.app = "syncthing"; diff --git a/kubenix-modules/volumes.nix b/kubenix-modules/volumes.nix index f4ca35f..ffc4ca1 100644 --- a/kubenix-modules/volumes.nix +++ b/kubenix-modules/volumes.nix @@ -5,14 +5,14 @@ # volumeMounts = [ # { - # name = "kitchenowl"; - # mountPath = "/kitchenowl"; + # name = "syncthing"; + # mountPath = "/syncthing"; # } # ]; # }; # volumes = { - # kitchenowl.persistentVolumeClaim.claimName = "kitchenowl"; + # syncthing.persistentVolumeClaim.claimName = "syncthing"; # }; # }; @@ -27,6 +27,7 @@ pihole-dnsmasq.storage = "16Mi"; forgejo.storage = "20Gi"; kitchenowl.storage = "100Mi"; + syncthing.storage = "400Mi"; }; nfsVolumes = { @@ -40,7 +41,6 @@ sonarr-config.path = "sonarr/config"; bazarr-config.path = "bazarr/config"; atticd.path = "atticd"; - syncthing.path = "syncthing/config"; paperless-ngx-redisdata.path = "paperless-ngx/redisdata"; paperless-ngx-data.path = "paperless-ngx/data"; }; diff --git a/nixos-modules/data-sharing.nix b/nixos-modules/data-sharing.nix index eb833af..2e02d32 100644 --- a/nixos-modules/data-sharing.nix +++ b/nixos-modules/data-sharing.nix @@ -3,7 +3,6 @@ let cfg = config.lab.data-sharing; nfsShares = [ - "/syncthing/config" "/paperless-ngx/data" "/paperless-ngx/redisdata" "/media"