Immich env file - where is it? Did someone pinch it?

What type of hardware are you using: Old laptop or computer
What YunoHost version are you running: 12.0.14
What app is this about: Immich

Describe your issue

I have installed Immich on my Yunohost server and the client is on my phone. The versions match and they are talking to each other. I managed to add two external libraries that are sat on two big USB drives.It all seems to be working fine and it uploads my photos as soon as I take them. However… I want to change the server directory where Immich stores my uploaded files. From research I believe this is defined in the .env file on a line as follows:- UPLOAD_LOCATION=DATA_DIR
So I thought that would be an easy fix, find this .env config file, edit the line and bob’s your uncle. However … I cant find the actual .env file! I’m relatively new to Linux but am an ex-Unix user (from 40 years ago) and its slowly coming back to me (even the Vi editor).

Most of the info on line refers to a docker install not Yunohost directly. I have found a directory (/etc/Yunohost/apps/immich/conf. That contains a file call “env” that looks to be a template but its not got the “.env” extension. Itried editing it to no avail. I also see a hidden file called env.swap .

Does anyone know where the “env” file I need to edit is sitting? Or am I meant to update this some other way?
Apols if it’s obvious and I am just being dumb. I just want Immich to upload files to my USB drive and not the main disk (which is a bit small). Any guidance would be gratefully received. Thanks.

Share relevant logs or error messages

N/A

Here : /var/www/immich/env (will be overwritten at each update)

Cheers! Will give it a go tomorrow.

Thanks for the suggestion. I found the file called “env” (no extension) and edited the UPLOAD_LOCATION to point to my mounted usb drive and then rebooted the server. Unfortunately that didn’t fix it. It still seems to upload the files to a weirdly named file structure under /home/yunohost.app/immich/upload . What am I missing?
Thanks, Neil.

Did you change IMMICH_MEDIA_LOCATION too ?

I did try changing that one too but it broke the sync completetely. On the client end I get an amber “i” on my user icon and my server storage shows “0 of 0 used” and I get the comment “Please check your network conection …” Any manual sync tells me the Upload Status is “Failed”. The logs tell me it can’t resolve the endpoint. I assume that changing the media location broke the link in some way.

I remember from my Unix days that file permissions are more complex here so I made sure Immich had full RW access to the new storage location and all sub folder/files even though the directory was created and is owned by root. I’m not quite sure what I am missing.

I do appreciate your guidance. Thanks, Neil.

That would be a good idea to have it as a setting configurable from a config panel

Managing external/removable device to expose data-dir for sure no. That could lead to too many issues.

@tzb6js : perhaps a bind mount from your USB drives to /home/yunohost.app/immich and leaving the env file to its default is certainly a better solution. But can’t help with such customization.

It’s a shame we can’t ‘paramterise’ the data directory as an option in the UI. I see a lot of people set an external drive for data storage when they set up there own in docker. I will keep plugging away. If I crack it I will post the solution somewhere on here for others who have the same requirement. Thanks.

I cracked it!

  1. I changed both lines in the env file.( The UPLOAD_LOCATION and the IMMICH_MEDIA_LOCATION )
  2. I made sure i copied the full existing directory structure for the original location at /home/Yunohost.app/immich
    3.I then updated all the permissions on the copied file structure using chmod to give everyone full +rwx access to the whole structure.
  3. I then rebooted and …
    BINGO
    It all started working fine using my usb drive as the immich data location.

The problem I had was related to step 2 above. It took longer than I thought to copy the structure across and being impatient I killed the SSH window before it had completed (I thought it had just hung). I jsut need to be more patient…

Thanks for all your help. Much appreciated.

P.s. I do think it would be much better to have an option to set this through the web UI or similar.

Thanks,
Neil.

First step is waiting for that issue to be solved "Being able to move the app's data location" is a reccuring need, we should really think about having a command to simplify and make the operation robust · Issue #2372 · YunoHost/issues · GitHub

1 Like

Cheers! Much appreciated.

I wanted to piggyback off this discussion - I’m doing something similar tzb6js. I’ve got some NFS shares setup (to use with Nextcloud) for my proxmox server, so that my Yunohost container doesnt actually have any data stored inside it. I see the github request about moving storage in Yunohost, and this is how I typically get around it.

I’ve got Immich succesfully importing the photos portion of my nextcloud mount, but from what I can gather it appears to be pulling those photos into my yunohost container. As it stands, I’m watching my actual container storage thus decrease, which I’d like to avoid.

To ask directly: is Immich pulling my photos from my mount into the container itself or is this just cached data, like thumbnails, etc? I would like any data creation for my photos to be kept isolated to that mount point (Nextcloud does this, but their photo integration isn’t great and the Immich devs seem cool :D)

I had the same issue and that was why I needed to move the data store. From what I could see it was the thumbnails that it was creating not the actual original images being copied.

At one point I seemed to have a recursive generation going on where it ran for days and consumed almost 120Gb, then I realised that I was pointing to the directory at a higher level where below included the thumbnail directory so it kept indexing and duplicating the thumbnail jpg’s.Once I pointed it to the lower level to exclude the thumbnail directory all went well.

You can check the data weight of immich with that command du -hDs /home/yunohost.app/immich/*

  • Content of /home/yunohost.app/immich/backups is managed by your Database Dump Settings in immich admin page.
  • Weight of /home/yunohost.app/immich/encoded-video depends on your Video Transcoding Settings in immich admin page.
  • Weight of /home/yunohost.app/immich/thumbs depends on your Thumbnail Settings in immich admin page.
  • Weight of /home/yunohost.app/immich/upload is almost null if you use an external library

As already said, the only way to store all the data outside your container is using a bind mount between /home/yunohost.app/immich and where you want to store all the data.

Good to know. Thanks for the insight, much appreciated.

That reminds me… I also had a lot of videos that Immich had re-encoded. I turned that off in the settings and relied on it playing the originals (which seemed to work fine). Then I removed a big set of directories under the encoded-video directory.