Deploy stalls out at first step

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

Dockerfile:

# syntax=docker/dockerfile:1

FROM python:3.9.6
WORKDIR /innervision
EXPOSE 80
EXPOSE 443
EXPOSE 8080

COPY requirements.txt /innervision
RUN pip3 install -r requirements.txt
COPY . /innervision
CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]

Fly.toml:

# fly.toml file generated for innervision on 2023-02-05T19:40:17+01:00

app = "innervision"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]

[experimental]
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

No idea what the problem is hope some one can help :slight_smile:

Thanks!

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.

1 Like

Hey Kurt,

Thanks for the reply.

This is what i get:

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:

internal_port = 5000
1 Like

Thanks Rubys!

Local only deployment works now.