Easiest way to deploy a server + X workers architecture?
I have a single Dockerfile that builds an image for a Node.js app. The image has 2 possible entry points: server.ts and worker.ts.
I'm looking to deploy a single instance of server and a predefined number of workers all within a single server managed by Dokploy.
- Only the server should be publicly accessible. Workers should remain private. - The server should know how many workers are there and have their names/ip address to be able to connect to them via the internal network.
I guess Docker Compose would be the easiest? I have used Docker Compose in the past, but only for local development. Not sure what is required to get this working on Dokploy.
Do I only need to setup Traefik for my server since that's the only thing that's going to be exposed to the public internet? How do I get the available workers and their network names from the server at runtime? Are there any environment variables set by Dokploy that I can use to discover the workers? Say I want 8 workers, do I just copy and paste the workers service in my compose file 8 times and simply use their names from within the server (i.e worker1, worker2, worker3... etc)