NAS-122507 / 23.10 / Add immich to community train (#1271)

* initial commit

* add some todo

* extend config

* remove typesense url

* add microservices

* add proxy and typesense

* ML

* fix configmap

* fixup config

* change range

* one more

* add some inits

* ts dont need to wait for server

* wait web

* add redis

* fix redis

* wrong space

* type

* add redis service

* conditional services

* fix redis...

* add caps

* fix capabilities

* fix service

* add tests

* fix conditional pods

* fix upgrade_strategy

* fix config

* lint

* whops

* update strategy

* make robust

* cleaner

* fix regex

* Take a copy of the resources before we start doing modifications

* regen commontgz

* bump versions

* add pullPolicy

* regen common

* bump version

* bump

* bump helm

* regen common

* Update library/ix-dev/community/immich/values.yaml

* bump

* update resources validation
This commit is contained in:
Stavros Kois
2023-07-05 18:42:37 +03:00
committed by GitHub
parent 4923f58fd3
commit edde8c3839
36 changed files with 1521 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ jobs:
helm-version:
- v3.9.4
- v3.10.3
- v3.12.0
- v3.12.1
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
@@ -87,7 +87,7 @@ jobs:
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
helm-version:
- v3.9.4
- v3.12.0
- v3.12.1
# We run tests on k3s version of latest SCALE release, SCALE nightly and manually defined "latest"
k3s-version:
- v1.25.3+k3s1

View File

@@ -19,7 +19,7 @@ jobs:
helm-version:
- v3.9.4
- v3.10.3
- v3.12.0
- v3.12.1
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
@@ -57,7 +57,7 @@ jobs:
helm-version:
- v3.9.4
- v3.10.3
- v3.12.0
- v3.12.1
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
@@ -97,7 +97,7 @@ jobs:
- v1.25.3+k3s1
# We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
helm-version:
- v3.12.0
- v3.12.1
values:
- basic-values.yaml
- configmap-values.yaml

View File

@@ -2,7 +2,7 @@ apiVersion: v2
name: common
description: A library chart for iX Official Catalog
type: library
version: 1.0.9
version: 1.0.10
appVersion: v1
annotations:
title: Common Library Chart

View File

@@ -0,0 +1,93 @@
{{/* Returns a redis pod with init container for fixing permissions
and a pre-upgrade job to backup the database */}}
{{/* Call this template:
{{ include "ix.v1.common.app.redis" (dict "name" "redis" "secretName" "redis-creds" "resources" .Values.resources) }}
name (optional): Name of the redis pod/container (default: redis)
secretName (required): Name of the secret containing the redis credentials
resources (required): Resources for the redis container
*/}}
{{- define "ix.v1.common.app.redis" -}}
{{- $name := .name | default "redis" -}}
{{- $secretName := (required "Redis - Secret Name is required" .secretName) -}}
{{- $resources := (required "Redis - Resources are required" .resources) }}
{{ $name }}:
enabled: true
type: Deployment
podSpec:
securityContext:
fsGroup: 1001
containers:
{{ $name }}:
enabled: true
primary: true
imageSelector: redisImage
securityContext:
runAsUser: 1001
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
resources:
limits:
cpu: {{ $resources.limits.cpu }}
memory: {{ $resources.limits.memory }}
envFrom:
- secretRef:
name: {{ $secretName }}
probes:
liveness:
enabled: true
type: exec
command:
- /bin/sh
- -c
- redis-cli -a "$REDIS_PASSWORD" -p ${REDIS_PORT_NUMBER:-6379} ping | grep -q PONG
readiness:
enabled: true
type: exec
command:
- /bin/sh
- -c
- redis-cli -a "$REDIS_PASSWORD" -p ${REDIS_PORT_NUMBER:-6379} ping | grep -q PONG
startup:
enabled: true
type: exec
command:
- /bin/sh
- -c
- redis-cli -a "$REDIS_PASSWORD" -p ${REDIS_PORT_NUMBER:-6379} ping | grep -q PONG
{{- end -}}
{{/* Returns a redis-wait container for waiting for redis to be ready */}}
{{/* Call this template:
{{ include "ix.v1.common.app.redisWait" (dict "name" "redis-wait" "secretName" "redis-creds") }}
name (optional): Name of the redis-wait container (default: redis-wait)
secretName (required): Name of the secret containing the redis credentials
*/}}
{{- define "ix.v1.common.app.redisWait" -}}
{{- $name := .name | default "redis-wait" -}}
{{- $secretName := (required "Redis-Wait - Secret Name is required" .secretName) }}
{{ $name }}:
enabled: true
type: init
imageSelector: redisImage
envFrom:
- secretRef:
name: {{ $secretName }}
resources:
limits:
cpu: 500m
memory: 256Mi
command: bash
args:
- -c
- |
echo "Waiting for redis to be ready"
until redis-cli -h "$REDIS_HOST" -a "$REDIS_PASSWORD" -p ${REDIS_PORT_NUMBER:-6379} ping | grep -q PONG; do
echo "Waiting for redis to be ready. Sleeping 2 seconds..."
sleep 2
done
echo "Redis is ready!"
{{- end -}}

View File

@@ -8,7 +8,7 @@ objectData: The object data to be used to render the container.
{{- $rootCtx := .rootCtx -}}
{{- $objectData := .objectData -}}
{{- $resources := $rootCtx.Values.resources -}}
{{- $resources := mustDeepCopy $rootCtx.Values.resources -}}
{{- if $objectData.resources -}}
{{- $resources = mustMergeOverwrite $resources $objectData.resources -}}

View File

@@ -51,6 +51,11 @@ mariadbImage:
tag: "10.6.14"
pullPolicy: IfNotPresent
redisImage:
repository: bitnami/redis
tag: "7.0.11"
pullPolicy: IfNotPresent
# -- (docs/README.md)
securityContext:
container:

View File

@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: file://../../../common
version: 1.0.10
digest: sha256:06709bd6d9a8dbb721eec437a52f8c24aeecefbbc57e6f8617e53b29570d5512
generated: "2023-06-20T18:37:14.983325697+03:00"

View File

@@ -0,0 +1,26 @@
name: immich
description: Immich
annotations:
title: Immich
type: application
version: 1.0.0
apiVersion: v2
appVersion: '1.61.1'
kubeVersion: '>=1.16.0-0'
maintainers:
- name: truenas
url: https://www.truenas.com/
email: dev@ixsystems.com
dependencies:
- name: common
repository: file://../../../common
version: 1.0.10
home: https://immich.app
icon: https://github.com/immich-app/immich/raw/main/design/immich-logo.svg
sources:
- https://immich.app
- https://github.com/truenas/charts/tree/master/community/immich
- https://github.com/immich-app/immich
keywords:
- photos
- backup

View File

@@ -0,0 +1,3 @@
# Immich
[Immich](https://immich.app) - Self-hosted backup solution for photos and videos on mobile device

View File

@@ -0,0 +1,3 @@
# Immich
[Immich](https://immich.app) - Self-hosted backup solution for photos and videos on mobile device

View File

@@ -0,0 +1,22 @@
immichStorage:
uploads:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/uploads
library:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/library
thumbs:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/thumbs
profile:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/profile
video:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/video
pgData:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/pgData
pgBackup:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/pgBackup

View File

@@ -0,0 +1,26 @@
immichStorage:
uploads:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/uploads
library:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/library
thumbs:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/thumbs
profile:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/profile
video:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/video
pgData:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/pgData
pgBackup:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/pgBackup
immichConfig:
enableML: false
enableTypesense: false

View File

@@ -0,0 +1,25 @@
immichStorage:
uploads:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/uploads
library:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/library
thumbs:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/thumbs
profile:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/profile
video:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/video
pgData:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/pgData
pgBackup:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/pgBackup
immichConfig:
enableML: false

View File

@@ -0,0 +1,25 @@
immichStorage:
uploads:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/uploads
library:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/library
thumbs:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/thumbs
profile:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/profile
video:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/video
pgData:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/pgData
pgBackup:
type: hostPath
hostPath: /mnt/{{ .Release.Name }}/pgBackup
immichConfig:
enableTypesense: false

View File

@@ -0,0 +1,7 @@
icon_url: https://github.com/immich-app/immich/raw/main/design/immich-logo.svg
categories:
- media
screenshots: []
tags:
- photos
- backup

View File

@@ -0,0 +1,14 @@
runAsContext:
- userName: root
groupName: root
gid: 0
uid: 0
description: Immich runs as root user in order to spawn different sub-processes.
capabilities:
- name: CHOWN
description: Immich Proxy is able to chown files.
- name: SETUID
description: Immich Proxy and Web is able to set user ID for it's sub-processes.
- name: SETGID
description: Immich Proxy and Web is able to set group ID for it's sub-processes.
hostMounts: []

View File

@@ -0,0 +1,410 @@
groups:
- name: Immich Configuration
description: Configure Immich
- name: Network Configuration
description: Configure Network for Immich
- name: Storage Configuration
description: Configure Storage for Immich
- name: Resources Configuration
description: Configure Resources for Immich
portals:
web_portal:
protocols:
- "$kubernetes-resource_configmap_portal_protocol"
host:
- "$kubernetes-resource_configmap_portal_host"
ports:
- "$kubernetes-resource_configmap_portal_port"
path: "$kubernetes-resource_configmap_portal_path"
questions:
- variable: TZ
group: Immich Configuration
label: Timezone
schema:
type: string
default: Etc/UTC
required: true
$ref:
- definitions/timezone
- variable: immichConfig
label: ""
group: Immich Configuration
schema:
type: dict
attrs:
- variable: disableReverseGeocoding
label: Disable Reverse Geocoding
schema:
type: boolean
default: false
show_subquestions_if: true
subquestions:
- variable: reverseGeocodingPrecision
label: Reverse Geocoding Precision
description: |
The precision of the reverse geocoding. The higher the number, the more precise the reverse geocoding will be.</br>
This ranges from 0-3 with 3 being the most precise</br>
- 3 - Cities > 500 population: ~200MB RAM</br>
- 2 - Cities > 1000 population: ~150MB RAM</br>
- 1 - Cities > 5000 population: ~80MB RAM</br>
- 0 - Cities > 15000 population: ~40MB RAM
schema:
type: int
default: 3
min: 0
max: 3
required: true
- variable: publicLoginMessage
label: Public Login Message
description: |
The message that will be displayed on the login page.
schema:
type: string
default: ""
- variable: enableML
label: Enable Machine Learning
description: |
Enable Machine Learning
schema:
type: boolean
default: true
- variable: enableTypesense
label: Enable Typesense
description: |
Enable Typesense
schema:
type: boolean
default: true
- variable: immichNetwork
label: ""
group: Network Configuration
schema:
type: dict
attrs:
- variable: webuiPort
label: Web Port
description: The port for the Immich WebUI.
schema:
type: int
default: 30041
min: 9000
max: 65535
required: true
- variable: immichStorage
label: ""
group: Storage Configuration
schema:
type: dict
attrs:
- variable: uploads
label: Immich Uploads Storage
description: The path to store Immich uploads.
schema:
type: dict
attrs:
- variable: type
label: Type
description: |
ixVolume: Is dataset created automatically by the system.</br>
Host Path: Is a path that already exists on the system.
schema:
type: string
required: true
default: ixVolume
enum:
- value: hostPath
description: Host Path (Path that already exists on the system)
- value: ixVolume
description: ixVolume (Dataset created automatically by the system)
- variable: datasetName
label: Dataset Name
schema:
type: string
show_if: [["type", "=", "ixVolume"]]
required: true
hidden: true
immutable: true
default: uploads
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: library
label: Immich Library Storage
description: The path to store Immich library.
schema:
type: dict
attrs:
- variable: type
label: Type
description: |
ixVolume: Is dataset created automatically by the system.</br>
Host Path: Is a path that already exists on the system.
schema:
type: string
required: true
default: ixVolume
enum:
- value: hostPath
description: Host Path (Path that already exists on the system)
- value: ixVolume
description: ixVolume (Dataset created automatically by the system)
- variable: datasetName
label: Dataset Name
schema:
type: string
show_if: [["type", "=", "ixVolume"]]
required: true
hidden: true
immutable: true
default: library
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: thumbs
label: Immich Thumbs Storage
description: The path to store Immich Thumbs.
schema:
type: dict
attrs:
- variable: type
label: Type
description: |
ixVolume: Is dataset created automatically by the system.</br>
Host Path: Is a path that already exists on the system.
schema:
type: string
required: true
default: ixVolume
enum:
- value: hostPath
description: Host Path (Path that already exists on the system)
- value: ixVolume
description: ixVolume (Dataset created automatically by the system)
- variable: datasetName
label: Dataset Name
schema:
type: string
show_if: [["type", "=", "ixVolume"]]
required: true
hidden: true
immutable: true
default: thumbs
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: profile
label: Immich Profile Storage
description: The path to store Immich Profile.
schema:
type: dict
attrs:
- variable: type
label: Type
description: |
ixVolume: Is dataset created automatically by the system.</br>
Host Path: Is a path that already exists on the system.
schema:
type: string
required: true
default: ixVolume
enum:
- value: hostPath
description: Host Path (Path that already exists on the system)
- value: ixVolume
description: ixVolume (Dataset created automatically by the system)
- variable: datasetName
label: Dataset Name
schema:
type: string
show_if: [["type", "=", "ixVolume"]]
required: true
hidden: true
immutable: true
default: profile
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: video
label: Immich Video Storage
description: The path to store Immich Video.
schema:
type: dict
attrs:
- variable: type
label: Type
description: |
ixVolume: Is dataset created automatically by the system.</br>
Host Path: Is a path that already exists on the system.
schema:
type: string
required: true
default: ixVolume
enum:
- value: hostPath
description: Host Path (Path that already exists on the system)
- value: ixVolume
description: ixVolume (Dataset created automatically by the system)
- variable: datasetName
label: Dataset Name
schema:
type: string
show_if: [["type", "=", "ixVolume"]]
required: true
hidden: true
immutable: true
default: video
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: pgData
label: Immich Postgres Data Storage
description: The path to store Immich Postgres Data.
schema:
type: dict
attrs:
- variable: type
label: Type
description: |
ixVolume: Is dataset created automatically by the system.</br>
Host Path: Is a path that already exists on the system.
schema:
type: string
required: true
default: ixVolume
enum:
- value: hostPath
description: Host Path (Path that already exists on the system)
- value: ixVolume
description: ixVolume (Dataset created automatically by the system)
- variable: datasetName
label: Dataset Name
schema:
type: string
show_if: [["type", "=", "ixVolume"]]
required: true
hidden: true
immutable: true
default: pgData
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: pgBackup
label: Immich Postgres Backup Storage
description: The path to store Immich Postgres Backup.
schema:
type: dict
attrs:
- variable: type
label: Type
description: |
ixVolume: Is dataset created automatically by the system.</br>
Host Path: Is a path that already exists on the system.
schema:
type: string
required: true
default: ixVolume
enum:
- value: hostPath
description: Host Path (Path that already exists on the system)
- value: ixVolume
description: ixVolume (Dataset created automatically by the system)
- variable: datasetName
label: Dataset Name
schema:
type: string
show_if: [["type", "=", "ixVolume"]]
required: true
hidden: true
immutable: true
default: pgBackup
$ref:
- "normalize/ixVolume"
- variable: hostPath
label: Host Path
schema:
type: hostpath
show_if: [["type", "=", "hostPath"]]
immutable: true
required: true
- variable: resources
label: ""
group: Resources Configuration
schema:
type: dict
attrs:
- variable: limits
label: Limits
schema:
type: dict
attrs:
- variable: cpu
label: CPU
description: CPU limit for Immich.
schema:
type: string
max_length: 6
valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$'
valid_chars_error: |
Valid CPU limit formats are</br>
- Plain Integer - eg. 1</br>
- Float - eg. 0.5</br>
- Milicpu - eg. 500m
default: "4000m"
required: true
- variable: memory
label: Memory
description: Memory limit for Immich.
schema:
type: string
max_length: 12
valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$'
valid_chars_error: |
Valid Memory limit formats are</br>
- Suffixed with E/P/T/G/M/K - eg. 1G</br>
- Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi</br>
- Plain Integer in bytes - eg. 1024</br>
- Exponent - eg. 134e6
default: "8Gi"
required: true

View File

@@ -0,0 +1 @@
{{ include "ix.v1.common.lib.chart.notes" $ }}

View File

@@ -0,0 +1,125 @@
{{- define "immich.configuration" -}}
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
{{- $dbHost := (printf "%s-postgres" $fullname) -}}
{{- $dbUser := "immich" -}}
{{- $dbName := "immich" -}}
{{- $dbPass := randAlphaNum 32 -}}
{{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-postgres-creds" $fullname)) -}}
{{- $dbPass = ((index .data "POSTGRES_PASSWORD") | b64dec) -}}
{{- end -}}
{{- $redisHost := (printf "%s-redis" $fullname) -}}
{{- $redisPass := randAlphaNum 32 -}}
{{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-redis-creds" $fullname)) -}}
{{- $redisPass = ((index .data "REDIS_PASSWORD") | b64dec) -}}
{{- end -}}
{{- $dbURL := (printf "postgres://%s:%s@%s:5432/%s?sslmode=disable" $dbUser $dbPass $dbHost $dbName) -}}
{{- $typesenseKey := randAlphaNum 32 -}}
{{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-immich-creds" $fullname)) -}}
{{- $typesenseKey = ((index .data "TYPESENSE_API_KEY") | b64dec) -}}
{{- end -}}
{{- $mlURL := "false" -}}
{{- if .Values.immichConfig.enableML -}}
{{- $mlURL = printf "http://%v-machinelearning:%v" $fullname .Values.immichNetwork.microservicesPort -}}
{{- end }}
secret:
postgres-creds:
enabled: true
data:
POSTGRES_USER: {{ $dbUser }}
POSTGRES_DB: {{ $dbName }}
POSTGRES_PASSWORD: {{ $dbPass }}
POSTGRES_HOST: {{ $dbHost }}
POSTGRES_URL: {{ $dbURL }}
redis-creds:
enabled: true
data:
ALLOW_EMPTY_PASSWORD: "no"
REDIS_PASSWORD: {{ $redisPass }}
REDIS_HOST: {{ $redisHost }}
{{/* Server & Microservices */}}
immich-creds:
enabled: true
data:
IMMICH_MACHINE_LEARNING_URL: {{ $mlURL | quote }}
TYPESENSE_ENABLED: {{ .Values.immichConfig.enableTypesense | quote }}
TYPESENSE_API_KEY: {{ $typesenseKey }}
{{- if .Values.immichConfig.enableTypesense }}
TYPESENSE_PROTOCOL: http
TYPESENSE_HOST: {{ printf "%v-typesense" $fullname }}
TYPESENSE_PORT: {{ .Values.immichNetwork.typesensePort | quote }}
{{- end }}
DB_USERNAME: {{ $dbUser }}
DB_PASSWORD: {{ $dbPass }}
DB_HOSTNAME: {{ $dbHost }}
DB_DATABASE_NAME: {{ $dbName }}
DB_PORT: "5432"
REDIS_HOSTNAME: {{ $redisHost }}
REDIS_PASSWORD: {{ $redisPass }}
REDIS_PORT: "6379"
REDIS_DBINDEX: "0"
{{- if .Values.immichConfig.enableTypesense }}
typesense-creds:
enabled: true
data:
TYPESENSE_API_KEY: {{ $typesenseKey }}
TYPESENSE_DATA_DIR: /typesense-data
{{- end }}
configmap:
server-config:
enabled: true
data:
LOG_LEVEL: log
NODE_ENV: production
SERVER_PORT: {{ .Values.immichNetwork.serverPort | quote }}
micro-config:
enabled: true
data:
LOG_LEVEL: log
NODE_ENV: production
MICROSERVICES_PORT: {{ .Values.immichNetwork.microservicesPort | quote }}
DISABLE_REVERSE_GEOCODING: {{ .Values.immichConfig.disableReverseGeocoding | quote }}
{{- if not .Values.immichConfig.disableReverseGeocoding }}
REVERSE_GEOCODING_PRECISION: {{ .Values.immichConfig.reverseGeocodingPrecision | quote }}
{{- end }}
REVERSE_GEOCODING_DUMP_DIRECTORY: /microcache
web-config:
enabled: true
data:
NODE_ENV: production
PORT: {{ .Values.immichNetwork.webPort | quote }}
IMMICH_SERVER_URL: {{ printf "http://%v-server:%v" $fullname .Values.immichNetwork.serverPort }}
PUBLIC_IMMICH_SERVER_URL: {{ printf "http://%v-server:%v" $fullname .Values.immichNetwork.serverPort }}
{{- with .Values.immichConfig.publicLoginMessage }}
PUBLIC_LOGIN_PAGE_MESSAGE: {{ . | quote }}
{{- end }}
proxy-config:
enabled: true
data:
IMMICH_WEB_URL: {{ printf "http://%v-web:%v" $fullname .Values.immichNetwork.webPort }}
IMMICH_SERVER_URL: {{ printf "http://%v-server:%v" $fullname .Values.immichNetwork.serverPort }}
{{- if .Values.immichConfig.enableML }}
ml-config:
enabled: true
data:
NODE_ENV: production
MACHINE_LEARNING_PORT: {{ .Values.immichNetwork.machinelearningPort | quote }}
MACHINE_LEARNING_CACHE_FOLDER: /mlcache
TRANSFORMERS_CACHE: /mlcache
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,41 @@
{{- define "immich.machinelearning.workload" -}}
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
{{- $url := printf "http://%v-server:%v/server-info/ping" $fullname .Values.immichNetwork.serverPort }}
workload:
machinelearning:
enabled: true
type: Deployment
podSpec:
hostNetwork: false
containers:
machinelearning:
enabled: true
primary: true
imageSelector: mlImage
securityContext:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
envFrom:
- configMapRef:
name: ml-config
probes:
liveness:
enabled: true
type: http
port: {{ .Values.immichNetwork.machinelearningPort }}
path: /ping
readiness:
enabled: true
type: http
port: {{ .Values.immichNetwork.machinelearningPort }}
path: /ping
startup:
enabled: true
type: http
port: {{ .Values.immichNetwork.machinelearningPort }}
path: /ping
initContainers:
{{- include "immich.wait.init" (dict "url" $url) | indent 8 }}
{{- end -}}

View File

@@ -0,0 +1,57 @@
{{- define "immich.microservices.workload" -}}
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
{{- $url := printf "http://%v-server:%v/server-info/ping" $fullname .Values.immichNetwork.serverPort }}
workload:
microservices:
enabled: true
type: Deployment
podSpec:
hostNetwork: false
containers:
microservices:
enabled: true
primary: true
imageSelector: image
securityContext:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
args: start-microservices.sh
envFrom:
- secretRef:
name: immich-creds
- configMapRef:
name: micro-config
probes:
liveness:
enabled: true
type: exec
command:
- /bin/sh
- -c
- |
ps -a | grep -v grep | grep -q microservices
readiness:
enabled: true
type: exec
command:
- /bin/sh
- -c
- |
ps -a | grep -v grep | grep -q microservices
startup:
enabled: true
type: exec
command:
- /bin/sh
- -c
- |
ps -a | grep -v grep | grep -q microservices
initContainers:
{{- include "ix.v1.common.app.postgresWait" (dict "name" "postgres-wait"
"secretName" "postgres-creds") | nindent 8 }}
{{- include "ix.v1.common.app.redisWait" (dict "name" "redis-wait"
"secretName" "redis-creds") | nindent 8 }}
{{- include "immich.wait.init" (dict "url" $url) | indent 8 }}
{{- end -}}

View File

@@ -0,0 +1,48 @@
{{- define "immich.proxy.workload" -}}
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
{{- $serverUrl := printf "http://%v-server:%v/server-info/ping" $fullname .Values.immichNetwork.serverPort -}}
{{- $webUrl := printf "http://%v-web:%v/robots.txt" $fullname .Values.immichNetwork.webPort }}
workload:
proxy:
enabled: true
type: Deployment
podSpec:
hostNetwork: false
containers:
proxy:
enabled: true
primary: true
imageSelector: proxyImage
securityContext:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
capabilities:
add:
- CHOWN
- SETUID
- SETGID
envFrom:
- configMapRef:
name: proxy-config
probes:
liveness:
enabled: true
type: http
path: /api/server-info/ping
port: 8080
readiness:
enabled: true
type: http
path: /api/server-info/ping
port: 8080
startup:
enabled: true
type: http
path: /api/server-info/ping
port: 8080
initContainers:
{{- include "immich.wait.init" (dict "url" $serverUrl) | indent 8 }}
{{- include "immich.wait.init" (dict "url" $webUrl) | indent 8 }}
{{- end -}}

View File

@@ -0,0 +1,51 @@
{{- define "immich.server.workload" -}}
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
{{- $typesenseUrl := printf "http://%v-typesense:%v/health" $fullname .Values.immichNetwork.typesensePort }}
workload:
server:
enabled: true
primary: true
type: Deployment
podSpec:
hostNetwork: false
containers:
server:
enabled: true
primary: true
imageSelector: image
securityContext:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
args: start-server.sh
envFrom:
- secretRef:
name: immich-creds
- configMapRef:
name: server-config
probes:
liveness:
enabled: true
type: http
path: /server-info/ping
port: {{ .Values.immichNetwork.serverPort }}
readiness:
enabled: true
type: http
path: /server-info/ping
port: {{ .Values.immichNetwork.serverPort }}
startup:
enabled: true
type: http
path: /server-info/ping
port: {{ .Values.immichNetwork.serverPort }}
initContainers:
{{- include "ix.v1.common.app.postgresWait" (dict "name" "postgres-wait"
"secretName" "postgres-creds") | nindent 8 }}
{{- include "ix.v1.common.app.redisWait" (dict "name" "redis-wait"
"secretName" "redis-creds") | nindent 8 }}
{{- if .Values.immichConfig.enableTypesense }}
{{- include "immich.wait.init" (dict "url" $typesenseUrl) | indent 8 }}
{{- end }}
{{- end -}}

View File

@@ -0,0 +1,42 @@
{{- define "immich.typesense.workload" -}}
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
{{- $url := printf "http://%v-server:%v/server-info/ping" $fullname .Values.immichNetwork.serverPort }}
workload:
typesense:
enabled: true
type: Deployment
podSpec:
hostNetwork: false
containers:
typesense:
enabled: true
primary: true
imageSelector: typesenseImage
args:
- --api-port
- {{ .Values.immichNetwork.typesensePort | quote }}
securityContext:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
envFrom:
- secretRef:
name: typesense-creds
probes:
liveness:
enabled: true
type: http
path: /health
port: {{ .Values.immichNetwork.typesensePort }}
readiness:
enabled: true
type: http
path: /health
port: {{ .Values.immichNetwork.typesensePort }}
startup:
enabled: true
type: http
path: /health
port: {{ .Values.immichNetwork.typesensePort }}
{{- end -}}

View File

@@ -0,0 +1,45 @@
{{- define "immich.web.workload" -}}
{{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
{{- $url := printf "http://%v-server:%v/server-info/ping" $fullname .Values.immichNetwork.serverPort }}
workload:
web:
enabled: true
type: Deployment
podSpec:
hostNetwork: false
containers:
web:
enabled: true
primary: true
imageSelector: webImage
securityContext:
runAsUser: 0
runAsGroup: 0
runAsNonRoot: false
readOnlyRootFilesystem: false
capabilities:
add:
- SETUID
- SETGID
envFrom:
- configMapRef:
name: web-config
probes:
liveness:
enabled: true
type: http
path: /robots.txt
port: {{ .Values.immichNetwork.webPort }}
readiness:
enabled: true
type: http
path: /robots.txt
port: {{ .Values.immichNetwork.webPort }}
startup:
enabled: true
type: http
path: /robots.txt
port: {{ .Values.immichNetwork.webPort }}
initContainers:
{{- include "immich.wait.init" (dict "url" $url) | indent 8 }}
{{- end -}}

View File

@@ -0,0 +1,137 @@
{{- define "immich.persistence" -}}
persistence:
{{/* Data */}}
library:
enabled: true
type: {{ .Values.immichStorage.library.type }}
datasetName: {{ .Values.immichStorage.library.datasetName | default "" }}
hostPath: {{ .Values.immichStorage.library.hostPath | default "" }}
targetSelector:
server:
server:
mountPath: /usr/src/app/upload/library
microservices:
microservices:
mountPath: /usr/src/app/upload/library
uploads:
enabled: true
type: {{ .Values.immichStorage.uploads.type }}
datasetName: {{ .Values.immichStorage.uploads.datasetName | default "" }}
hostPath: {{ .Values.immichStorage.uploads.hostPath | default "" }}
targetSelector:
server:
server:
mountPath: /usr/src/app/upload/upload
microservices:
microservices:
mountPath: /usr/src/app/upload/upload
thumbs:
enabled: true
type: {{ .Values.immichStorage.thumbs.type }}
datasetName: {{ .Values.immichStorage.thumbs.datasetName | default "" }}
hostPath: {{ .Values.immichStorage.thumbs.hostPath | default "" }}
targetSelector:
server:
server:
mountPath: /usr/src/app/upload/thumbs
microservices:
microservices:
mountPath: /usr/src/app/upload/thumbs
profile:
enabled: true
type: {{ .Values.immichStorage.profile.type }}
datasetName: {{ .Values.immichStorage.profile.datasetName | default "" }}
hostPath: {{ .Values.immichStorage.profile.hostPath | default "" }}
targetSelector:
server:
server:
mountPath: /usr/src/app/upload/profile
microservices:
microservices:
mountPath: /usr/src/app/upload/profile
video:
enabled: true
type: {{ .Values.immichStorage.video.type }}
datasetName: {{ .Values.immichStorage.video.datasetName | default "" }}
hostPath: {{ .Values.immichStorage.video.hostPath | default "" }}
targetSelector:
server:
server:
mountPath: /usr/src/app/upload/encoded-video
microservices:
microservices:
mountPath: /usr/src/app/upload/encoded-video
{{/* Caches */}}
microcache:
enabled: true
type: emptyDir
targetSelector:
microservices:
microservices:
mountPath: /microcache
{{- if .Values.immichConfig.enableTypesense }}
typsense:
enabled: true
type: emptyDir
targetSelector:
typesense:
typesense:
mountPath: /typesense-data
{{- end -}}
{{- if .Values.immichConfig.enableML }}
mlcache:
enabled: true
type: emptyDir
targetSelector:
machinelearning:
machinelearning:
mountPath: /mlcache
{{- end }}
redis:
enabled: true
type: emptyDir
targetSelector:
redis:
redis:
mountPath: /bitnami/redis/data
tmp:
enabled: true
type: emptyDir
targetSelector:
redis:
redis:
mountPath: /tmp
{{/* Database */}}
postgresdata:
enabled: true
type: {{ .Values.immichStorage.pgData.type }}
datasetName: {{ .Values.immichStorage.pgData.datasetName | default "" }}
hostPath: {{ .Values.immichStorage.pgData.hostPath | default "" }}
targetSelector:
# Postgres pod
postgres:
# Postgres container
postgres:
mountPath: /var/lib/postgresql/data
# Postgres - Permissions container
# Different than the 01-permissions
permissions:
mountPath: /mnt/directories/postgres_data
postgresbackup:
enabled: true
type: {{ .Values.immichStorage.pgBackup.type }}
datasetName: {{ .Values.immichStorage.pgBackup.datasetName | default "" }}
hostPath: {{ .Values.immichStorage.pgBackup.hostPath | default "" }}
targetSelector:
# Postgres backup pod
postgresbackup:
# Postgres backup container
postgresbackup:
mountPath: /postgres_backup
# Postgres - Permissions container
# Different than the 01-permissions
permissions:
mountPath: /mnt/directories/postgres_backup
{{- end -}}

View File

@@ -0,0 +1,12 @@
{{- define "immich.portal" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: portal
data:
path: /
port: {{ .Values.immichNetwork.webuiPort | quote }}
protocol: http
host: $node_ip
{{- end -}}

View File

@@ -0,0 +1,7 @@
{{- define "postgres.workload" -}}
workload:
{{- include "ix.v1.common.app.postgres" (dict "secretName" "postgres-creds"
"resources" .Values.resources
"ixChartContext" .Values.ixChartContext) | nindent 2 }}
{{- end -}}

View File

@@ -0,0 +1,6 @@
{{- define "redis.workload" -}}
workload:
{{- include "ix.v1.common.app.redis" (dict "secretName" "redis-creds"
"resources" .Values.resources) | nindent 2 }}
{{- end -}}

View File

@@ -0,0 +1,105 @@
{{- define "immich.service" -}}
service:
proxy:
enabled: true
primary: true
type: NodePort
targetSelector: proxy
ports:
proxy:
enabled: true
primary: true
port: {{ .Values.immichNetwork.webuiPort }}
nodePort: {{ .Values.immichNetwork.webuiPort }}
protocol: http
targetPort: 8080
targetSelector: proxy
server:
enabled: true
type: ClusterIP
targetSelector: server
ports:
server:
enabled: true
primary: true
port: {{ .Values.immichNetwork.serverPort }}
protocol: http
targetSelector: server
web:
enabled: true
type: ClusterIP
targetSelector: web
ports:
web:
enabled: true
primary: true
port: {{ .Values.immichNetwork.webPort }}
protocol: http
targetSelector: web
microservices:
enabled: true
type: ClusterIP
targetSelector: microservices
ports:
microservices:
enabled: true
primary: true
port: {{ .Values.immichNetwork.microservicesPort }}
protocol: http
targetSelector: microservices
{{- if .Values.immichConfig.enableML }}
machinelearning:
enabled: true
type: ClusterIP
targetSelector: machinelearning
ports:
machinelearning:
enabled: true
primary: true
port: {{ .Values.immichNetwork.machinelearningPort }}
protocol: http
targetSelector: machinelearning
{{- end -}}
{{- if .Values.immichConfig.enableTypesense }}
typesense:
enabled: true
type: ClusterIP
targetSelector: typesense
ports:
typesense:
enabled: true
primary: true
port: {{ .Values.immichNetwork.typesensePort }}
protocol: http
targetSelector: typesense
{{- end }}
redis:
enabled: true
type: ClusterIP
targetSelector: redis
ports:
redis:
enabled: true
primary: true
port: 6379
targetPort: 6379
targetSelector: redis
postgres:
enabled: true
type: ClusterIP
targetSelector: postgres
ports:
postgres:
enabled: true
primary: true
port: 5432
targetPort: 5432
targetSelector: postgres
{{- end -}}

View File

@@ -0,0 +1,17 @@
{{- define "immich.wait.init" -}}
{{- $url := .url }}
wait-url:
enabled: true
type: init
imageSelector: bashImage
command:
- /bin/ash
- -c
- |
echo "Pinging [{{ $url }}] until it is ready..."
until wget --spider --quiet "{{ $url }}"; do
echo "Waiting for [{{ $url }}] to be ready..."
sleep 2
done
echo "URL [{{ $url }}] is ready!"
{{- end -}}

View File

@@ -0,0 +1,23 @@
{{- include "ix.v1.common.loader.init" . -}}
{{/* Merge the templates with Values */}}
{{- $_ := mustMergeOverwrite .Values (include "immich.configuration" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "immich.server.workload" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "immich.microservices.workload" $ | fromYaml) -}}
{{- if .Values.immichConfig.enableML -}}
{{- $_ := mustMergeOverwrite .Values (include "immich.machinelearning.workload" $ | fromYaml) -}}
{{- end -}}
{{- $_ := mustMergeOverwrite .Values (include "immich.web.workload" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "immich.proxy.workload" $ | fromYaml) -}}
{{- if .Values.immichConfig.enableTypesense -}}
{{- $_ := mustMergeOverwrite .Values (include "immich.typesense.workload" $ | fromYaml) -}}
{{- end -}}
{{- $_ := mustMergeOverwrite .Values (include "immich.persistence" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "immich.service" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "postgres.workload" $ | fromYaml) -}}
{{- $_ := mustMergeOverwrite .Values (include "redis.workload" $ | fromYaml) -}}
{{/* Create the configmap for portal manually*/}}
{{- include "immich.portal" $ -}}
{{- include "ix.v1.common.loader.apply" . -}}

View File

@@ -0,0 +1,4 @@
{
"filename": "values.yaml",
"keys": ["image", "webImage", "proxyImage", "mlImage", "typesenseImage"]
}

View File

@@ -0,0 +1,58 @@
#!/usr/bin/python3
import json
import re
import sys
from catalog_update.upgrade_strategy import semantic_versioning
RE_STABLE_VERSION_BASE = r'\d+\.\d+\.\d+'
ENUMS = {
'typesenseImage': {
'RE_STABLE_VERSION': re.compile(RE_STABLE_VERSION_BASE),
'STRIP_TEXT': ''
},
'default': {
'RE_STABLE_VERSION': re.compile(rf'v{RE_STABLE_VERSION_BASE}'),
'STRIP_TEXT': 'v'
}
}
def newer_mapping(image_tags):
output = {
"tags": {},
"app_version": ""
}
for key in image_tags.keys():
STRIP_TEXT = ENUMS[key].get('STRIP_TEXT', None) \
if key in ENUMS else ENUMS.get('default', None).get('STRIP_TEXT', None)
RE_STABLE_VERSION = ENUMS[key].get('RE_STABLE_VERSION') \
if key in ENUMS else ENUMS.get('default', None).get('RE_STABLE_VERSION', None)
if (STRIP_TEXT is None) or (RE_STABLE_VERSION is None):
continue
tags = {t.strip(STRIP_TEXT): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
version = semantic_versioning(list(tags))
if not version:
continue
if key == 'image':
output['app_version'] = version
output['tags'][key] = tags[version]
return output
if __name__ == '__main__':
try:
versions_json = json.loads(sys.stdin.read())
except ValueError:
raise ValueError('Invalid json specified')
print(json.dumps(newer_mapping(versions_json)))

View File

@@ -0,0 +1,70 @@
image:
repository: altran1502/immich-server
pullPolicy: IfNotPresent
tag: v1.66.1
webImage:
repository: altran1502/immich-web
pullPolicy: IfNotPresent
tag: v1.66.1
proxyImage:
repository: altran1502/immich-proxy
pullPolicy: IfNotPresent
tag: v1.66.1
mlImage:
repository: altran1502/immich-machine-learning
pullPolicy: IfNotPresent
tag: v1.66.1
typesenseImage:
repository: typesense/typesense
pullPolicy: IfNotPresent
tag: 0.24.1
resources:
limits:
cpu: 4000m
memory: 8Gi
immichConfig:
disableReverseGeocoding: false
reverseGeocodingPrecision: 3
publicLoginMessage: ''
enableML: true
enableTypesense: true
immichNetwork:
webuiPort: 30041
# Not user configurable, will be hidden on UI
# Putting it here in case it needs to be configurable
# in the future.
serverPort: 32000
webPort: 32001
machinelearningPort: 32002
microservicesPort: 32003
typesensePort: 32004
immichStorage:
uploads:
type: ixVolume
datasetName: uploads
library:
type: ixVolume
datasetName: library
thumbs:
type: ixVolume
datasetName: thumbs
profile:
type: ixVolume
datasetName: profile
video:
type: ixVolume
datasetName: video
pgData:
type: ixVolume
datasetName: pgData
pgBackup:
type: ixVolume
datasetName: pgBackup