diff --git a/README.md b/README.md index 3ce0544..9254a9e 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ Currently, the applications being deployed like this are: - `kitchenowl` - `forgejo` - `paperless-ngx` +- `syncthing` ## Known bugs diff --git a/flake-parts/kubenix.nix b/flake-parts/kubenix.nix index 3558332..79af1d6 100644 --- a/flake-parts/kubenix.nix +++ b/flake-parts/kubenix.nix @@ -86,4 +86,6 @@ "${self}/kubenix-modules/forgejo" "forgejo" "forgejo"; kubenix.paperless = mkDeployScriptAndManifest "${self}/kubenix-modules/paperless.nix" "paperless" "paperless"; + kubenix.syncthing = mkDeployScriptAndManifest + "${self}/kubenix-modules/syncthing.nix" "syncthing" "syncthing"; }) diff --git a/kubenix-modules/all.nix b/kubenix-modules/all.nix index 0f2bf41..fc671de 100644 --- a/kubenix-modules/all.nix +++ b/kubenix-modules/all.nix @@ -1,7 +1,6 @@ let applications = [ ./inbucket.nix - ./syncthing.nix ./pihole.nix ./media.nix ./bind9 diff --git a/kubenix-modules/base.nix b/kubenix-modules/base.nix index 7634b80..3d281da 100644 --- a/kubenix-modules/base.nix +++ b/kubenix-modules/base.nix @@ -71,6 +71,7 @@ kitchenowl = { }; forgejo = { }; paperless = { }; + syncthing = { }; }; nodes = diff --git a/kubenix-modules/syncthing.nix b/kubenix-modules/syncthing.nix index a152cac..4d46388 100644 --- a/kubenix-modules/syncthing.nix +++ b/kubenix-modules/syncthing.nix @@ -1,47 +1,42 @@ { kubernetes.resources = { - configMaps.syncthing.data = { - PUID = "33"; - PGID = "33"; - TZ = "Europe/Amsterdam"; - }; + deployments.syncthing.spec = { + selector.matchLabels.app = "syncthing"; - deployments.syncthing = { - metadata.labels.app = "syncthing"; + template = { + metadata.labels.app = "syncthing"; - spec = { - selector.matchLabels.app = "syncthing"; + spec = { + containers.syncthing = { + image = "lscr.io/linuxserver/syncthing:1.23.6"; + ports.web.containerPort = 8384; - template = { - metadata.labels.app = "syncthing"; - - 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 = "music"; - mountPath = "/music"; - } - ]; + env = { + PUID.value = "33"; + PGID.value = "33"; + TZ.value = "Europe/Amsterdam"; }; - volumes = { - config.persistentVolumeClaim.claimName = "syncthing"; - music.persistentVolumeClaim.claimName = "music"; - }; + volumeMounts = [ + { + name = "config"; + mountPath = "/config"; + } + { + name = "music"; + mountPath = "/music"; + } + ]; + }; - securityContext = { - fsGroup = 33; - fsGroupChangePolicy = "OnRootMismatch"; - }; + volumes = { + config.persistentVolumeClaim.claimName = "config"; + music.persistentVolumeClaim.claimName = "music"; + }; + + securityContext = { + fsGroup = 33; + fsGroupChangePolicy = "OnRootMismatch"; }; }; }; @@ -55,6 +50,13 @@ targetPort = "web"; }; }; + + persistentVolumeClaims.music.spec = { + accessModes = [ "ReadWriteMany" ]; + storageClassName = ""; + resources.requests.storage = "1Mi"; + volumeName = "music-syncthing"; + }; }; lab = { @@ -67,5 +69,10 @@ portName = "web"; }; }; + + longhorn.persistentVolumeClaim.config = { + volumeName = "syncthing"; + storage = "400Mi"; + }; }; } diff --git a/kubenix-modules/volumes.nix b/kubenix-modules/volumes.nix index bdfd8de..5431a25 100644 --- a/kubenix-modules/volumes.nix +++ b/kubenix-modules/volumes.nix @@ -12,12 +12,21 @@ # volumes.freshrss.persistentVolumeClaim.claimName = "freshrss"; # }; + kubernetes.resources.persistentVolumes.music-syncthing.spec = { + capacity.storage = "1Gi"; + accessModes = [ "ReadWriteMany" ]; + + nfs = { + server = "lewis.dmz"; + path = "/mnt/longhorn/persistent/media/music"; + }; + }; + lab = { longhornVolumes = { minecraft.storage = "1Gi"; pihole-data.storage = "750Mi"; pihole-dnsmasq.storage = "16Mi"; - syncthing.storage = "400Mi"; jellyfin.storage = "5Gi"; transmission.storage = "25Mi"; jellyseerr.storage = "75Mi"; @@ -45,11 +54,12 @@ paperless-data.storage = "10Gi"; paperless-redisdata.storage = "20Mi"; paperless-db.storage = "150Mi"; + syncthing.storage = "400Mi"; }; nfsVolumes = { media.path = "media"; - music.path = "media/music"; + # music.path = "media/music"; }; }; }