immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
51.09k stars 2.7k forks source link

[BUG] API repeatedly reporting 'successfully uploaded x assets' #6263

Closed undaunt closed 9 months ago

undaunt commented 10 months ago

The bug

Prior to the 1.92 release, such as on 1.91.4, if I were to use the CLI to upload a folder and it stated, eg: "successfully uploaded 30 assets", on a subsequent run it would state all assets had already been uploaded. (I checked because I am nervous about missing any photos on import.)

Now, no matter how many times I execute the same CLI folder upload, the message always states it has successfully uploaded the assets. I don't appear to have duplicates being added to Immich but I'm wondering if this is a false positive message, or something with the hashing changed, or otherwise.

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

v1.92

Version of Immich Mobile App

N/A

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    container_name: immich-server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    restart: unless-stopped
    profiles: ["all","immich"]
    networks:
      - $PROXY_NETWORK
      - $APP_NETWORK
    security_opt:
      - no-new-privileges:true
    depends_on:
      - immich-redis
      - immich-db
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_DIR}:/usr/src/app/upload
      - /mnt/media/photos/icloud:/icloud:ro
      - $DOCKERDIR/immich/config/auth.yml:/root/.config/immich/auth.yml:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - DB_HOSTNAME=${POSTGRES_IMMICH_HOST}
      - DB_DATABASE_NAME=${POSTGRES_IMMICH_DB}
      - DB_USERNAME=${POSTGRES_IMMICH_USER}
      - DB_PASSWORD=${POSTGRES_IMMICH_PASS}
      - REDIS_HOSTNAME=${IMMICH_REDIS_HOSTNAME}
    labels:
      - traefik.enable=true
      - traefik.http.routers.immich.entrypoints=https
      - traefik.http.routers.immich.rule=Host(`immich.$DOMAINNAME`)
      - traefik.http.routers.immich.middlewares=secure-headers@file,crowdsec@file
      - traefik.http.routers.immich.service=immich
      - traefik.http.services.immich.loadbalancer.server.port=3001

  immich-microservices:
    container_name: immich-microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    restart: unless-stopped
    profiles: ["all","immich"]
    networks:
      - $APP_NETWORK
    security_opt:
      - no-new-privileges:true
    depends_on:
      - immich-redis
      - immich-db
    devices:
      - /dev/dri:/dev/dri
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_DIR}:/usr/src/app/upload
      - /mnt/media/photos/icloud:/icloud:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - DB_HOSTNAME=${POSTGRES_IMMICH_HOST}
      - DB_DATABASE_NAME=${POSTGRES_IMMICH_DB}
      - DB_USERNAME=${POSTGRES_IMMICH_USER}
      - DB_PASSWORD=${POSTGRES_IMMICH_PASS}
      - REDIS_HOSTNAME=${IMMICH_REDIS_HOSTNAME}

  immich-machine-learning:
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    container_name: immich-machine-learning
    volumes:
      - $DOCKERDIR/immich/models:/cache
    restart: unless-stopped
    profiles: ["all","immich"]
    networks:
      - $APP_NETWORK
    security_opt:
      - no-new-privileges:true

  immich-redis:
    image: redis:6.2-alpine@sha256:b6124ab2e45cc332e16398022a411d7e37181f21ff7874835e0180f56a09e82a
    container_name: immich-redis
    restart: unless-stopped
    profiles: ["all","immich"]
    networks:
      - $APP_NETWORK
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
      start_period: 20s
      interval: 30s
      retries: 5
      timeout: 3s
    volumes:
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro

  immich-db:
    image: tensorchord/pgvecto-rs:pg14-v0.1.11@sha256:0335a1a22f8c5dd1b697f14f079934f5152eaaa216c09b61e293be285491f8ee
    container_name: immich-db
    restart: unless-stopped
    profiles: ["all","immich"]
    networks:
      - $APP_NETWORK
    security_opt:
      - no-new-privileges:true
    environment:
      - POSTGRES_PASSWORD=${POSTGRES_IMMICH_PASS}
      - POSTGRES_USER=${POSTGRES_IMMICH_USER}
      - POSTGRES_DB=${POSTGRES_IMMICH_DB}
    volumes:
      - $DOCKERDIR/immich/db:/var/lib/postgresql/data

Your .env content

I converted the .env file to be part of my docker-compose parent .env file for interpolation, added the variables to both the microservice and server services, and am not specifing env_file on each service.

Reproduction steps

1. docker exec immich-server immich upload -r /icloud/user/PrimarySync/2024/
2. repeat

Additional information

I mounted the authorization for the CLI as a volume to prevent having to reauthorize each time (mounted into immich-server), contents below:

instanceUrl: http://immich-server:3001/api
apiKey: xxxxxxx
AngelPone commented 9 months ago

fixed in #6357