Procfile Confusion

I have a node.js app running on Fly. It was on Heroku and had the following simple Procfile:

web: yarn start (→ node dist/index.js)

I removed the Procfile and tried to deploy to Fly, but was met with a deployment error “no default process found”.

Adding the Procfile back fixed the issue, but this isn’t mentioned in Fly’s documentation. I’d like to understand how to configure my processes using fly.toml but am new to docker/fly and couldn’t seem to get things right.

Any more guidance on how to specify node.js processes (both exposed to the web, or not) in fly.toml would be helpful.

Hey Brian, thank you for the question. The procfile can be replaced with with a [processes] section in the fly.toml.

Procfiles aren’t well documented here but this is something we are planning to expand on. Here is a similar forum post with some more context on procfiles you may find useful - Procfile documentation

I’ve read through what you’ve linked, as well as Fly’s documentation on processes and node.js, and it has not led me to a working solution using fly.toml.

To be clear, I would like to know exactly how to specify a node.js process in the fly.toml file that is exposed to the web – Please help me understand how to turn the following into something that works.

[processes]
  web = node dist/index.js

Does it work if you quote your command?

[processes]
  web = "node dist/index.js"

No :frowning:

Using–

# Procfile
web: node dist/index.js

–seems to be the only setup I can get to work with custom node.js depoyments on Fly.

Maybe this has something to do with the fact that Fly’s default node.js builder appears to require an index.js or server.js file in the root.

Your app should work without a Procfile if you define an start script in package.json.

We use the Heroku buildpack for node.js apps, so the Procfile is fine to keep if you want to!

Thanks kurt

In fact, the the first thing I tried was to deploy a node.js project using just a start script in package.json but that did not seem to work.

Interestingly, having web: yarn start in the Procfile (which calls start in package.json) works, which is what I will use for now – it just wasn’t clear reading through the tutorials that this is the canonical way to use Fly.