imagegenius / docker-immich

Monolithic (Single) Docker Container for Immich
GNU General Public License v3.0
611 stars 27 forks source link

anyway to migrate from docker-immich to docker-compose? #354

Open wjfu99 opened 6 months ago

wjfu99 commented 6 months ago

Recently, I try to migrate from docker-immich to docker-compose, I map the /photos folder in docker-immich to /usr/src/app/upload/ in docker-compose version. But i found all the photos are unlinked and become into untracked files:

image image

I guess in docker-immich's database, the uploading folder point to /photos, but in docker-compose's database, the uploading folder point to /usr/src/app/upload. But i have no idea to slove this, i notice there is a issue about migrating from docker-compose to docker-immich #12 , i'm wonder if possible to migrate from docker-immich to docker-compose version?

martabal commented 6 months ago

You just need to add - ${UPLOAD_LOCATION}:/photos to your docker-compose.yml

wjfu99 commented 6 months ago

@martabal Hi, thanks for your quick reply. If I understand correctly, I should add - ${UPLOAD_LOCATION}:/photos under - ${UPLOAD_LOCATION}:/usr/src/app/upload to my docker-compose.yml for immich-server and immich-micorservice, right? (If i just replace -${UPLOAD_LOCATION}:/usr/src/app/upload with - ${UPLOAD_LOCATION}:/photos, the newly added photos cannot be linked rightly, since them will still be added to the path /usr/src/app/upload).

After do that, the immich seems works well, but the issue raised in repair page let me a little annoy, the photos in /photos are marked as offline, the photos in /usr/src/app/upload are marked as untracked:

image image
wjfu99 commented 6 months ago

And I'm concerned that this migration will pollute the database, since the older photos will be recorded with path /photos, and newer photos will be recorded with /usr/src/app/upload. Should I just ignore these warning, or consider elegant migration scheme? Or just keep using docker-immich, for me two main concerns are:

  1. The computational consumption may be relatively higher?
  2. docker-immich may stop update one day.
martabal commented 6 months ago

Have you already uploaded assets with the docker-compose.yml ?

wjfu99 commented 6 months ago

sorry I have a little confusion, what the upload do you mean? I have mount the /photos folder (copied from my previous device and all assets are included here) to docker-compose immich, is this the upload you refer?

发件人:"martin" @.> 发送日期:2024-05-04 15:12:42 收件人:"imagegenius/docker-immich" @.> 抄送人: 主 题:Re: [imagegenius/docker-immich] anyway to migrate from docker-immich to docker-compose? (Issue #354)

Have you already uploaded assets with the docker-compose.yml ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

martabal commented 6 months ago

Sorry, what I mean is have you uploaded assets after migrating from the AIO docker image to the official docker images ?

wjfu99 commented 6 months ago

yes, i had tried to upload, the newly uploaded photos (here i mean i upload new photos, not the photos migrated from the old device) seems be treated well, it can be generated thumbnails, and can be previewed or downloaded. im just concern pollute the database. if you mean upload the assets from the old device, i haven't do that, i just mount the / photos folder from the old device for the newer one.

martabal commented 6 months ago

Weird, just adding - ${UPLOAD_LOCATION}:/photos should work fine. Are you sure you didn't have these errors even before the migration ?

wjfu99 commented 6 months ago

I'm pretty sure the offline path and untracked file errors not exist before migration, but the offline path can still be previewed and downloaded. I refer my docker-compose.yml file as following:

name: immich
services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ['start.sh', 'immich']
    volumes:
      - ${UPLOAD_LOCATION}:/photos
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
 ...
  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardwa>
      file: hwaccel.transcoding.yml
      service: quicksync # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcod>
    command: ['start.sh', 'microservices']
    volumes:
      - ${UPLOAD_LOCATION}:/photos
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
wjfu99 commented 6 months ago

Hi, guys, I think maybe I have found the most elegant solution w/o full of offline paths or untracked files.

  1. modify (not add!!!) - ${UPLOAD_LOCATION}:/usr/src/app/upload to - ${UPLOAD_LOCATION}:/photos in your docker-compose.yml
  2. add IMMICH_MEDIA_LOCATION=/photos to .env file, refer this link for details.
  3. docker compose pull & up, then all services will works well. If anyone still find errors, feel free to contact with me