Open Multiple Ports

How to open multiple ports? Or maybe a range of ports so that I can run multiple processes in a single VM and access it publicly?

Check out this part of the fly.toml. That file lists the internal and external ports, and protocol, tcp or udp:

1 Like

@greg

I’ve seen it but what’s the syntax for multiple ports? Should I write service section for every port I want to open?

Er, I haven’t used a port range before so can’t answer that. But for multiple ports, yep, you could do it like this (for a web app):

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

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

It may be worth you looking through their example apps to find one that matches what you are trying to do. Take a look at: Fly.io Apps · GitHub

I have a similar question. Would it be possible to programmatically open ports on demand from the running app instance using a fly.io api?