From 5cbfb9c645e035bea7524c00016d686a0eb13b99 Mon Sep 17 00:00:00 2001 From: Paul Payne Date: Tue, 27 May 2025 17:19:41 -0700 Subject: [PATCH] Add Immich application deployment files and configuration - Create README.md for Immich app description - Add example.env for configuration settings - Implement deployment.yaml for Immich server and microservices - Set up ingress.yaml for public access with DNS annotations - Introduce db-init-job.yaml for database initialization - Configure kustomization.yaml for resource management - Define manifest.yaml for Immich app installation details - Create namespace.yaml for isolating Immich resources - Establish PVCs in pvc.yaml for storage management - Set up services in service.yaml for server and machine learning components - Update CoreDNS custom config to handle AAAA records --- apps/immich/README.md | 1 + apps/immich/config/example.env | 32 ++++ apps/immich/deployment.yaml | 138 ++++++++++++++++++ apps/immich/ingress.yaml | 24 +++ apps/immich/init/db-init-job.yaml | 62 ++++++++ apps/immich/init/kustomization.yaml | 4 + apps/immich/kustomization.yaml | 87 +++++++++++ apps/immich/manifest.yaml | 8 + apps/immich/namespace.yaml | 4 + apps/immich/pvc.yaml | 24 +++ apps/immich/service.yaml | 29 ++++ .../coredns/coredns-custom-config.yaml | 4 + 12 files changed, 417 insertions(+) create mode 100644 apps/immich/README.md create mode 100644 apps/immich/config/example.env create mode 100644 apps/immich/deployment.yaml create mode 100644 apps/immich/ingress.yaml create mode 100644 apps/immich/init/db-init-job.yaml create mode 100644 apps/immich/init/kustomization.yaml create mode 100644 apps/immich/kustomization.yaml create mode 100644 apps/immich/manifest.yaml create mode 100644 apps/immich/namespace.yaml create mode 100644 apps/immich/pvc.yaml create mode 100644 apps/immich/service.yaml diff --git a/apps/immich/README.md b/apps/immich/README.md new file mode 100644 index 0000000..5787be4 --- /dev/null +++ b/apps/immich/README.md @@ -0,0 +1 @@ +# Immich App diff --git a/apps/immich/config/example.env b/apps/immich/config/example.env new file mode 100644 index 0000000..c78df0d --- /dev/null +++ b/apps/immich/config/example.env @@ -0,0 +1,32 @@ +# Config +IMMICH_DOMAIN=immich.$DOMAIN +IMMICH_STORAGE=100Gi +IMMICH_CACHE_STORAGE=10Gi +TZ=UTC + +# Docker Images +IMMICH_SERVER_IMAGE=ghcr.io/immich-app/immich-server:release +IMMICH_ML_IMAGE=ghcr.io/immich-app/immich-machine-learning:release + +# Database Configuration +DB_HOSTNAME=postgres.postgres +DB_PORT=5432 +DB_USERNAME=immich +DB_DATABASE_NAME=immich +POSTGRES_ADMIN_USER=$POSTGRES_USER + +# Redis Configuration +REDIS_HOSTNAME=redis.redis +REDIS_PORT=6379 + +# Machine Learning Configuration +MACHINE_LEARNING_WORKERS=1 +MACHINE_LEARNING_MODEL_TTL=300 + +# Immich Configuration +IMMICH_ENV=production +IMMICH_LOG_LEVEL=info + +# Secrets (populate these in config.env and secrets.env) +DB_PASSWORD= +POSTGRES_ADMIN_PASSWORD=$POSTGRES_PASSWORD \ No newline at end of file diff --git a/apps/immich/deployment.yaml b/apps/immich/deployment.yaml new file mode 100644 index 0000000..0c7fbd1 --- /dev/null +++ b/apps/immich/deployment.yaml @@ -0,0 +1,138 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: immich-server +spec: + replicas: 1 + selector: + matchLabels: + app: immich-server + strategy: + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 + type: RollingUpdate + template: + metadata: + labels: + app: immich-server + component: server + spec: + containers: + - image: ghcr.io/immich-app/immich-server:release + name: immich-server + ports: + - containerPort: 2283 + protocol: TCP + envFrom: + - secretRef: + name: secrets + - configMapRef: + name: config + env: + - name: REDIS_HOSTNAME + value: redis.redis + - name: DB_HOSTNAME + value: postgres.postgres + - name: TZ + valueFrom: + configMapKeyRef: + key: TZ + name: config + volumeMounts: + - mountPath: /usr/src/app/upload + name: immich-storage + readOnly: false + volumes: + - name: immich-storage + persistentVolumeClaim: + claimName: immich-pvc +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: immich-microservices +spec: + replicas: 1 + selector: + matchLabels: + app: immich-microservices + strategy: + rollingUpdate: + maxSurge: 0 + maxUnavailable: 1 + type: RollingUpdate + template: + metadata: + labels: + app: immich-microservices + component: microservices + spec: + containers: + - image: ghcr.io/immich-app/immich-server:release + name: immich-microservices + envFrom: + - secretRef: + name: secrets + - configMapRef: + name: config + env: + - name: REDIS_HOSTNAME + value: redis.redis + - name: DB_HOSTNAME + value: postgres.postgres + - name: TZ + valueFrom: + configMapKeyRef: + key: TZ + name: config + - name: IMMICH_WORKERS_INCLUDE + value: api + volumeMounts: + - mountPath: /usr/src/app/upload + name: immich-storage + readOnly: false + volumes: + - name: immich-storage + persistentVolumeClaim: + claimName: immich-pvc +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: immich-machine-learning +spec: + replicas: 1 + selector: + matchLabels: + app: immich-machine-learning + template: + metadata: + labels: + app: immich-machine-learning + component: machine-learning + spec: + containers: + - image: ghcr.io/immich-app/immich-machine-learning:release + name: immich-machine-learning + ports: + - containerPort: 3003 + protocol: TCP + envFrom: + - configMapRef: + name: config + env: + - name: TZ + valueFrom: + configMapKeyRef: + key: TZ + name: config + volumeMounts: + - mountPath: /cache + name: immich-cache + readOnly: false + volumes: + - name: immich-cache + persistentVolumeClaim: + claimName: immich-cache-pvc \ No newline at end of file diff --git a/apps/immich/ingress.yaml b/apps/immich/ingress.yaml new file mode 100644 index 0000000..c956c77 --- /dev/null +++ b/apps/immich/ingress.yaml @@ -0,0 +1,24 @@ +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: immich-public + annotations: + external-dns.alpha.kubernetes.io/target: your.immich.domain + external-dns.alpha.kubernetes.io/cloudflare-proxied: "false" +spec: + rules: + - host: your.immich.domain + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: immich-server + port: + number: 3001 + tls: + - secretName: wildcard-internal-sovereign-cloud-tls + hosts: + - your.immich.domain \ No newline at end of file diff --git a/apps/immich/init/db-init-job.yaml b/apps/immich/init/db-init-job.yaml new file mode 100644 index 0000000..4ce3854 --- /dev/null +++ b/apps/immich/init/db-init-job.yaml @@ -0,0 +1,62 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: immich-db-init +spec: + template: + spec: + containers: + - name: db-init + image: postgres:15 + command: ["/bin/bash", "-c"] + args: + - | + PGPASSWORD=${POSTGRES_ADMIN_PASSWORD} psql -h ${DB_HOSTNAME} -U postgres <