安裝 Immich (取代 Google 相簿)

  • 採用 nfs 方式將 LocalPhotos

    //192.168.11.252/pbs-zpool/nfsshare/immich

    掛入

    /nfs-immich

    • 處理程序:

      apk add nfs-utils
      mkdir -p /nfs-immich
      mount -o nfsvers=4 -t nfs 192.168.11.252:/pbs-zpool/immich /nfs-immich

  • 如果可以正確掛上 /nfs-immich 看到 NAS 內的檔案, 就可以設定開機自動掛上

    rc-update add nfsmount default
    echo "192.168.11.252:/pbs-zpool/immich /nfs-immich nfs rw 0 0" >> /etc/fstab

  • 使用 Docker Compose 進行安裝

    wget https://raw.githubusercontent.com/tryweb/docker-compose/refs/heads/main/immich/docker-compose.yml
    wget https://raw.githubusercontent.com/tryweb/docker-compose/refs/heads/main/immich/.env

    • docker-compose.yml
      services:
        immich-server:
          container_name: immich_server
          image: ghcr.io/immich-app/immich-server:release
          volumes:
            - ${UPLOAD_LOCATION}:/usr/src/app/upload
            - /etc/localtime:/etc/localtime:ro
          env_file:
            - .env
          ports:
            - 2283:2283
          depends_on:
            redis:
              condition: service_started
            database:
              condition: service_healthy
          restart: always
       
        immich-machine-learning:
          container_name: immich_machine_learning
          image: ghcr.io/immich-app/immich-machine-learning:release
          volumes:
            - model-cache:/cache
            - /etc/localtime:/etc/localtime:ro
          env_file:
            - .env
          restart: always
       
        redis:
          container_name: immich_redis
          image: redis:alpine
          healthcheck:
            test: redis-cli ping || exit 1
          restart: always
       
        database:
          container_name: immich_postgres
          image: tensorchord/pgvecto-rs:pg14-v0.3.0
          command: postgres -c shared_preload_libraries=vectors
          env_file:
            - .env
          environment:
            POSTGRES_PASSWORD: ${DB_PASSWORD}
            POSTGRES_USER: ${DB_USERNAME}
            POSTGRES_DB: ${DB_DATABASE_NAME}
            POSTGRES_INITDB_ARGS: '--data-checksums'
          volumes:
            - pgdata:/var/lib/postgresql/data
          healthcheck:
            test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME} -d ${DB_DATABASE_NAME}"]
            interval: 10s
            timeout: 5s
            retries: 5
          restart: always
       
      volumes:
        pgdata:
        model-cache:

      https://raw.githubusercontent.com/tryweb/docker-compose/refs/heads/main/immich/docker-compose.yml

    • .env
      # Immich Environment Variables
       
      # Upload location
      UPLOAD_LOCATION=./upload
       
      # Database Configuration
      DB_HOSTNAME=database
      DB_USERNAME=immich
      DB_PASSWORD=immich
      DB_DATABASE_NAME=immich
       
      # Redis Configuration
      REDIS_HOSTNAME=redis
       
      # Machine Learning Configuration
      MACHINE_LEARNING_WORKER_ENABLED=true
      MACHINE_LEARNING_CACHE_FOLDER=/cache
      MACHINE_LEARNING_HOSTNAME=immich-machine-learning
       
      # Server Configuration
      NODE_ENV=production
      LOG_LEVEL=info
       
      # JWT Secret
      JWT_SECRET=your_jwt_secret_key_here
       

      https://raw.githubusercontent.com/tryweb/docker-compose/refs/heads/main/immich/.env

  • 修改 .env 內的密碼與網址設定
    :
    UPLOAD_LOCATION=/nfs-immich/upload
    :
    DB_USERNAME=immich
    DB_PASSWORD=MyDb_Password
    DB_DATABASE_NAME=immich
    :
    JWT_SECRET=your_jwt_xxxxxxxxxxx-secret_key_here
    
  • 啟動服務

    docker-compose up -d

  • tech/immich.txt
  • 上一次變更: 2025/03/24 14:56
  • jonathan