Announcement: Shared Anycast IPv4

Interesting. What about existing apps (apps created before this announcement) with one public IPv4 assigned? I am guessing $2/mo for those, too?

Someday, but with lots of heads up. We’ll send a notice and give people at least 90 days to switch to a shared IP before we start billing. Shipping shared IPs abruptly bought us a bunch of time (we have a lot of IPs, but we need them for other things!) so we can start reclaiming IPs less disruptively.

1 Like

A policy of auto reclaiming IPs from apps that have been dead for > 30/60/90 days might also be a decent way to reclaim some, though just charging for them will probably do a decent job of solving that too.

2 Likes

$2/mo is super reasonable.

For context, AWS and GCP charge $18/mo for raw TCP/UDP over Anycast IPv4s (+ a markup on egress, routing rules etc). The flip side is, AWS and GCP offer unicast IPv4s at no-cost (or, rather the cost is rolled into compute)… Still, way better than Cloudflare who charge $1/GB egress for TCP/UDP (Spectrum) over Anycast!

@carter I just saw your questions!

The officially supported way to programmatically launch apps on Fly is with the Machines API. You still need graphql for allocating IPs and volumes (for now), but the best way to do what you’re after is:

  1. Create app with machines api
  2. Allocate IPs with graphql
  3. Create machines for app with services

We probably won’t make shared IP routing more powerful. Shared IPs exist to let people try the service and run side projects without spending money.

For your current dedicated IPs, we’ll send a notice saying “we’re gonna start billing for these on X date”. Then we’ll send a few more. Then we’ll start billing for them. We won’t remove IPs from existing apps production apps.

Awesome, thanks for the reply!

Right now I’m using the graphql API to work only at the apps level and it’s been working pretty well. Is that something I should plan to change sooner than later? It sounds like machines will be the only officially supported API.

For billing, I have absolutely no problem with paying for IPs, in fact I’m glad that they’re not free because that seemed like people were always going to abuse that. Though I do appreciate the advanced warning :+1:

My real concern would be if something functionality-wise were to change out from under me without warning and break something. Particularly around the anycast IPs because at the moment Fly is pretty unique with the way you offer those and I couldn’t easily get that somewhere else. If you decided to stop offering that (say, went with shared IPs for all) I suspect a bunch of people would be scrambling pretty hard. Which is why I reacted more strongly when I woke up yesterday to this immediate change.

Machines will be the only officially supported API, yes. Right now, it’s lacking some stuff (IPs, volumes) but that should change pretty quickly.

The GraphQL API is very much caveat emptor. We built it to support our CLI. We don’t have any problem with people using it. But its behavior will definitely change. :slight_smile:

It would be really nice if the free allowance was extended to include 1 dedicated IPv4 address per organization, but I won’t hold my breath.

Off topic (and probably niche), but I would really appreciate some way to use the Machines API without setting up WireGuard VPN or installing flyctl. I really liked how the GraphQL API could be used to create an app from virtually any computer without installing anything (just need curl, or a web browser’s JavaScript console), and it would be a shame to lose that ability.*

I envision a simple public-facing proxy service that forwards requests to the Machines API endpoint on the Fly private network. The requests already include the user’s authentication token, so if the proxy requires authentication (e.g. to connect to the user’s Fly private network) it can simply peek at the request.

(Relatedly, Heroku has a web console that effectively allows a user to SSH into a dyno using just a web browser. Fly’s Code Server launcher sounds really cool, but it requires 1GB RAM which is above the free tier.)


*This approach already has limitations, e.g. remote builders can’t be accessed over the GraphQL API, but I still think it is useful.

2 Likes

I would really appreciate some way to use the Machines API without setting up WireGuard VPN or installing flyctl

I’d also love that. Not that it’s a huge deal, but requiring it is enough friction that I haven’t switched over yet. Having a VPN on prod to use an API just isn’t something I’ve had to do for any other service.

api.machines.dev not suit your needs? Fly.io Machines Proxy Timeout - #6 by ignoramous

4 Likes

Brilliant! I see it is safe to use, I hope it will be added to the docs soon.

1 Like

Good to know about! Thanks for surfacing that for me.

1 Like

I have a Golang toy app that accepts connections on a TCP port, very similar to the example below.

No matter what I tried, I couldn’t get it to work until I ran fly ips allocate-v4 and from there it started working immediately.

It’s possible that I was doing something wrong on my end trying to connect to TCP via the IPv6 address with netcat <ipv6 addr> 5000, but it’s also possible that TCP connections over IPv6 might be collateral damage to this change?

2 Likes

I can reproduce this issue. Specifically, it appears that non-standard TCP ports don’t work via IPv6 when the app also has a shared IPv4 address allocated.

Converting the shared IPv4 address to a dedicated IPv4 address causes the IPv6 address to work. Releasing the shared IPv4 address also causes the IPv6 address to work.

Steps:

$ mkdir app && cd app
$ flyctl launch --image flyio/hellofly:latest # accept defaults
# add external port 5000
$ cat >> fly.toml <<"EOF"
  [[services.ports]]
    handlers = ["http"]
    port = 5000
EOF
$ flyctl deploy

$ flyctl ips list
VERSION IP                      TYPE            REGION  CREATED AT
v6      2a09:8280:1::3:bf58     public          global  30s ago
v4      66.241.124.247          public (shared)

# test from a shell inside the app's VM
# (for reproducibility, and because the computer I'm currently using doesn't support IPv6)
$ flyctl ssh console
# apk add wget # the image includes busybox wget, but we want GNU wget
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:80 # succeeds
...
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:5000 # fails
--2022-12-30 10:43:42--  http://morning-shape-6643.fly.dev:5000/
Resolving morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)... 2a09:8280:1::3:bf58
Connecting to morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)|2a09:8280:1::3:bf58|:5000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2022-12-30 10:43:43--  (try: 2)  http://morning-shape-6643.fly.dev:5000/
Connecting to morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)|2a09:8280:1::3:bf58|:5000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2022-12-30 10:43:45--  (try: 3)  http://morning-shape-6643.fly.dev:5000/
Connecting to morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)|2a09:8280:1::3:bf58|:5000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

^C
# exit

Convert the shared IPv4 address to a dedicated IPv4 address (causes IPv6 to work):

$ flyctl ips allocate-v4
VERSION IP              TYPE    REGION  CREATED AT
v4      149.248.221.19  public  global  7s ago

$ flyctl ips list
VERSION IP                      TYPE    REGION  CREATED AT
v4      149.248.221.19          public  global  12s ago
v6      2a09:8280:1::3:bf58     public  global  2m17s ago

$ flyctl ssh console
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:80 # succeeds
...
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:5000 # succeeds
--2022-12-30 10:44:53--  http://morning-shape-6643.fly.dev:5000/
Resolving morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)... 2a09:8280:1::3:bf58
Connecting to morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)|2a09:8280:1::3:bf58|:5000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 96 [text/html]
Saving to: 'STDOUT'
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>Hello from Fly</h1>

</body>
</html>

2022-12-30 10:44:53 (13.6 MB/s) - written to stdout [96/96]

# exit

Release the (now dedicated) IPv4 address:

$ flyctl ips release 149.248.221.19
Released 149.248.221.19 from morning-shape-6643
$ flyctl ssh console
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:80 # succeeds
...
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:5000 # succeeds
...
# exit

Allocate a shared IPv4 address (causes IPv6 to fail):

$ flyctl ips allocate-v4 --shared
VERSION IP              TYPE    REGION
v4      66.241.124.67   shared  global

$ flyctl ips list
VERSION IP                      TYPE            REGION  CREATED AT
v6      2a09:8280:1::3:bf58     public          global  6m20s ago
v4      66.241.124.67           public (shared)

$ flyctl ssh console
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:80 # succeeds
...
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:5000 # fails
--2022-12-30 10:49:05--  http://morning-shape-6643.fly.dev:5000/
Resolving morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)... 2a09:8280:1::3:bf58
Connecting to morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)|2a09:8280:1::3:bf58|:5000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2022-12-30 10:49:06--  (try: 2)  http://morning-shape-6643.fly.dev:5000/
Connecting to morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)|2a09:8280:1::3:bf58|:5000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2022-12-30 10:49:08--  (try: 3)  http://morning-shape-6643.fly.dev:5000/
Connecting to morning-shape-6643.fly.dev (morning-shape-6643.fly.dev)|2a09:8280:1::3:bf58|:5000... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

^C
# exit

Release the shared IPv4 address (causes IPv6 to work):

$ flyctl ips release 66.241.124.67
Released 66.241.124.67 from morning-shape-6643
$ flyctl ssh console
# wget -O - -6 http://$FLY_APP_NAME.fly.dev:5000 # succeeds
...
# exit
2 Likes

Sorry about the weirdness with shared IPs. We’re working on better messaging from our API and outright preventing deployments when they don’t fit the criteria to avoid such confusion.

It has been ready for a few days, but I didn’t want to risk breaking anything during the holidays (since this touches deploys) when we might not have the people to fix it fast enough.

I will roll it out Monday.

1 Like

btw. The fly UI shows no IP configured, even if a shared IP v4 is set up and working. Would be helpful of you could show this correctly.

1 Like

I have deployed a change that should tell you if you can’t deploy when using shared IPs.

This hopefully will prevent a bunch of confusion with shared IPs.

1 Like

The UI should now properly display shared IPv4s.

1 Like

I’ve been deploying an app successfully for some months that I suspect is broken by this change and I’m unsure why it’s broken and how to fix it.

kill_signal = "SIGINT"
kill_timeout = 5

[build]
  image = "registry.fly.io/healthcheck-server:[[edited]]"

[experimental]
  exec = [
    "/server",
    "--failure_rate=0.5",
    "--changes_rate=15s",
    "--endpoint=:50051",
    "--services=,grpc.health.v1.Health"
  ]
  private_network = true

[[services]]
  internal_port = 50051
  protocol = "tcp"

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20

  [[services.ports]]
    handlers = ["tls"]
    tls_options = {"alpn" = ["h2"]}
    port = "443"

#[metrics]
#  port = 50051
#  path = "/metrics"

On deployment (using docker.io/flyio/flyctl:v0.0.442):

==> Verifying app config


Configuration errors in /fly.toml:

    ✘ base: Services defined at indexes: 0 require a dedicated IP address. You currently have no dedicated IPs allocated. Please allocate at least one dedicated IP before deploying (`fly ips allocate-v4` and/or `fly ips allocate-v6`). Affected services: 
  [0] tcp/443 => 50051

Error App configuration is not valid

It meets one (!?) of the requirements:

  • HTTP on port 80
  • TLS + HTTP on port 443

If I understand correctly, I should allocate an IPv4:

podman run \
[[edited]] \
docker.io/flyio/flyctl:v0.0.442 \
ips allocate-v4 --shared --app=healthcheck-server

And this succeeds (and IPv4 is assigned) but the app remains “pending”.

Questions:

  • Why isn’t my app config conformant?
  • Should I ips allocate-v4 --shared before deploying?

Thanks!

Shared IPv4s don’t work with just TLS on port 443. It needs to be both TLS+HTTP.

This would work:

[[services]]
  internal_port = 50051
  protocol = "tcp"

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20

  [[services.ports]]
    handlers = ["tls", "http"]
    tls_options = {"alpn" = ["h2"]}
    port = "443"

It sounds like you need to do HTTP yourself? If that’s the case, you’ll need to have only dedicated IPs assigned.