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.