Add Redis for immich

This commit is contained in:
Daniel Cosme
2026-05-05 12:23:57 -04:00
parent f6aa470049
commit 4b1d5a6f9b
13 changed files with 81 additions and 19 deletions

View File

@@ -5,4 +5,6 @@ metadata:
namespace: immich namespace: immich
resources: resources:
- namespace.yaml - namespace.yaml
- redis-srv.yaml
- redis.yaml
- uploads-pvc.yaml - uploads-pvc.yaml

View File

@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: redis
name: redis
namespace: immich
spec:
ports:
- port: 6379
targetPort: 0
selector:
app: redis
status:
loadBalancer: {}

View File

@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: redis
name: redis
namespace: immich
spec:
selector:
matchLabels:
app: redis
strategy: {}
template:
metadata:
labels:
app: redis
spec:
containers:
- image: docker.io/valkey/valkey:9@sha256:3b55fbaa0cd93cf0d9d961f405e4dfcc70efe325e2d84da207a0a8e6d8fde4f9
name: immich_redis
resources: {}
status: {}

View File

@@ -4,7 +4,7 @@ metadata:
name: linking name: linking
namespace: linkding namespace: linkding
resources: resources:
- pvc.yaml
- deployment.yaml - deployment.yaml
- namespace.yaml - namespace.yaml
- pvc.yaml
- srv.yaml - srv.yaml

2
go.mod
View File

@@ -3,7 +3,7 @@ module danicos.dev/daniel/homelab
go 1.26.2 go 1.26.2
require ( require (
danicos.dev/daniel/go-kube v1.13.4 danicos.dev/daniel/go-kube v1.13.7
github.com/cloudnative-pg/api v1.29.0 github.com/cloudnative-pg/api v1.29.0
github.com/fatih/color v1.19.0 github.com/fatih/color v1.19.0
github.com/fluxcd/helm-controller/api v1.5.4 github.com/fluxcd/helm-controller/api v1.5.4

4
go.sum
View File

@@ -1,5 +1,5 @@
danicos.dev/daniel/go-kube v1.13.4 h1:7aXOUOhccvfTcZXAJhHaq3wSvmoVD+cRmD74yyucPsM= danicos.dev/daniel/go-kube v1.13.7 h1:HmIxAERnut8Ue2XLsG8r4LimKJ0MOf/XACa7BoxEMAQ=
danicos.dev/daniel/go-kube v1.13.4/go.mod h1:zOhFK+bE4t14yOokp+yqh8Pht1/U102JV/29QoKBjjc= danicos.dev/daniel/go-kube v1.13.7/go.mod h1:zOhFK+bE4t14yOokp+yqh8Pht1/U102JV/29QoKBjjc=
github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/cloudnative-pg/api v1.29.0 h1:mNx6yJ5qi+Xrjs0NYrUy6V4MlXBkVJxGKwvTJZIuTX4= github.com/cloudnative-pg/api v1.29.0 h1:mNx6yJ5qi+Xrjs0NYrUy6V4MlXBkVJxGKwvTJZIuTX4=

View File

@@ -4,6 +4,6 @@ metadata:
name: cnpg name: cnpg
namespace: cnpg-system namespace: cnpg-system
resources: resources:
- namespace.yaml
- helm-repository-source.yaml
- helm-release.yaml - helm-release.yaml
- helm-repository-source.yaml
- namespace.yaml

View File

@@ -4,6 +4,6 @@ metadata:
name: longhorn name: longhorn
namespace: longhorn-system namespace: longhorn-system
resources: resources:
- release.yaml
- namespace.yaml
- longhorn-stack.yaml - longhorn-stack.yaml
- namespace.yaml
- release.yaml

View File

@@ -4,6 +4,6 @@ metadata:
name: monitoring name: monitoring
namespace: monitoring namespace: monitoring
resources: resources:
- namespace.yaml
- kube-prometheus-stack.yaml - kube-prometheus-stack.yaml
- namespace.yaml
- release.yaml - release.yaml

View File

@@ -5,5 +5,5 @@ metadata:
namespace: cnpg-cluster namespace: cnpg-cluster
resources: resources:
- cluster-namespace.yaml - cluster-namespace.yaml
- pg-cluster.yaml
- immich-db.yaml - immich-db.yaml
- pg-cluster.yaml

View File

@@ -4,7 +4,7 @@ metadata:
name: truenas-csi name: truenas-csi
namespace: truenas-csi namespace: truenas-csi
resources: resources:
- namespace.yaml
- config.yaml - config.yaml
- nfs-storage-class.yaml
- iscsi-storage-class.yaml - iscsi-storage-class.yaml
- namespace.yaml
- nfs-storage-class.yaml

View File

@@ -25,10 +25,14 @@ var Secret = struct {
DBPortKey: "db_port", DBPortKey: "db_port",
} }
const RedisPort = 6379
var meta kube.Metadata var meta kube.Metadata
var Namespace = kube.Namespace(root.Immich.Name) var Namespace = kube.Namespace(root.Immich.Name)
var srv core.Service var srv core.Service
var uploads_pvc core.PersistentVolumeClaim var uploads_pvc core.PersistentVolumeClaim
var redis_meta kube.Metadata
var redis_srv core.Service
func init() { func init() {
meta = kube.NewMetadata(root.Immich.Name, Namespace) meta = kube.NewMetadata(root.Immich.Name, Namespace)
@@ -40,6 +44,9 @@ func init() {
uploads_pvc.Spec.Resources = core.VolumeResourceRequirements{ uploads_pvc.Spec.Resources = core.VolumeResourceRequirements{
Requests: req, Requests: req,
} }
redis_meta = kube.NewMetadata("redis", Namespace)
redis_srv = redis_meta.Service(RedisPort)
} }
func Stack() stack.Stack { func Stack() stack.Stack {
@@ -48,7 +55,8 @@ func Stack() stack.Stack {
map[string]any{ map[string]any{
"namespace": Namespace, "namespace": Namespace,
"uploads-pvc": uploads_pvc, "uploads-pvc": uploads_pvc,
// "redis": Redis(), "redis-srv": redis_srv,
"redis": Redis(),
// "deployment": Deployment(), // "deployment": Deployment(),
}, },
) )
@@ -57,6 +65,15 @@ func Stack() stack.Stack {
func Deployment() apps.Deployment { func Deployment() apps.Deployment {
uploadVol := kube.NewVolumeFrom(kube.VolumeSourcePVC, "upload", uploads_pvc.Name) uploadVol := kube.NewVolumeFrom(kube.VolumeSourcePVC, "upload", uploads_pvc.Name)
localtimeVol := core.Volume{
Name: "localtime",
VolumeSource: core.VolumeSource{
HostPath: &core.HostPathVolumeSource{
Path: "/etc/localtime",
Type: new(core.HostPathFile),
},
},
}
envMapping := map[string]string{} envMapping := map[string]string{}
secretMapping := map[string]string{ secretMapping := map[string]string{
"DB_HOSTNAME": Secret.DBHostKey, "DB_HOSTNAME": Secret.DBHostKey,
@@ -75,15 +92,21 @@ func Deployment() apps.Deployment {
}, },
}, },
Volumes: []core.Volume{ Volumes: []core.Volume{
// /etc/localtime
uploadVol, uploadVol,
localtimeVol,
}, },
} }
return kube.NewDeployment(meta, podSpec) return kube.NewDeployment(meta, podSpec)
} }
func Redis() apps.Deployment { func Redis() apps.Deployment {
meta := kube.NewMetadata(root.Immich.Name+"-redis", Namespace) podSpec := core.PodSpec{
podSpec := core.PodSpec{} Containers: []core.Container{
return kube.NewDeployment(meta, podSpec) {
Name: "immich_redis",
Image: "docker.io/valkey/valkey:9@sha256:3b55fbaa0cd93cf0d9d961f405e4dfcc70efe325e2d84da207a0a8e6d8fde4f9",
},
},
}
return kube.NewDeployment(redis_meta, podSpec)
} }

View File

@@ -35,8 +35,8 @@ var Linkding = Service{
var Immich = Service{ var Immich = Service{
Name: "immich", Name: "immich",
Image: "ghcr.io/immich-app/immich-server:v2.6.0:-release}", Image: "ghcr.io/immich-app/immich-server:v2.6.0:-release",
Port: 2283, Port: 2283, // Server Port
// PublicURL: "https://photos.danicos.me", // PublicURL: "https://photos.danicos.me",
} }