Unable to deploy application: error connecting to the Fly API

Hi!

I’ve been trying to deploy an Anycast DNS resolver, but I consistently get errors during flyctl deploy. The app listens on port 53, which may possibly be an issue.

The IDs provided by flyctl are:

01GBQHHY473Q2V6ZN2JRTRZD9P-cdg
01GBQGNJ5EXW9EAAHZK71RRK0Z-mad
01GBQGDH68XJE312CFAYBAFTTZ-mad

My application’s config is:

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

[env]

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  port = 53
  protocol = "udp"

[[services]]
  port = 53
  protocol = "tcp"

[[services]]
  http_checks = []
  internal_port = 8081
  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"

Thanks in advance!

Figured it out: apparently the load balancer does not support listening to all ports. I dropped the services which use port 53 and added it to allowed_public_ports instead. Seems to deploy fine now!

Strange.

If you want to listen on TCP/UDP port 53, app’s configuration should have looked like this instead:

- [[services]]
-  port = 53
-  protocol = "udp"

- [[services]]
-  port = 53
-  protocol = "tcp"

- The rest of the services block, iff you don't need the web-server operating on 8081 
- [services]

+ [[services]]
+  internal_port = 8081 # port your dns process is listening on for tcp
+  protocol = "tcp"

  [services.concurrency] # reset these as approp
    hard_limit = 25
    soft_limit = 20
    type = "connections"

+  [[services.ports]]
+    port = "53" # external / public tcp port on Fly's load balancer

+ [[services]]
+  internal_port = 53 # port your dns process is listening on for udp, must be same as external / public port in udp's case
+  protocol = "udp"

  [services.concurrency] # reset these, though unsure what they really mean for udp
    hard_limit = 25
    soft_limit = 20
    type = "connections"

+  [[services.ports]]
+    port = "53" # external / public udp port on Fly's load balancer

UDP is tricky, but this doc is very handy and here’s a toy tcp+udp echo service we wrote.

2 Likes