I’m running n8n in docker and am making steps towards a queue mode setup. I have the main instance talking to postgres and redis successfully, so I’m in the final stretches.
Looking through the documentation, I see we are supposed to launch each worker with a command like “docker run --name n8n-queue -p 5679:5678 n8nio/n8n n8n worker”.
My question is, is there an environment variable for a docker-compose file to specify the container as a worker or is the only way to launch the container with the parameter in the command?
I guess a second question that pops up is if we have multiple worker containers on a single host, is the sensible approach increment the outside port (5679, 5680, etc) so each worker can be access by web interface? Or does it not even really matter if there is ui access at all?
Having multiple workers on the same host would make having workers kind of pointless the idea is you can use them to distribute the load between machines. That being said depending on the type of worker they may not have a web interface available it is only really the webhook workers that would need them.
In your compose file you can add something like the option below, You can find an example of this here: n8n/docker-compose.yml at master · n8n-io/n8n · GitHub
command: /bin/sh -c "sleep 5; n8n worker"
Thank you for that response. I found that command last night but hadn’t yet implemented it but will do so now.
Perhaps I misread it, but based on this thread, it seemed a worker per host CPU was sensible due the the single-threaded nature of JS.
Also, currently I am installing the community nodes I was using in my original stand-alone instance in the worker instance. I assume this is a requirement as well to add any community nodes to workers that are required in workflows?
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.