Set client_max_body_size via docker env file?

I am using the default docker compose stack. I use the CLI tool to upload and find that very large files fail. I believe this is due to the default 50000M file size limitation within the immich proxy config. Is it possible to use a docker enviornment variable to set this aspect of the proxy config?
20 Replies
Alex Tran
Alex Tran2y ago
what is your very large file size?
charlesc
charlescOP2y ago
I'm seeing failures of a few hundred files, all of them are videos. File sizes range but mostly are in the 1GB - 10GB range
Alex Tran
Alex Tran2y ago
are you uploading over your dns or local IP?
charlesc
charlescOP2y ago
FWIW, several thousand still images and lots of smaller videos were uploaded correctly. I am uploading using local IP
immich upload --key <API KEY> --server http://192.168.110.14:2283/api /mnt/remotes/TRUENAS.CHARLES.HOME_Photos/2023 --recursive --import
192.168.110.14 is the IP of the ubuntu VM on my local network that is running the immich docker stack
Alex Tran
Alex Tran2y ago
You are using the import feature, correct?
charlesc
charlescOP2y ago
yes, for the read-only gallery
bo0tzz
bo0tzz2y ago
If you're using import then nginx limits should not be involved at all
Alex Tran
Alex Tran2y ago
for read-only library, the file don't actually get uploaded what failure are you seeing?
charlesc
charlescOP2y ago
ok. thank you both, will need to look into this further then. I was previously seeing 504 gateway errors shown in the CLI output after completion of the immich cli script running I just tried to re-run it to get the full output for you, but now the output does not show any error, it just stops before importing all files
charlesc
charlescOP2y ago
I re-ran the immich cli import tool, this time from the immich-server container I get this gateway timeout error failure
Alex Tran
Alex Tran2y ago
what is your server spec?
jrasm91
jrasm912y ago
When you import a file it actually reads it from disk and hashes it. For large files this could take awhile and the http request could be timing out while it waits for the hashing to finish. The file is probably successfully importing though. You may want to try running the command on the immich-server container directly and use http://localhost:3001 as the server url I believe. This would bypass the Nginx timeouts.
charlesc
charlescOP2y ago
immich is running via docker stack on an ubuntu VM. VM is allocated 8GiB RAM and 4x vCPUs. Only containers running on this VM are the immich containers plus portainer agent. VM is on an XCP-NG host that is running only this VM and 1 other. Neither the VM or the VM host are under heavy load, but if immich typically requires more memory, I can allocate much more. ok thanks. I will look a few of the filenames and see if they in fact do import despite the error messages. Not in front of my system currently, will report back today.
ddshd
ddshd2y ago
I have the same issue and this is the case. I get timeout errors but the images show up so 🤷🏽‍♂️
charlesc
charlescOP2y ago
using localhost:3001 fails with the following output:
/usr/src/app # immich upload --key <AKIKEY> --server http://localhost:3001/api /mnt/remotes/TRUENAS.CHARLES.HOME_Photos/2023 --recursive --
import
Checking connectivity with Immich instance...
Error connecting to server - check server address and port
/usr/src/app # immich upload --key <AKIKEY> --server http://localhost:3001/api /mnt/remotes/TRUENAS.CHARLES.HOME_Photos/2023 --recursive --
import
Checking connectivity with Immich instance...
Error connecting to server - check server address and port
bo0tzz
bo0tzz2y ago
Try without api in the url
jrasm91
jrasm912y ago
use http://localhost:3001/ as the server url
Specifically for import, the file hashing happens 100% on the server, while the http request is waiting for a response. Nginx has a timeout that says "If I don't get any data back from this request after X seconds, I'm going to drop the connection". If hashing on the server takes longer than X seconds, the connection is dropped, even though the code for hashing/importing is still running on the server.
charlesc
charlescOP2y ago
looks like http://localhost:3001 without /api works properly. thanks guys got it. that explains it. for me, I dont think theres any advantage in connecting via the proxy when I am running this from the CLI, I might as well just take out the middleman
jrasm91
jrasm912y ago
Yeah, exactly. If you can access the server container (while at home, etc.) it will always be faster/less error prone
charlesc
charlescOP2y ago
going to submit a PR to the docs to clarify this on the read-only gallery page

Did you find this page helpful?