I have 3 questions about fly.io regions:
question 1: The docs on regions say:
The platform works out which region an application should be running in based on the incoming connection from a client. It then starts the application in that region and completes the connection.
If I have just 1 user in (say) Singapore and they connect to the application and it starts an instance in Singapore, will that instance also shut down some period after that user leaves the site? How does that work exactly? I’d like to support more regions but I want to avoid paying for a bunch of global compute that nobody is using just because one person connected from that region once.
question 2: Is there a way to find the fly.io region closest to a user’s IP? I know the
FLY_REGION environment variable contains the region that the app is running in, but I’m interested in knowing the region closest to the user even if the user is connecting from a faraway region. I’m interested in this because I launch a Fly instance for every user who connects and so I’d like to make sure that instance is close to them even if the server they initially connect to is far away.
question 3: what’s the best way to find the IPs of instances of an application in the same region? Right now my application is split into 3 parts (an nginx frontend, rails, and a go service), and if I’m running all of them in multiple regions I’d like each one to talk to the local-to-them versions of the other services. Is there a way to query for just the local versions with DNS? (like
my-service.local.internal or something?). Or would I have to query the Fly API to find out the IP of a local version of the service?