immich-app / immich

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

[BUG] Thumbtails and image not being displayed following storage migration #1170

Closed Crono972 closed 1 year ago

Crono972 commented 1 year ago

Regression - Following storage migration

The thumbtails and image are not being displayed following storage migration. I still see the file name as the old naming : b74485c5-7cbd-4f4c-abfc-1bfbd3da838c and not the new naming even tought I did run the storage job migration.

The file in the physical location were successfully renamed / moved according to the storage job migration.

I have in the console when I open immich these error : a lot of 403 request from : http://192.168.1.101:2283/api/jobs with this json as response payload : {"statusCode":403,"message":"Forbidden resource","error":"Forbidden"}


My docker-compose file is

version: "3.8"

services:
  immich-server:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-server.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    image: altran1502/immich-server:release
    entrypoint: ["/bin/sh", "./start-microservices.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    image: altran1502/immich-machine-learning:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - database
    restart: always

  immich-web:
    image: altran1502/immich-web:release
    entrypoint: ["/bin/sh", "./entrypoint.sh"]
    env_file:
      - .env
    environment:
      # Rename these values for svelte public interface
      - PUBLIC_IMMICH_SERVER_URL=${IMMICH_SERVER_URL}
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always

  database:
    container_name: immich_postgres
    image: postgres:14
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

  immich-proxy:
    container_name: immich_proxy
    image: altran1502/immich-proxy:release
    environment:
      # Make sure these values get passed through from the env file
      - IMMICH_SERVER_URL
      - IMMICH_WEB_URL
    ports:
      - 2283:8080
    logging:
      driver: none
    depends_on:
      - immich-server
    restart: always

volumes:
  pgdata:

my redacted .env file is

###################################################################################
# Database
###################################################################################

DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich

# Optional Database settings:
# DB_PORT=5432

###################################################################################
# Redis
###################################################################################

REDIS_HOSTNAME=immich_redis

# Optional Redis settings:
# REDIS_PORT=6379
# REDIS_DBINDEX=0
# REDIS_PASSWORD=
# REDIS_SOCKET=

###################################################################################
# Upload File Location
#
# This is the location where uploaded files are stored.
###################################################################################

UPLOAD_LOCATION=/home/fhocs/Share/Photos

###################################################################################
# Log message level - [simple|verbose]
###################################################################################

LOG_LEVEL=simple

###################################################################################
# JWT SECRET
#
# This JWT_SECRET is used to sign the authentication keys for user login
# You should set it to a long randomly generated value
# You can use this command to generate one: openssl rand -base64 128
###################################################################################

JWT_SECRET=REDACTED

###################################################################################
# Reverse Geocoding
#
# Reverse geocoding is done locally which has a small impact on memory usage
# This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable
# This ranges from 0-3 with 3 being the most precise
# 3 - Cities > 500 population: ~200MB RAM
# 2 - Cities > 1000 population: ~150MB RAM
# 1 - Cities > 5000 population: ~80MB RAM
# 0 - Cities > 15000 population: ~40MB RAM
####################################################################################

# DISABLE_REVERSE_GEOCODING=false
# REVERSE_GEOCODING_PRECISION=3

####################################################################################
# WEB - Optional
#
# Custom message on the login page, should be written in HTML form.
# For example:
# PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"
####################################################################################

PUBLIC_LOGIN_PAGE_MESSAGE=

####################################################################################
# Alternative Service Addresses - Optional
#
# This is an advanced feature for users who may be running their immich services on different hosts.
# It will not change which address or port that services bind to within their containers, but it will change where other services look for their peers.
# Note: immich-microservices is bound to 3002, but no references are made
####################################################################################

# IMMICH_WEB_URL=http://immich-web:3000
# IMMICH_SERVER_URL=http://immich-server:3001
# IMMICH_MACHINE_LEARNING_URL=http://immich-machine-learning:3003

####################################################################################
# OAuth Setting - Optional
#
# These setting will enable OAuth login for your instance of Immich
# Folow the instructions in the page https://immich.app/docs/usage/oauth to set up your OAuth provider
####################################################################################

# OAUTH_ENABLED=false
# OAUTH_ISSUER_URL=
# OAUTH_CLIENT_ID=
# OAUTH_CLIENT_SECRET=
# OAUTH_BUTTON_TEXT=Login with OAuth
# OAUTH_AUTO_REGISTER=true
# OAUTH_SCOPE="openid profile email"

I'm running Immich 1.39 on a raspberry pi 4 8gb. The folder where the photo are stored is a mounted folder linked to a drive in my internet box Task List

Please complete the task list below. We need this information to help us reproduce the bug or point out problems in your setup. You are not providing enough info may delay our effort to help you.

To Reproduce Steps to reproduce the behavior:

  1. Have a lot of photos upload on Immich pre 1.39
  2. Update to immich 1.39
  3. Run storage migration jb
  4. Cannot see any more photo in immich

Expected behavior I except to see the photo in immich or to be able to reconstruct the index.

Screenshots Issue happen on mobile and desktop 31033

System

Additional context I have two user on my immich.

image

The admin got no issue, everything was migrated flawlesly, the redacted one, not so lucky The redacted one cannot fully sync data at some point the mobile get stuck as well The photo newly added by Redacted are working fine

alextran1502 commented 1 year ago

What happen if you try to run the job again?

alextran1502 commented 1 year ago

a lot of 403 request from : http://192.168.1.101:2283/api/jobs with this json as response payload : {"statusCode":403,"message":"Forbidden resource","error":"Forbidden"}

How do you mount the storage?

I am guessing this related to how the storage get mounted

Crono972 commented 1 year ago

The storage is mounted via /etc/fstab with the following content :

proc            /proc           proc    defaults          0       0
PARTUUID=e3cad86b-01  /boot           vfat    defaults          0       2
PARTUUID=e3cad86b-02  /               ext4    defaults,noatime  0       1
//192.168.1.254/Freebox/ /home/fhocs/Share cifs rw,users,credentials=/home/fhocs/.smbcredentials,iocharset=utf8,uid=1000,sec=ntlmv2,file_mode=0777,dir_mode=0777,_netdev 0 0
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

The raspberry pi was set with network on boot image

When I boot, the share is mounted => then docker spin up


I don't have the 403 on the other user, only on Redacted

If I try to run the job again, nothing change

jrasm91 commented 1 year ago

I don't think this has anything to do with the storage migration, but the access checks that were recently added as well. Do you know what version you were on prior to upgrading? Can you attach a screenshot of the thumbnail urls that are failing?

It should look something like this, although you probably are not getting 200's back, but 403. Can you verify the url for those requests is something like: http://host:port/api/asset/thumbnail/{assetId}?format=WEBP?

image

Crono972 commented 1 year ago

I was on v1.38.0_60-dev prior to upgrading.

The error changed now I got 500 :

Here are the url like http://192.168.1.101:2283/api/asset/thumbnail/d5c6a858-592b-4c1d-bdb5-e7ad792fd7cf?format=WEBP Here one payload response exemple : {"errno":-2,"code":"ENOENT","syscall":"stat","path":"upload/697576e1-5ab8-4e25-ab8c-bb1f57f62557/thumb/591cc210c36001626907bbf6a27da99ec4424e0ec7440932a6c5dd02bc74e1fa/55cf1d66-611c-4a8e-bf06-4cea99834a11.webp"}

image

jrasm91 commented 1 year ago

Oh, it's throwing an error indicating that file doesn't exist on disk. Can you verify that the path exists on your filesystem?

Crono972 commented 1 year ago

No the file doesn't exist on my filesystem and I can't regenerate it with the GENERATE THUMBNAILS jobs I can launch the GENERATE THUMBNAILS only on the admin account => it regenerate the thumbnails only on this account, not on the redacted one that need it to be regenerated

alextran1502 commented 1 year ago

I have a feeling there is something funky going on with the mount volume.

Can you make sure the volume is mounted correctly and you can access the files in the volume?

jrasm91 commented 1 year ago

You are right in that the jobs screen only shows up for the admin account, but the jobs there apply to the whole system, not just the admin account.

Crono972 commented 1 year ago

Sorry, when I checked the file in the filestorage I changed the permission on one of the subfolder -_- by reverting it, the issue is fix