Deploying Failing due to unhealthy allocations

I get these error when deploying

==> Monitoring deployment

 1 desired, 1 placed, 0 healthy, 0 unhealthy [health checks: 1 total, 1
 1 desired, 1 placed, 0 healthy, 1 unhealthy [health checks: 1 total, 1
 1 desired, 1 placed, 0 healthy, 1 unhealthy [health checks: 1 total, 1 critical]
Failed Instances

Failure #1

Instance
ID              PROCESS VERSION REGION  DESIRED STATUS  HEALTH CHECKS          RESTARTS        CREATED  
c5e3cd8a        app     8       cdg     stop    running 1 total, 1 critical    0               5m3s ago

Recent Events
TIMESTAMP               TYPE            MESSAGE                                                  
2022-12-01T15:03:36Z    Received        Task received by client                                 
2022-12-01T15:03:36Z    Task Setup      Building Task Directory                                 
2022-12-01T15:03:40Z    Started         Task started by client                                  
2022-12-01T15:08:36Z    Alloc Unhealthy Task not running for min_healthy_time of 10s by deadline
2022-12-01T15:08:37Z    Killing         Sent interrupt. Waiting 5s before force killing         

--> v8 failed - Failed due to unhealthy allocations - not rolling back to stable job version 8 as current job has same specification and deploying as v9 

I think i have some error in the fly.toml file, cause the actual code I’m trying to deploy runs without errors

Here’s my .toml file

# fly.toml file generated for black-wind-8440 on 2022-11-30T11:16:41+04:00

app = "black-wind-8440"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]

[experimental]
  allowed_public_ports = []
  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"

Any help will be appreciated
Thank you for your time :heart_eyes:

Okay so i resolved this by adding PORT=8080 under [env] in the fly.toml file and adding EXPOSE 8080 to the end of the Dockerfile.
Hope this helps someone in future :heart:

3 Likes

I had a similar issue and this worked. Thanks!

1 Like