Can't have http on port 2201 with other ports

Hello. I’m trying to configure an app but it’s impossible. I’ve read the documentation and the examples but nothing helps.

My app should be deployed and accessible on the port 2201 and HTTP (No https for now), and internally, it will make a call to another external api on the port 2101 (different port) HTTP

Here’s the relevant dockerfile portion:

and here’s the relevant part of my current fly.toml (I say current, because I’ve been changing this for hours):


primary_region = ***
app = ***

[build]

[http_service]

internal_port = 2201

force_https=false
auto_stop_machines = "suspend"
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
memory = '256mb'
cpu_kind= 'shared'
cpus = 1

but it’s not accesible via curl, python requests… anything
Could you guys assist me with this?

Best,

What you want is a [[services]] section. See: App configuration (fly.toml) · Fly Docs

Each service is a map of an internal port to a (possibly different) external port.

Since http services running on ports 80 and 443 is a common use case, there is a special syntax for that case, but since that case doesn’t apply here, you will need to use the more general syntax.

Thanks for responding.
Would you be so kind as to provide an example? @rubys
that’s my current, and it’s not working

primary_region = '***'
app = '***'

[build]

[[services]]
  internal_port = 2201
  protocol = "tcp"
  auto_stop_machines = "suspend"
  auto_start_machines = true
  min_machines_running = 0
  [[services.ports]]
    handlers = ["http"]
    start_port = 2201
    end_port = 2201
    force_https = false

[[services]]
  internal_port = 2101
  protocol = "tcp"
  auto_stop_machines = "suspend"
  auto_start_machines = true
  min_machines_running = 0
  [[services.ports]]
    start_port = 2101
    end_port = 2101
    handlers = ["http"]
    force_https = false

[[vm]]
  memory = '256mb'
  cpu_kind = 'shared'
  cpus = 1
  processes = ["app"]

I had to add start_port and end_port because of this known fly.io bug

I just used a simple AWS EC2 with the same docker image and it worked fine, so, it’s not a problem with my firewall, my setup or my code

Only define services in your fly.toml that you want externally visible.

Are you using a dedicated ipv4 address (see: Public Network Services · Fly Docs). Shared ipv4 (the default for new applications) only works for ports 80 and 443.