name: immich
networks:
  1panel-network:
    external: true
services:
  immich-machine-learning:
    container_name: immich-machine-learning-immich
    devices: &id001
    - /dev/dri:/dev/dri
    env_file:
    - ./envs/global.env
    - .env
    image: ghcr.io/immich-app/immich-machine-learning:v1.129.0
    labels:
      createdBy: Apps
    networks:
    - 1panel-network
    ports:
    - ${PANEL_APP_PORT_MACHINE_LEARNING}:3003
    restart: always
    volumes:
    - ${IMMICH_ROOT_PATH}/data/cache:/cache
  immich-pg14-vectors:
    command:
    - 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
    container_name: pg14-vectors-immich
    environment:
      POSTGRES_DB: ${DB_DATABASE_NAME:-immich}
      POSTGRES_INITDB_ARGS: --data-checksums
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME:-postgres}
    healthcheck:
      interval: 5m
      start_interval: 30s
      start_period: 5m
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}'
        || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}'
        --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures),
        0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [
        "$$Chksum" = '0' ] || exit 1
    image: tensorchord/pgvecto-rs:pg14-v0.2.0
    labels:
      createdBy: Apps
    networks:
    - 1panel-network
    ports:
    - ${PANEL_APP_PORT_DB:-5432}:5432
    restart: always
    volumes:
    - ${IMMICH_ROOT_PATH}/pg14/data:/var/lib/postgresql/data
  immich-server:
    container_name: immich-server-immich
    depends_on:
    - immich-pg14-vectors
    devices: *id001
    env_file:
    - ./envs/global.env
    - .env
    image: ghcr.io/immich-app/immich-server:v1.129.0
    labels:
      createdBy: Apps
    networks:
    - 1panel-network
    ports:
    - ${PANEL_APP_PORT_HTTP}:2283
    restart: always
    volumes:
    - ${IMMICH_ROOT_PATH}/data/library:/usr/src/app/upload
    - /etc/localtime:/etc/localtime
