diff --git a/cluster/apps/immich/immich-db.yml b/cluster/apps/immich/immich-db.yml new file mode 100644 index 0000000..5e929e6 --- /dev/null +++ b/cluster/apps/immich/immich-db.yml @@ -0,0 +1,61 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: immich-db + namespace: default +spec: + selector: + matchLabels: + app: immich-db + template: + metadata: + labels: + app: immich-db + spec: + containers: + - name: redis + image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:84882e87b54734154586e5f8abd4dce69fe7311315e2fc6d67c29614c8de2672 + env: + - name: REDIS_HOSTNAME + value: "immich-redis" + ports: + - containerPort: 6379 + - name: immich-psql + image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0 + ports: + - containerPort: 5432 + env: + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: immich-postgres-secret + key: password + - name: POSTGRES_USER + value: "postgres" + - name: POSTGRES_DB + value: "immich" + - name: POSTGRES_INITDB_ARGS + value: "--data-checksums" + volumeMounts: + - mountPath: /var/lib/postgresql/data + name: immich + args: + - "postgres" + - "-c" + - "shared_preload_libraries=vectors.so" + - "-c" + - "search_path=\"$$user\", public, vectors" + - "-c" + - "logging_collector=on" + - "-c" + - "max_wal_size=2GB" + - "-c" + - "shared_buffers=512MB" + - "-c" + - "wal_compression=on" + volumes: + - name: immich + nfs: + server: 10.0.0.10 + path: /home/akshun/immich-data diff --git a/cluster/apps/immich/immich-pvc.yml b/cluster/apps/immich/immich-pvc.yml new file mode 100644 index 0000000..daf1e43 --- /dev/null +++ b/cluster/apps/immich/immich-pvc.yml @@ -0,0 +1,13 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: longhorn-immich-cache + namespace: default +spec: + accessModes: + - ReadWriteOnce + storageClassName: longhorn + resources: + requests: + storage: 10Gi diff --git a/cluster/apps/immich/immich-svc.yml b/cluster/apps/immich/immich-svc.yml new file mode 100644 index 0000000..c04024d --- /dev/null +++ b/cluster/apps/immich/immich-svc.yml @@ -0,0 +1,59 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: immich-service + namespace: default +spec: + type: NodePort + selector: + app: immich-app + ports: + - port: 2283 + targetPort: 2283 + nodePort: 2283 + protocol: TCP + +--- +apiVersion: v1 +kind: Service +metadata: + name: immich-machine-learning-service + namespace: default +spec: + type: NodePort + selector: + app: immich-app + ports: + - port: 3003 + targetPort: 3003 + nodePort: 3333 + protocol: TCP + +--- +apiVersion: v1 +kind: Service +metadata: + name: immich-psql-service + namespace: default +spec: + selector: + app: immich-db + ports: + - protocol: TCP + port: 5432 + targetPort: 5432 + +--- +apiVersion: v1 +kind: Service +metadata: + name: immich-redis-service + namespace: default +spec: + selector: + app: immich-db + ports: + - protocol: TCP + port: 6379 + targetPort: 6379 diff --git a/cluster/apps/immich/immich.yml b/cluster/apps/immich/immich.yml new file mode 100644 index 0000000..8afe293 --- /dev/null +++ b/cluster/apps/immich/immich.yml @@ -0,0 +1,79 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: immich-app + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app: immich-app + template: + metadata: + labels: + app: immich-app + spec: + initContainers: + - name: wait-for-redis + image: busybox + command: + - sh + - -c + - | + until nc -z -v -w30 immich-redis-service 6379; do + echo "Waiting for redis database to be ready..." + sleep 2 + done + - name: wait-for-psql + image: busybox + command: + - sh + - -c + - | + until nc -z -v -w30 immich-psql-service 5432; do + echo "Waiting for psql database to be ready" + sleep 2 + done + containers: + - name: immich-server + image: ghcr.io/immich-app/immich-server:v1.131.3 + ports: + - containerPort: 2283 + env: + - name: TZ + value: "Asia/Kolkata" + - name: REDIS_HOSTNAME + value: "immich-redis-service" + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: immich-postgres-secret + key: password + - name: DB_USERNAME + value: "postgres" + - name: DB_DATABASE_NAME + value: "immich" + - name: DB_HOSTNAME + value: "immich-psql-service" + volumeMounts: + - mountPath: /usr/src/app/upload + name: pictures + - name: immich-machine-learning + image: ghcr.io/immich-app/immich-machine-learning:v1.131.2 + ports: + - containerPort: 3003 + env: + - name: REDIS_HOSTNAME + value: "immich-redis-service" + volumeMounts: + - mountPath: /cache + name: model-cache + volumes: + - name: pictures + nfs: + server: 10.0.0.123 + path: /pictures + - name: model-cache + persistentVolumeClaim: + claimName: longhorn-immich-cache