# yaml-language-server: $schema=https://schema.zeabur.app/template.json
apiVersion: zeabur.com/v1
kind: Template
metadata:
    name: Immich
spec:
    description: High performance self-hosted photo and video management solution.
    coverImage: https://immich.app/img/immich-screenshots.webp
    icon: https://avatars.githubusercontent.com/u/109746326?s=200&v=4
    tags:
        - Photo Management
        - AI
    readme: |
        # Immich

        High performance self-hosted photo and video management solution.

        ## Services

        - **immich-server** — Core server (web UI on port 2283)
        - **immich-machine-learning** — AI features (facial recognition, smart search, object detection)
        - **redis** — Valkey-based cache
        - **database** — PostgreSQL 14 with VectorChord extension

        ## Getting Started

        After deployment, access the web UI and register the first user — this becomes the admin account.
        Install the Immich mobile app and point it at your server to start backing up photos.
    services:
        - name: redis
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/redis.svg
          template: PREBUILT
          spec:
            id: redis
            source:
                image: docker.io/valkey/valkey:9@sha256:3eeb09785cd61ec8e3be35f8804c8892080f3ca21934d628abc24ee4ed1698f6
            ports:
                - id: database
                  port: 6379
                  type: TCP
            volumes:
                - id: data
                  dir: /data
            env:
                REDIS_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                REDIS_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
        - name: database
          icon: https://raw.githubusercontent.com/zeabur/service-icons/main/marketplace/postgresql.svg
          template: PREBUILT
          spec:
            id: database
            source:
                image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:bcf63357191b76a916ae5eb93464d65c07511da41e3bf7a8416db519b40b1c23
            ports:
                - id: database
                  port: 5432
                  type: TCP
            volumes:
                - id: data
                  dir: /var/lib/postgresql/data
            instructions:
                - title: Connection String
                  content: postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}
                - title: PostgreSQL Connect Command
                  content: psql "postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${PORT_FORWARDED_HOSTNAME}:${DATABASE_PORT_FORWARDED_PORT}/${POSTGRES_DATABASE}"
                - title: PostgreSQL username
                  content: ${POSTGRES_USERNAME}
                - title: PostgreSQL password
                  content: ${POSTGRES_PASSWORD}
                - title: PostgreSQL database
                  content: ${POSTGRES_DATABASE}
                - title: PostgreSQL host
                  content: ${PORT_FORWARDED_HOSTNAME}
                - title: PostgreSQL port
                  content: ${DATABASE_PORT_FORWARDED_PORT}
            env:
                POSTGRES_DATABASE:
                    default: ${POSTGRES_DB}
                    expose: true
                POSTGRES_DB:
                    default: immich
                POSTGRES_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                POSTGRES_INITDB_ARGS:
                    default: --data-checksums
                POSTGRES_PASSWORD:
                    default: ${PASSWORD}
                    expose: true
                POSTGRES_PORT:
                    default: ${DATABASE_PORT}
                    expose: true
                POSTGRES_USER:
                    default: postgres
                POSTGRES_USERNAME:
                    default: ${POSTGRES_USER}
                    expose: true
        - name: immich-machine-learning
          icon: https://avatars.githubusercontent.com/u/109746326?s=200&v=4
          template: PREBUILT
          spec:
            id: immich-machine-learning
            source:
                image: ghcr.io/immich-app/immich-machine-learning:release
            ports:
                - id: web
                  port: 3003
                  type: TCP
            volumes:
                - id: model-cache
                  dir: /cache
            env:
                MACHINE_LEARNING_HOST:
                    default: ${CONTAINER_HOSTNAME}
                    expose: true
                MACHINE_LEARNING_PORT:
                    default: "3003"
                    expose: true
        - name: immich-server
          icon: https://avatars.githubusercontent.com/u/109746326?s=200&v=4
          template: PREBUILT
          spec:
            id: immich-server
            source:
                image: ghcr.io/immich-app/immich-server:release
            ports:
                - id: web
                  port: 2283
                  type: HTTP
            volumes:
                - id: upload
                  dir: /data
            env:
                DB_DATABASE_NAME:
                    default: ${POSTGRES_DATABASE}
                DB_HOSTNAME:
                    default: ${POSTGRES_HOST}
                DB_PASSWORD:
                    default: ${POSTGRES_PASSWORD}
                DB_PORT:
                    default: "5432"
                DB_USERNAME:
                    default: ${POSTGRES_USERNAME}
                IMMICH_MACHINE_LEARNING_URL:
                    default: http://${MACHINE_LEARNING_HOST}:${MACHINE_LEARNING_PORT}
                REDIS_HOSTNAME:
                    default: ${REDIS_HOST}
                REDIS_PORT:
                    default: "6379"
