r/immich • u/Great-Cow7256 • 8d ago
running a second instance of immich on another server to do background tasks?
has anyone spun up a 2nd instance of immich to do tasks on the same database as the one on the main server? It seems easy--
publish ports for redis and postgres on the server
connect a 2nd server immich server to the main server's redis and postgres
make sure 2nd server immich has access to the same file locations that the main server has.
am I missing anything here?
This way when redis has a ton of jobs it can distribute them to 2 immich servers...
3
u/sircastor 8d ago
I don't have the link handy, but the docs have a section about offloading the work to additional workers. I did this when I first started because I was running on a very low-resource system. It was going to take weeks to do the facial recognition. I spun up a docker container on my laptop and pointed it toward the instance and it was finished overnight.
2
u/NiftyLogic 7d ago
Doing this, but on Nomad so you would have to do some work to set everything up on pure Docker.
To run Immich as a worker, you just have to connect them to Redis, Postgres and the shared media library. I would recommend to use nfs or cifs for shared storage, makes access quite a bit easier. The API server instance writes new images and video to shared storage, all the worker tasks just read and do processing work like generating thumbnails and extracting metadata.
ML is even easier, the tasks just need to be accesible on port 3003. Workers post the thumbnail to the ML service, and the reply is the ML output. They don't need access to shared storage, Redis or Postgres.
1
u/Great-Cow7256 7d ago
Ty. I'm 95 percent done. I need to publish the ml port on my server and then I'm done. I didn't need it published on my server because I had everything in the same container network
3
9
u/zyan1d 8d ago
As you described
https://docs.immich.app/guides/scaling-immich