Fly.io machines just wont start, even after setting auto-stop to false. I have tried everything I know and now I'm frustrated, why is this so?

I deployed my node js app quite alright. Now it is always suspended because for reasons I dont know, the two machines wont just work.

Both machine ids are:

  1. e784979cd756e8
  2. 6e82ddef372058

Also, below is my http service config

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
processes = [‘app’]

Please help

Hi,

The best places to look are the metrics in the dashboard, and the logs.

The logs should show if there were any errors. Often you will see why that is, likely with a code or at least a message you can then look up to debug it. “Process failed because of X” or “Time-out doing Y” or something. Try flyctl logs and see what that says.

The metrics show RAM, CPU usage etc. If any of those have spiked above the included amount, that could also cause the process to be killed/suspended. You could try temporarily increasing the CPU and/or RAM to see if that helps.

Thank you so much for this response.
I checked the logs on both machines and noticed these lines:

It says “nodemon:not found

But I have nodemon installed, and works fine on my local device. Here is the dev dependency in my packeage.json file:

“devDependencies”: {
@flydotio/dockerfile”: “^0.5.5”,
“nodemon”: “^3.1.0”
}

Please what am I getting wrong?

Hi,

Ah, that would explain it.

Yep, nodemon will be a dev dependency. When you run your app locally, you would install all its dependencies with npm install

But when Fly builds an image of your app, your Dockerfile (or builder) will likely only install production dependencies. Hence it won’t install nodemon and so will result in an error if your app does nodemon index.js.

Normally that is what you want to happen. Since you normally use nodemon for local development. That restarts the node server/process when you are changing files. But you don’t need to do that in production (since the files won’t change).

So … your options would be either:

  1. run your app with node index.js, not nodemon index.js.

or if you really need to run it with nodemon for some reason …

  1. install all dependencies, which will include nodemon too. If you have a Dockerfile, you would probably change e.g npm install --production to npm install. There are different ways to write that. Some use npm ci. That way nodemon will be found, and that particular error won’t happen.
2 Likes

Never knew the deployment behaves like that.
Thank you so much.

1 Like

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