apiVersion: apps/v1
kind: Deployment
metadata:
  name: immich-database
  namespace: photoprism
spec:
  replicas: 1
  selector:
    matchLabels:
      app: immich-database
  template:
    metadata:
      labels:
        app: immich-database
    spec:
      containers:
        - name: immich-postgres
          image: "docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0"
          imagePullPolicy: Always
          ports:
            - containerPort: 5432
          env:
            - name: POSTGRES_USER
              valueFrom:
                configMapKeyRef:
                  name: immich-env
                  key: DB_USERNAME
            - name: POSTGRES_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: immich-env
                  key: DB_PASSWORD
            - name: POSTGRES_DB
              valueFrom:
                configMapKeyRef:
                  name: immich-env
                  key: DB_DATABASE_NAME
          volumeMounts:
            - name: pgdata
              mountPath: /var/lib/postgresql/data
              subPath: postgres
          resources:
            requests:
              cpu: "250m"
              memory: "512Mi"
            limits:
              cpu: "1000m"
              memory: "1Gi"
          securityContext:
            runAsUser: 1001
            runAsGroup: 1000
#            fsGroup: 2000
      volumes:
        - name: pgdata
          persistentVolumeClaim:
            claimName: immich-db-pvc
