Initial commit.
This commit is contained in:
7
immich/README.md
Normal file
7
immich/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Immich App
|
||||
|
||||
## To Do
|
||||
|
||||
- We need a full uninstall script.
|
||||
- We need full backup and restore scripts.
|
||||
- When recreating the app (uninstall/reinstall), db-init needs to re-run (currently the previous one blocks).
|
||||
68
immich/db-init-job.yaml
Normal file
68
immich/db-init-job.yaml
Normal file
@@ -0,0 +1,68 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: immich-db-init
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: db-init
|
||||
image: {{ .apps.postgres.image }}
|
||||
command: ["/bin/bash", "-c"]
|
||||
args:
|
||||
- |
|
||||
PGPASSWORD=${POSTGRES_ADMIN_PASSWORD} psql -h ${DB_HOSTNAME} -U postgres <<EOF
|
||||
DO \$\$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = '${DB_USERNAME}') THEN
|
||||
CREATE USER ${DB_USERNAME} WITH ENCRYPTED PASSWORD '${DB_PASSWORD}';
|
||||
ELSE
|
||||
ALTER USER ${DB_USERNAME} WITH ENCRYPTED PASSWORD '${DB_PASSWORD}';
|
||||
END IF;
|
||||
END
|
||||
\$\$;
|
||||
|
||||
SELECT 'CREATE DATABASE ${DB_DATABASE_NAME}' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '${DB_DATABASE_NAME}')\gexec
|
||||
ALTER DATABASE ${DB_DATABASE_NAME} OWNER TO ${DB_USERNAME};
|
||||
GRANT ALL PRIVILEGES ON DATABASE ${DB_DATABASE_NAME} TO ${DB_USERNAME};
|
||||
EOF
|
||||
|
||||
# Connect to the immich database and enable required extensions
|
||||
PGPASSWORD=${POSTGRES_ADMIN_PASSWORD} psql -h ${DB_HOSTNAME} -U postgres -d ${DB_DATABASE_NAME} <<EOF
|
||||
DO \$\$
|
||||
BEGIN
|
||||
-- Create vector extension if it doesn't exist
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'vector') THEN
|
||||
CREATE EXTENSION vector;
|
||||
END IF;
|
||||
|
||||
-- Create cube extension if it doesn't exist
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'cube') THEN
|
||||
CREATE EXTENSION cube;
|
||||
END IF;
|
||||
|
||||
-- Create earthdistance extension if it doesn't exist (depends on cube)
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'earthdistance') THEN
|
||||
CREATE EXTENSION earthdistance;
|
||||
END IF;
|
||||
END
|
||||
\$\$;
|
||||
EOF
|
||||
env:
|
||||
- name: POSTGRES_ADMIN_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: immich-secrets
|
||||
key: apps.postgres.password
|
||||
- name: DB_HOSTNAME
|
||||
value: "{{ .apps.immich.dbHostname }}"
|
||||
- name: DB_DATABASE_NAME
|
||||
value: "{{ .apps.immich.dbUsername }}"
|
||||
- name: DB_USERNAME
|
||||
value: "{{ .apps.immich.dbUsername }}"
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: immich-secrets
|
||||
key: apps.immich.dbPassword
|
||||
restartPolicy: OnFailure
|
||||
33
immich/deployment-machine-learning.yaml
Normal file
33
immich/deployment-machine-learning.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
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: "{{ .apps.immich.mlImage }}"
|
||||
name: immich-machine-learning
|
||||
ports:
|
||||
- containerPort: {{ .apps.immich.mlPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: TZ
|
||||
value: "{{ .apps.immich.timezone }}"
|
||||
volumeMounts:
|
||||
- mountPath: /cache
|
||||
name: immich-cache
|
||||
readOnly: false
|
||||
volumes:
|
||||
- name: immich-cache
|
||||
persistentVolumeClaim:
|
||||
claimName: immich-cache-pvc
|
||||
61
immich/deployment-microservices.yaml
Normal file
61
immich/deployment-microservices.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
---
|
||||
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: "{{ .apps.immich.serverImage }}"
|
||||
name: immich-microservices
|
||||
env:
|
||||
- name: REDIS_HOSTNAME
|
||||
value: "{{ .apps.immich.redisHostname }}"
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: immich-secrets
|
||||
key: apps.redis.password
|
||||
- name: DB_HOSTNAME
|
||||
value: "{{ .apps.immich.dbHostname }}"
|
||||
- name: DB_USERNAME
|
||||
value: "{{ .apps.immich.dbUsername }}"
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: immich-secrets
|
||||
key: apps.immich.dbPassword
|
||||
- name: TZ
|
||||
value: "{{ .apps.immich.timezone }}"
|
||||
- name: IMMICH_WORKERS_EXCLUDE
|
||||
value: api
|
||||
volumeMounts:
|
||||
- mountPath: /usr/src/app/upload
|
||||
name: immich-storage
|
||||
readOnly: false
|
||||
volumes:
|
||||
- name: immich-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: immich-pvc
|
||||
affinity:
|
||||
podAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchLabels:
|
||||
app: immich
|
||||
component: server
|
||||
topologyKey: kubernetes.io/hostname
|
||||
56
immich/deployment-server.yaml
Normal file
56
immich/deployment-server.yaml
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
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: "{{ .apps.immich.serverImage }}"
|
||||
name: immich-server
|
||||
ports:
|
||||
- containerPort: {{ .apps.immich.serverPort }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: REDIS_HOSTNAME
|
||||
value: "{{ .apps.immich.redisHostname }}"
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: immich-secrets
|
||||
key: apps.redis.password
|
||||
- name: DB_HOSTNAME
|
||||
value: "{{ .apps.immich.dbHostname }}"
|
||||
- name: DB_USERNAME
|
||||
value: "{{ .apps.immich.dbUsername }}"
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: immich-secrets
|
||||
key: apps.immich.dbPassword
|
||||
- name: TZ
|
||||
value: "{{ .apps.immich.timezone }}"
|
||||
- name: IMMICH_WORKERS_EXCLUDE
|
||||
value: microservices
|
||||
volumeMounts:
|
||||
- mountPath: /usr/src/app/upload
|
||||
name: immich-storage
|
||||
readOnly: false
|
||||
volumes:
|
||||
- name: immich-storage
|
||||
persistentVolumeClaim:
|
||||
claimName: immich-pvc
|
||||
24
immich/ingress.yaml
Normal file
24
immich/ingress.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: immich-public
|
||||
annotations:
|
||||
external-dns.alpha.kubernetes.io/target: "{{ .cloud.domain }}"
|
||||
external-dns.alpha.kubernetes.io/cloudflare-proxied: "false"
|
||||
spec:
|
||||
rules:
|
||||
- host: "{{ .apps.immich.domain }}"
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: immich-server
|
||||
port:
|
||||
number: 3001
|
||||
tls:
|
||||
- secretName: wildcard-wild-cloud-tls
|
||||
hosts:
|
||||
- "{{ .apps.immich.domain }}"
|
||||
18
immich/kustomization.yaml
Normal file
18
immich/kustomization.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namespace: immich
|
||||
labels:
|
||||
- includeSelectors: true
|
||||
pairs:
|
||||
app: immich
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
||||
resources:
|
||||
- deployment-server.yaml
|
||||
- deployment-machine-learning.yaml
|
||||
- deployment-microservices.yaml
|
||||
- ingress.yaml
|
||||
- namespace.yaml
|
||||
- pvc.yaml
|
||||
- service.yaml
|
||||
- db-init-job.yaml
|
||||
25
immich/manifest.yaml
Normal file
25
immich/manifest.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
name: immich
|
||||
install: true
|
||||
description: Immich is a self-hosted photo and video backup solution that allows you to store, manage, and share your media files securely.
|
||||
version: 1.0.0
|
||||
icon: https://immich.app/assets/images/logo.png
|
||||
requires:
|
||||
- name: redis
|
||||
- name: postgres
|
||||
defaultConfig:
|
||||
serverImage: ghcr.io/immich-app/immich-server:release
|
||||
mlImage: ghcr.io/immich-app/immich-machine-learning:release
|
||||
timezone: UTC
|
||||
serverPort: 2283
|
||||
mlPort: 3003
|
||||
storage: 250Gi
|
||||
cacheStorage: 10Gi
|
||||
redisHostname: redis.redis.svc.cluster.local
|
||||
dbHostname: postgres.postgres.svc.cluster.local
|
||||
dbUsername: immich
|
||||
domain: immich.{{ .cloud.domain }}
|
||||
tlsSecretName: wildcard-wild-cloud-tls
|
||||
requiredSecrets:
|
||||
- apps.immich.dbPassword
|
||||
- apps.postgres.password
|
||||
- apps.redis.password
|
||||
4
immich/namespace.yaml
Normal file
4
immich/namespace.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: immich
|
||||
24
immich/pvc.yaml
Normal file
24
immich/pvc.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: immich-pvc
|
||||
spec:
|
||||
storageClassName: longhorn
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .apps.immich.storage }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: immich-cache-pvc
|
||||
spec:
|
||||
storageClassName: longhorn
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .apps.immich.cacheStorage }}
|
||||
33
immich/service.yaml
Normal file
33
immich/service.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: immich-server
|
||||
namespace: immich
|
||||
labels:
|
||||
app: immich-server
|
||||
spec:
|
||||
ports:
|
||||
- port: 3001
|
||||
targetPort: {{ .apps.immich.serverPort }}
|
||||
selector:
|
||||
app: immich
|
||||
component: server
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: immich-machine-learning
|
||||
namespace: immich
|
||||
labels:
|
||||
app: immich-machine-learning
|
||||
spec:
|
||||
ports:
|
||||
- port: {{ .apps.immich.mlPort }}
|
||||
selector:
|
||||
app: immich
|
||||
component: machine-learning
|
||||
managedBy: kustomize
|
||||
partOf: wild-cloud
|
||||
Reference in New Issue
Block a user