Issues with health checks when deploying a new docker image

Happy New Year, everyone. Hope 2024 is off to a good start for everyone.

I am trying to deploy from a docker image. Seems to give up with the message:
Error: timeout reached waiting for health checks to pass for machine

I tried increasing the memory size. And also tried to launch via:
PS C:> flyctl launch --smoke-checks=false

Here is my fly.toml file:

And here is the error:

I know everyone’s time is valuable, so appreciate any response - even if its just to point me in the right direction. Thank you!!

Hi there,

I haven’t tried to set this up myself, but from what I understand about from searching and the configuration and log files you’ve shared, that container image is meant to function as part of a docker compose configuration with some other components. To host this on, I think you’ll need to deploy those other components either as additional apps and network them together, or as multiple processes within the same app. From the compose template, it looks like you’ll need at least a database and a redis instance configured for this system function. In your log file, it seems like addy is refusing to start because it can’t find environment variables that point it at a database.

I’m honestly not sure if these are actually pointers in the right direction, but sincerely, I hope they might help you. Best of luck!

1 Like

In addition to what @ben-ang wrote, I think you can also revise your fly.toml to remove the http_service section since [[services]] has the same information. auto_stop_machines and auto_start_machines can be added under [[services]] too.

If you remove the [[services.tcp_checks]] section, fly launch will succeed, though the app will still be crashing because of the missing database. Then if you put the checks back in and remove http_service, the health checks will work as expected and report a failure when you run fly deploy.

1 Like

@ben-ang @christopher-fly Thank you so much for the responses! Also apologize for my ignorance; I’m somewhat new at this.

When checking git, seems as if this specific application uses MariaDB. I checked on the fly documentation and it sounds more generic MySQL.

Assuming this is not an issue, how would I tweak the fly.toml to setup and host Maria DB & Redis when launching?

When looking at this guide, seems as if I would need to spin up an extra “app” for each database? but was hoping this could instead be solved by adding a few lines to the fly.toml file.

I appreciate your time. Any extra information would be helpful - thank you!

@gawlinski While you can run multiple processes within a single app, it can get a little messy.

If you want to manage MySQL yourself, then creating a separate app using the docs you linked to is probably your best path forward.

As an alternative, you can consider a managed MySQL service like PlanetScale. You create a database with them and then add the connection details to your Fly app. Here’s a guide for getting set up with PlanetScale.

The same scenario applies with Redis. You can run it as a standalone, separate app, or you can use Upstash, which is tightly integrated with Fly.

Generally speaking, managed services provide convenience at a cost, but they also offer free tiers that might be sufficient for your needs.

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