Allocating IPv4 address

I’ve a gRPC service that I’m returning to Fly after a brief hiatus.

I’m now deploying it using the v2 (machines) API.

Fly (correctly) prompts for the addition of IP addresses during deploy’ment:

${FLYCTL} deploy --app=${APP}
==> Verifying app config
Validating /fly.toml
Platform: machines
✓ Configuration is valid
--> Verified app config
==> Building image
Searching for image 'registry.fly.io/[REDACTED]' remotely...
image found: img_8rlxp2gozo043jqo

Watch your app at https://fly.io/apps/{app}/monitoring

? Would you like to allocate dedicated ipv4 and ipv6 addresses now?

If I “Yes” the prompt, the two IPs are added and the app works correctly.

There is no flag on the deploy command that appears to correspond to this behavior.

I could --yes but I would prefer to allocate only an IPv4 and have no need for the IPv6 address.

This App config doesn’t appear to support this configuration (I would expect it to).

I tried deploy then ips allocate-v4 and this doesn’t work.

The alternative (below) is a little overwrought but works:

flyctl app create ${APP}
flyctl ips allocate-v4 --app=${APP}
flyctl app deploy --app=${APP}

Proposal:

  1. Add IPv4|v6 configuration to App config
  2. Add flag(s) to deploy to control this behavior.

To be clear, you are looking for a deployment flag that allocates only an ipv4 address?
Why do you only need an ipv4 address though? ipv6 address are free by the way.

I (would) like the flexibility of being able to assign an IPv4 only.

My Internet provider doesn’t support IPv6 and I think that the other cloud services I’m using that would originate traffic to Fly are IPv4 only too.

I’m struggling to understand the rationale behind config smeared across App config and CLI flags. Ideally, I’d like to define an app entirely in the config.

Absent that and in this example, I’d like to be able deploy in one step (preferably using config only) but with a deployment flag to programmatically avoid the “allocate dedicated … addresses?” prompt.

It looks as though you’ve achieved what you were after, but for what it’s worth,

fly launch --no-public-ips
fly ips allocate-v4

worked for me just now. I did have to wait on the order of a minute for connectivity via the .fly.dev hostname to appear after provisioning the IP.

This looks like a job for Terraform. :slight_smile:

As a general pattern, provisioning of resources for an app is done explicitly using flyctl commands, and fly.toml holds a more portable config that you could give to someone else to deploy the same Docker image, and which is short enough to be easily read by a human. It’s true that there’s not a perfect separation, but there is a rationale.

3 Likes

Thank you!

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