How can I add a named private network to an app after the app is already created?

Introduction

I have three separate apps within a single org, which are called web, distributor, browser. I plan to communicate like so via HTTP:

  • internet → web (Fly Proxy to distribute requests over web instances at the app level)
  • web → distributor; private flycast (app level)
  • distributor → browser; private network (machine level)

Since they are part of the same system, I wonder in retrospect whether I should have made them all part of one app. But they’re separate repos now, and I’m not minded to merge them. I intend to press on in my current direction.

I plan to have two web instances, and the normal Fly Proxy will apply here, to obtain round-robin load distribution. I will also have two distributor instances, and these will be accessed privately. These will also be redundant running copies; I believe the networking here is called Flycast, and it will do the private version of Fly Proxy.

Finally the last leg of the network is at the machine level, and since these will be ephemeral, no redundancy is required here. This bit seems to work over the default private network.

Problem

A Flycast connection from web → distributor works via ping but not via curl. I think what would solve it is if I added web and distributor to the same private network, like so:

flyctl ips allocate-v6 --network sequoia-net --private

However if I run that, I get an error:

Error: Could not find Network

Now I realise I can attach a named network to the two apps, but the apps already exist and I don’t want to take them down:

flyctl app create --network sequoia-net

Can I add that network name to two existing apps? Or is there a way to create a network independently of app creation/updating?

Ah, this is interesting. I was expecting distributor to be available via curl http://sequoia-distributor.flycast, with the listener configured for IPv4. But I have stumbled on a solution that does not need a custom network.

If distributor listens in IPv6, in web I can use curl http://sequoia-distributor.internal, and that works fine. In the Private Networking doc it says of this DNS type:

6PN addresses of all Machines in any region for the app

That sounds like it will do round-robin for the machines for the app, across a private network, which is what I want. I wonder if I got fixated on Flycast as the solution without realising an ordinary private network is fine for my needs.

the --network flag there is for using with custom private networks. in this case, just skip adding the flag to the fly ips allocate-v6 --private command and it’ll work fine.

1 Like

Thanks @lillian. It seems that I can use app.internal even without allocating anything.

Out of curiosity, if I did want to add an app retrospectively to a private network, can it be done? If someone has an app and wants to add it to a private network, they may not want to delete the app just so they can add --network to the app creation command.

it’s not possible to change the network an app is in after it’s created, no.

1 Like

Perfect, thank you Lillian. I don’t have an immediate need for it, but maybe it could an item for the future feature-list.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.