Run multiple processes in one app

Hi,
I have a node project with 2 entry points - index.js (api server) and process.js (worker).
I want to run them both inside one fly app only.

I have setup package.json to run with index.js as starting point using “npm run serve” and with process.js using “npm run worker”

How can I create the fly.toml and dockerfile to achieve this?

You can share the same Dockerfile if the dependencies are the same and create multiple processes like this:

[processes]
app = "npm run serve"
worker = "npm run worker"

Also make sure web process is chosen correctly on the services sections. Should be something like this:

[http_service]
  # ...other things
  processes = ["app"]
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.