immich-app / immich

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

[BUG] iOS Background Upload Not Running #6281

Closed uninvitedguest closed 8 months ago

uninvitedguest commented 8 months ago

The bug

I am finding that the background sync on my partner's iPhone is not working/triggering at all, despite foreground sync working flawlessly.

The OS that Immich Server is running on

Proxmox 8.0.4 -> Turnkey Core 17.1 / Debian 11

Version of Immich Server

1.9.3

Version of Immich Mobile App

1.9.3

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}
    command: [ "start.sh", "immich" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: unless-stopped
    networks:
      - immich-internal

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.yml
    #   service: hwaccel
    command: [ "start.sh", "microservices" ]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    environment:
      - TZ=TZ
    depends_on:
      - redis
      - database
    restart: unless-stopped
    networks:
      - immich-internal

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - /model-cache:/cache
    env_file:
      - stack.env
    restart: unless-stopped
    networks:
      - immich-internal

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3
    restart: unless-stopped
    networks:
      - immich-internal
    labels:
      com.centurylinklabs.watchtower.enable: "false"

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.1.11
    env_file:
      - stack.env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      #PG_DATA: /var/lib/postgresql/data
    volumes:
      - /database:/var/lib/postgresql/data
    restart: unless-stopped
    networks:
      - immich-internal
    labels:
      com.centurylinklabs.watchtower.enable: "false"

volumes:
  pgdata:
  model-cache:

networks:
  immich-internal:
    external: true

Your .env content

DB_HOSTNAME=hostname
DB_USERNAME=username
DB_PASSWORD=password
DB_DATABASE_NAME=database
REDIS_HOSTNAME=redis
UPLOAD_LOCATION=upload
TZ=TZ
IMMICH_VERSION=release

Reproduction steps

1. Configure iOS application to enable foreground and background uploads (no charging restriction)
2. While open, Immich app uploads without issue in the foreground
3. While closed, Immich app does not upload images in the background (e.g. last uploaded images were from Dec 7th while keeping the app open for a foreground upload).
4. 2 Background processes are listed as queued. Dec 8th, 12:37 is the last time the application was opened. As of 16:15 pm logs do not indicate anything uploaded

Additional information

  1. iPhone 13
  2. iOS 17.1.2
  3. iCloud optimized images is turned on.
  4. In iOS general settings, every background refresh service is disabled except Immich.
alextran1502 commented 8 months ago

I don't think we handled background upload with optimized storage turned on. Since it will need to be downloaded from iCloud and then reupload to Immich.

uninvitedguest commented 8 months ago

Oh, I see. Going through the upload of 70,000 assets is going to be a pain without background uploads as this is her main device.

Can this be turned in to a feature request?

alextran1502 commented 8 months ago

@uninvitedguest background upload doesn't mean to work for the initial bulk upload. I recommend using foreground upload or download your library from iCloud and use the CLI to upload.

hjspencer commented 8 months ago

@alextran1502 you still need to allow your phone to upload all images though which Immich will then discard as a duplicate. I have 30k images/videos and this took an age (though I was doing it before icloud was properly supported.

Would still be useful to have this feature.

alextran1502 commented 8 months ago

@hjspencer yes

undaunt commented 5 months ago

@alextran1502 I've gone through and done my initial bulk upload with foreground upload. How often does background upload execute and should I expect that if I enable it now, it will keep pace with all new photos/videos taken before they are removed from my device due to optimized iCloud photo storage on my phone?

LoadingZhang commented 1 month ago

@uninvitedguest background upload doesn't mean to work for the initial bulk upload. I recommend using foreground upload or download your library from iCloud and use the CLI to upload.

@alextran1502 there is another problem, app will not ignore the photos have uploaded by cli now when backup, even the picture show "synced" on photos page

alextran1502 commented 1 month ago

@LoadingZhang it is expected behavior, for now. The server rejects the duplicated files and it will be put into a black list to not get uploaded again

LoadingZhang commented 1 month ago

@LoadingZhang it is expected behavior, for now. The server rejects the duplicated files and it will be put into a black list to not get uploaded again

@alextran1502 This takes a long time to re-upload tens of thousands of photos and videos. It would be better if app could ignore synced photo

alextran1502 commented 1 month ago

@LoadingZhang Yes, agree, we plan to add that mechanism in