Created a Flask app, when trying to deploy it never passes the first step:
→ docker host: 20.10.12 linux x86_64
[+] Building 8.6s (0/1)
=> [internal] load remote build context
If I use local only deploy it deploys, however gives me an error message:
→ v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1
That usually means health checks are failing, or the app process is exiting. If you run fly status --all you can see a list of VM attempts. fly vm status <id> will show the specifics if one failed or restarted.
Events
TIMESTAMP TYPE MESSAGE
2023-02-05T20:43:15Z Received Task received by client
2023-02-05T20:43:33Z Task Setup Building Task Directory
2023-02-05T20:43:53Z Started Task started by client
2023-02-05T20:48:33Z Alloc Unhealthy Task not running for min_healthy_time of 10s by deadline
Checks
ID SERVICE STATE OUTPUT
3df2415693844068640885b45074b954 tcp-8080 critical dial tcp 172.19.69.194:8080: connect: connection refused
Paraphrasing what I see here, the fly.toml says that your application will be listening on port 8080, but after starting your application fly could not detect any application listening on that port.
You can have your application run on that port by coding something like the following:
app.run(host='0.0.0.0', port=8080)
Or by setting an environment variable, either in the Dockerfile:
ENV FLASK_RUN_PORT=8080
Or in the fly.toml:
[env]
FLASK_RUN_PORT = 8080
Or you can change fly.toml to match the port your application is actually using, likely 5000: