immich refactor

This commit is contained in:
Ariel Sosnovsky committed 2023-11-22 13:15:55 -05:00
1 parent 7d77a56d8d
commit b591bdc4fd
16 files changed
+458 -337

No files matched your search

+17 -2
View File
@@ -6,15 +6,30 @@ deployment=${2:-dev}
app=$(basename $full_path)
location=$(dirname $full_path)
tmp_path=".tmp/$location/$deployment-$app.yaml"
chart_checksum_path=".tmp/.checksums/$location/$deployment-$app.chart.yaml.checksum"
echo "Running for $app:$deployment"
mkdir -p $(dirname $tmp_path)
echo " > updating dependencies..."
previous_checksum=""
if [ -f "$chart_checksum_path" ]; then
previous_checksum=$(cat $chart_checksum_path)
else
mkdir -p $(dirname $chart_checksum_path)
fi
pushd $full_path &> /dev/null
helm dependency update
chart_checksum=$(sha256sum Chart.yaml | cut -d ' ' -f 1)
echo " > Current Chart.yaml checksum: $chart_checksum"
echo " > Previous Chart.yaml checksum: $previous_checksum"
if [ "$chart_checksum" == "$previous_checksum" ]; then
echo " > skipping helm update!"
else
echo " > updating dependencies..."
helm dependency update
fi
popd &> /dev/null
echo $chart_checksum > $chart_checksum_path
if [ -f "$tmp_path" ]; then
echo " > found existing file"
+1
View File
@@ -6,6 +6,7 @@ userGeneration:
- radarr
- sonarr
- prowlarr
- immich
users_dbs:
radarr: [log]
sonarr: [log]
-3
View File
@@ -5,9 +5,6 @@ type: application
version: 0.1.0
appVersion: "edge"
dependencies:
- name: common
repository: https://bjw-s.github.io/helm-charts
version: 1.4.0
- name: redis
condition: redis.enabled
repository: https://charts.bitnami.com/bitnami
@@ -0,0 +1,103 @@
{{ define "homelab.immich.deployment" }}
---
apiVersion: v1
kind: Service
metadata:
name: immich-{{ .name }}
spec:
type: ClusterIP
ports:
- port: {{ .port }}
targetPort: http
protocol: TCP
name: http
selector:
homelab/name: immich
app.kubernetes.io/name: {{ .name }}
app.kubernetes.io/instance: photos
{{- range $key, $val := .persistence }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: immich-{{ .name }}-{{ $key }}
spec:
storageClassName: {{ $.global.nfs.storageClass }}
accessModes:
{{- $val.accessModes | toYaml | nindent 4 }}
resources:
{{- $val.resources | toYaml | nindent 4 }}
{{ end -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: immich-{{ .name }}
spec:
revisionHistoryLimit: 2
replicas: "{{ .replicas }}"
updateStrategy:
rollingUpdate:
partition: "25%"
type: RollingUpdate
strategy:
type: Recreate
selector:
matchLabels:
homelab/name: immich
app.kubernetes.io/name: {{ .name }}
app.kubernetes.io/instance: photos
template:
metadata:
labels:
homelab/name: immich
app.kubernetes.io/name: {{ .name }}
app.kubernetes.io/instance: photos
spec:
containers:
- name: {{ .name }}
image: "{{.image}}:{{ .version }}"
imagePullPolicy: IfNotPresent
envFrom:
- configMapRef:
name: immich-shared-envs
- secretRef:
name: immich-shared-envs
{{ if .env }}
env:
{{ .env | toYaml | nindent 24 }}
{{ end }}
ports:
- name: http
containerPort: "{{ .port }}"
protocol: TCP
volumeMounts:
- name: library
mountPath: "{{ .libraryMountPath }}"
{{- range $key, $val := .persistence }}
- name: {{ $key }}
mountPath: {{ $val.mountPath }}
{{ end }}
{{ if .livenessProbe }}
livenessProbe:
{{ .livenessProbe | toYaml | nindent 24 }}
{{ end }}
{{ if .readinessProbe }}
readinessProbe:
{{ .readinessProbe | toYaml | nindent 24 }}
{{ end }}
{{ if .startupProbe }}
startupProbe:
{{ .startupProbe | toYaml | nindent 24 }}
{{ end }}
volumes:
- name: library
{{- .libraryPVC | toYaml | nindent 20 }}
{{- range $key, $val := .persistence }}
- name: {{ $key }}
persistentVolumeClaim:
claimName: immich-{{ .name }}-{{ $key }}
{{ end }}
{{ end }}
@@ -0,0 +1,26 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: immich-shared-envs
data:
# general
TZ: {{ $.Values.global.timezone }}
LOG_LEVEL: log
PUBLIC_LOGIN_PAGE_MESSAGE: Sosnovsky
IMMICH_MEDIA_LOCATION: /shared/media/
# ports
PORT: "{{ $.Values.immich.apps.web.port }}"
SERVER_PORT: "{{ $.Values.immich.apps.server.port }}"
MICROSERVICES_PORT: "{{ $.Values.immich.apps.microservices.port }}"
MACHINE_LEARNING_PORT: "{{ $.Values.immich.apps.machineLearning.port }}"
MACHINE_LEARNING_HOST: immich-ml.{{ $.Release.Namespace }}.svc.cluster.local
IMMICH_MACHINE_LEARNING_URL: "http://immich-ml.{{ $.Release.Namespace }}.svc.cluster.local:{{ $.Values.immich.apps.machineLearning.port }}"
IMMICH_SERVER_URL: "http://immich-server.{{ $.Release.Namespace }}.svc.cluster.local:{{ $.Values.immich.apps.server.port }}"
IMMICH_WEB_URL: "http://immich-web.{{ $.Release.Namespace }}.svc.cluster.local:{{ $.Values.immich.apps.web.port }}"
# db & redis
REDIS_HOSTNAME: "immich-redis.{{ $.Release.Namespace }}.svc.cluster.local"
# typesense
TYPESENSE_ENABLED: "true"
TYPESENSE_HOST: "immich-typesense.{{ $.Release.Namespace }}.svc.cluster.local"
TYPESENSE_PORT: "{{ $.Values.immich.apps.typesense.port }}"
@@ -0,0 +1,8 @@
{{ $shared := .Values.immich.shared }}
{{- range $key, $val := .Values.immich.apps }}
{{- $settings := deepCopy $.Values.immich.shared | merge $val -}}
{{ $_ := set $settings "name" $key }}
{{ $_ := set $settings "global" $.Values.global }}
{{ include "homelab.immich.deployment" $settings }}
{{ end -}}
@@ -0,0 +1,32 @@
---
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "immich-db"
spec:
refreshInterval: 1h
secretStoreRef:
kind: ClusterSecretStore
name: chart-database
target:
name: "password.pg.immich"
data:
- secretKey: "DB_USERNAME"
remoteRef:
key: "password.pg.immich"
property: username
- secretKey: "DB_PASSWORD"
remoteRef:
key: "password.pg.immich"
property: password
- secretKey: "DB_HOSTNAME"
remoteRef:
key: "password.pg.immich"
property: host
- secretKey: "DB_PORT"
remoteRef:
key: "password.pg.immich"
property: host
@@ -0,0 +1,10 @@
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: immich-shared-envs
annotations:
secret-generator.v1.mittwald.de/autogenerate: TYPESENSE_API_KEY
stringData:
DB_DATABASE_NAME: immich
@@ -1,46 +0,0 @@
{{- define "immich.machine-learning.hardcodedValues" -}}
global:
nameOverride: machine-learning
service:
main:
enabled: true
primary: true
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 3003
protocol: HTTP
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /ping
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
startup:
enabled: false
persistence:
library:
enabled: true
mountPath: /usr/src/app/upload
existingClaim: {{ .Values.immich.persistence.library.existingClaim }}
{{- end }}
{{- /* Have to reference with index here because the dash breaks a normal dereference */}}
{{ if (index .Values "machine-learning").enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "machine-learning" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "immich.machine-learning.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}
@@ -1,25 +0,0 @@
{{- define "immich.microservices.hardcodedValues" -}}
global:
nameOverride: microservices
command: "/bin/sh"
args:
- "./start-microservices.sh"
service:
main:
enabled: false
persistence:
library:
enabled: true
mountPath: /usr/src/app/upload
existingClaim: {{ .Values.immich.persistence.library.existingClaim }}
{{- end }}
{{ if .Values.microservices.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "microservices" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "immich.microservices.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}
-23
View File
@@ -1,23 +0,0 @@
{{- define "immich.proxy.hardcodedValues" -}}
global:
nameOverride: proxy
service:
main:
enabled: true
primary: true
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 8080
protocol: HTTP
{{- end }}
{{ if .Values.proxy.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "proxy" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "immich.proxy.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}
-49
View File
@@ -1,49 +0,0 @@
{{- define "immich.server.hardcodedValues" -}}
global:
nameOverride: server
command: "/bin/sh"
args:
- "./start-server.sh"
service:
main:
enabled: true
primary: true
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 3001
protocol: HTTP
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /server-info/ping
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
startup:
enabled: false
persistence:
library:
enabled: true
mountPath: /usr/src/app/upload
existingClaim: {{ .Values.immich.persistence.library.existingClaim }}
{{- end }}
{{ if .Values.server.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "server" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "immich.server.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}
-39
View File
@@ -1,39 +0,0 @@
{{- define "immich.typesense.hardcodedValues" -}}
global:
nameOverride: typesense
service:
main:
enabled: true
primary: true
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 8108
protocol: HTTP
probes:
liveness: &probes
enabled: true
custom: true
spec:
httpGet:
path: /health
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
readiness: *probes
startup:
enabled: false
{{- end }}
{{ if .Values.typesense.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "typesense" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "immich.typesense.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}
-27
View File
@@ -1,27 +0,0 @@
{{- define "immich.web.hardcodedValues" -}}
global:
nameOverride: web
service:
main:
enabled: true
primary: true
type: ClusterIP
ports:
http:
enabled: true
primary: true
port: 3000
protocol: HTTP
command: "/bin/sh"
args:
- "./entrypoint.sh"
{{- end }}
{{ if .Values.web.enabled }}
{{- $ctx := deepCopy . -}}
{{- $_ := get .Values "web" | mergeOverwrite $ctx.Values -}}
{{- $_ = include "immich.web.hardcodedValues" . | fromYaml | merge $ctx.Values -}}
{{- include "bjw-s.common.loader.all" $ctx }}
{{ end }}
+255 -112
View File
@@ -1,44 +1,137 @@
## This chart relies on the common library chart from bjw-s
## You can find it at https://github.com/bjw-s/helm-charts/tree/main/charts/library/common
## Refer there for more detail about the supported values
# These entries are shared between all the Immich components
env:
REDIS_HOSTNAME: '{{ printf "%s-redis-master" .Release.Name }}'
DB_HOSTNAME: "{{ .Release.Name }}-postgresql"
DB_USERNAME: "{{ .Values.postgresql.global.postgresql.auth.username }}"
DB_DATABASE_NAME: "{{ .Values.postgresql.global.postgresql.auth.database }}"
# -- You should provide your own secret outside of this helm-chart and use `postgresql.global.postgresql.auth.existingSecret` to provide credentials to the postgresql instance
DB_PASSWORD: "{{ .Values.postgresql.global.postgresql.auth.password }}"
TYPESENSE_ENABLED: "{{ .Values.typesense.enabled }}"
TYPESENSE_API_KEY: "{{ .Values.typesense.env.TYPESENSE_API_KEY }}"
TYPESENSE_HOST: '{{ printf "%s-typesense" .Release.Name }}'
IMMICH_WEB_URL: '{{ printf "http://%s-web:3000" .Release.Name }}'
IMMICH_SERVER_URL: '{{ printf "http://%s-server:3001" .Release.Name }}'
IMMICH_MACHINE_LEARNING_URL: '{{ printf "http://%s-machine-learning:3003" .Release.Name }}'
image:
tag: v1.79.1
global:
timezone: changeme
nfs:
storageClass: changeme
immich:
persistence:
# Main data store for all photos shared between different components.
library:
# Automatically creating the library volume is not supported by this chart
# You have to specify an existing PVC to use
existingClaim:
# Dependencies
postgresql:
enabled: false
global:
postgresql:
auth:
username: immich
database: immich
password: immich
shared:
version: v1.79.1
libraryPVC:
nfs:
path: changeme
server: changeme
apps:
web:
replicas: 1
port: 80
image: ghcr.io/immich-app/immich-web
livenessProbePath: "/web-info/ping"
readinessProbePath: "/web-info/ping"
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: 3000
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 0
periodSeconds: 10
tcpSocket:
port: 3000
timeoutSeconds: 1
startupProbe:
failureThreshold: 30
initialDelaySeconds: 0
periodSeconds: 5
tcpSocket:
port: 3000
timeoutSeconds: 1
server:
replicas: 1
port: 80
image: ghcr.io/immich-app/immich-server
livenessProbePath: "/server-info/ping"
readinessProbePath: "/server-info/ping"
livenessProbe:
failureThreshold: 3
httpGet:
path: /server-info/ping
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /server-info/ping
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
microservices:
replicas: 1
port: 80
livenessProbePath: ""
readinessProbePath: ""
machineLearning:
replicas: 1
port: 80
image: ghcr.io/immich-app/immich-machine-learning
env:
- name: TRANSFORMERS_CACHE
value: /cache
persistence:
cache:
mountPath: /cache
accessModes:
- ReadWriteMany
resources:
limits:
storage: 5Gi
requests:
storage: 5Gi
livenessProbe:
failureThreshold: 3
httpGet:
path: /ping
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /ping
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
typesense:
port: 8108
image: docker.io/typesense/typesense
version: 0.24.0
env:
- name: TYPESENSE_DATA_DIR
value: /tsdata
persistence:
tsdata:
mountPath: /tsdata
accessModes:
- ReadWriteMany
resources:
limits:
storage: 5Gi
requests:
storage: 5Gi
livenessProbe:
failureThreshold: 3
httpGet:
path: /health
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /health
port: http
initialDelaySeconds: 0
periodSeconds: 10
timeoutSeconds: 1
redis:
enabled: false
@@ -46,85 +139,135 @@ redis:
auth:
enabled: false
typesense:
enabled: true
env:
TYPESENSE_DATA_DIR: /tsdata
TYPESENSE_API_KEY: typesense
persistence:
tsdata:
enabled: true
accessMode: ReadWriteOnce
size: 1Gi
# storageClass: storage-class
image:
repository: docker.io/typesense/typesense
tag: 0.24.0
pullPolicy: IfNotPresent
# Immich components
server:
enabled: true
image:
repository: ghcr.io/immich-app/immich-server
pullPolicy: IfNotPresent
microservices:
enabled: true
env:
REVERSE_GEOCODING_DUMP_DIRECTORY: /geodata-cache
persistence:
geodata-cache:
enabled: true
size: 1Gi
accessMode: ReadWriteMany
# storageClass: your-class
image:
repository: ghcr.io/immich-app/immich-server
pullPolicy: IfNotPresent
# ## This chart relies on the common library chart from bjw-s
# ## You can find it at https://github.com/bjw-s/helm-charts/tree/main/charts/library/common
# ## Refer there for more detail about the supported values
machine-learning:
enabled: true
image:
repository: ghcr.io/immich-app/immich-machine-learning
pullPolicy: IfNotPresent
env:
TRANSFORMERS_CACHE: /cache
persistence:
cache:
enabled: true
size: 10Gi
accessMode: ReadWriteMany
# storageClass: your-class
# # These entries are shared between all the Immich components
web:
enabled: true
image:
repository: ghcr.io/immich-app/immich-web
pullPolicy: IfNotPresent
persistence:
library:
enabled: false
# env:
# REDIS_HOSTNAME: '{{ printf "%s-redis-master" .Release.Name }}'
# DB_HOSTNAME: "{{ .Release.Name }}-postgresql"
# DB_USERNAME: "{{ .Values.postgresql.global.postgresql.auth.username }}"
# DB_DATABASE_NAME: "{{ .Values.postgresql.global.postgresql.auth.database }}"
# # -- You should provide your own secret outside of this helm-chart and use `postgresql.global.postgresql.auth.existingSecret` to provide credentials to the postgresql instance
# DB_PASSWORD: "{{ .Values.postgresql.global.postgresql.auth.password }}"
# TYPESENSE_ENABLED: "{{ .Values.typesense.enabled }}"
# TYPESENSE_API_KEY: "{{ .Values.typesense.env.TYPESENSE_API_KEY }}"
# TYPESENSE_HOST: '{{ printf "%s-typesense" .Release.Name }}'
# IMMICH_WEB_URL: '{{ printf "http://%s-web:3000" .Release.Name }}'
# IMMICH_SERVER_URL: '{{ printf "http://%s-server:3001" .Release.Name }}'
# IMMICH_MACHINE_LEARNING_URL: '{{ printf "http://%s-machine-learning:3003" .Release.Name }}'
proxy:
enabled: false
image:
repository: ghcr.io/immich-app/immich-proxy
pullPolicy: IfNotPresent
# image:
# tag: v1.79.1
persistence:
library:
enabled: false
# immich:
# persistence:
# # Main data store for all photos shared between different components.
# library:
# # Automatically creating the library volume is not supported by this chart
# # You have to specify an existing PVC to use
# existingClaim:
ingress:
main:
enabled: false
annotations:
# proxy-body-size is set to 0 to remove the body limit on file uploads
nginx.ingress.kubernetes.io/proxy-body-size: "0"
hosts:
- host: immich.local
paths:
- path: "/"
tls: []
# # Dependencies
# postgresql:
# enabled: false
# global:
# postgresql:
# auth:
# username: immich
# database: immich
# password: immich
# typesense:
# enabled: true
# env:
# TYPESENSE_DATA_DIR: /tsdata
# TYPESENSE_API_KEY: typesense
# persistence:
# tsdata:
# enabled: true
# accessMode: ReadWriteOnce
# size: 1Gi
# # storageClass: storage-class
# image:
# repository: docker.io/typesense/typesense
# tag: 0.24.0
# pullPolicy: IfNotPresent
# # Immich components
# server:
# enabled: true
# image:
# repository: ghcr.io/immich-app/immich-server
# pullPolicy: IfNotPresent
# microservices:
# enabled: true
# env:
# REVERSE_GEOCODING_DUMP_DIRECTORY: /geodata-cache
# persistence:
# geodata-cache:
# enabled: true
# size: 1Gi
# accessMode: ReadWriteMany
# # storageClass: your-class
# image:
# repository: ghcr.io/immich-app/immich-server
# pullPolicy: IfNotPresent
# machine-learning:
# enabled: true
# image:
# repository: ghcr.io/immich-app/immich-machine-learning
# pullPolicy: IfNotPresent
# env:
# TRANSFORMERS_CACHE: /cache
# persistence:
# cache:
# enabled: true
# size: 10Gi
# accessMode: ReadWriteMany
# # storageClass: your-class
# web:
# enabled: true
# image:
# repository: ghcr.io/immich-app/immich-web
# pullPolicy: IfNotPresent
# persistence:
# library:
# enabled: true
# size: 10Gi
# accessMode: ReadWriteMany
# proxy:
# enabled: true
# image:
# repository: ghcr.io/immich-app/immich-proxy
# pullPolicy: IfNotPresent
# persistence:
# library:
# enabled: true
# size: 10Gi
# accessMode: ReadWriteMany
# ingress:
# main:
# enabled: false
# annotations:
# # proxy-body-size is set to 0 to remove the body limit on file uploads
# nginx.ingress.kubernetes.io/proxy-body-size: "0"
# hosts:
# - host: immich.local
# paths:
# - path: "/"
# tls: []
+6 -11
View File
@@ -42,17 +42,12 @@ videohosting:
apps:
photos:
values: |-
typesense:
persistence:
storageClass: {{ .Values.global.nfs.storageClass }}
microservices:
persistence:
geodata-cache:
storageClass: {{ .Values.global.nfs.storageClass }}
machine-learning:
persistence:
cache:
storageClass: {{ .Values.global.nfs.storageClass }}
immich:
shared:
mediaPVC:
nfs:
path: {{ .Values.global.nfs.additionalShares.familyphotos }}
server: {{ .Values.global.nfs.server }}
videohosting:
values: |-
{{ .Values.videohosting | toYaml }}