superfly / flyctl

Command line tools for fly.io services
https://fly.io
Apache License 2.0
1.43k stars 240 forks source link

Deployment silently fails with malformed fly.toml #1635

Open Plecra opened 1 year ago

Plecra commented 1 year ago

Describe the bug With a duplicated service (I'm guessing it's the overlapping port?), deployment fails with a HTTP 504 and no details.

# fly.toml file generated for reddit-assist on 2023-01-27T13:19:32Z

app = "reddit-assist"
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"

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
[build]
  builder = "paketobuildpacks/builder:base"
  buildpacks = ["docker.io/paketocommunity/rust"]

[mounts]
source = "reddit_assist_store"
destination = "/data"
tvdfly commented 1 year ago

Thanks for reporting this issue! flyctl should give a better error message in that case.

And you are correct, services need to have unique internal_port. Removing the second duplicate [[services]] block should fix the issue.

redjonzaci commented 1 year ago

@tvdfly how should we proceed with this issue?

dangra commented 1 year ago

@redjonzaci look at internal/appconfig/validation.go

redjonzaci commented 1 year ago

What I was able to undestand is that I should return a validation error if 2 services have the same internal_port. Is that correct?

dangra commented 1 year ago

kind of, it may need to take protocol and processes into account. go for it and see what makes sense.

redjonzaci commented 1 year ago

I tested with the fly.toml that @Plecra has provided. 🚀