bug: Machines fly.dev domain no longer getting proxied after `fly deploy`

I’ve created a Machine following Run Machines with flyctl · Fly Docs and deployed a web app that is listening on port 8080.

When I assemble a fly.toml that matches the config of the Machine and run fly deploy the fly proxy no longer finds Machines to route myapp.fly.dev requests to and won’t autostart the VM.
Note that using the dedicated IPv4 and custom domains for the Appv2 still works and launches the VM as expected, but not the https fly.dev domain. I tried it two times and on the first app I’m not even able to do the recovery as described below.

"config": {
    "init": {},
    "image": "registry.fly.io/myapp:deployment-01GV2JENMMA2GG8DSVFV258EQA",
    "metadata": {
      "fly_platform_version": "v2",
      "fly_process_group": "app",
      "fly_release_id": "RGb7R06QQkobJSkeVVX28p849",
      "fly_release_version": "1"
    },
    "restart": {},
    "services": [
      {
        "protocol": "tcp",
        "internal_port": 8080,
        "ports": [
          {
            "port": 433,
            "handlers": [
              "tls",
              "http"
            ]
          }
        ]
      },
      {
        "protocol": "tcp",
        "internal_port": 8080,
        "ports": [
          {
            "port": 80,
            "handlers": [
              "http"
            ]
          }
        ]
      }
    ],
    "guest": {
      "cpu_kind": "shared",
      "cpus": 1,
      "memory_mb": 256
    }
  }

converted to fly.toml

app = "myapp"
kill_signal = "SIGINT"
kill_timeout = 300
processes = []

[[services]]
    internal_port = 8080
    protocol = "tcp"
    [[services.ports]]
        handlers = [ "tls", "http"]
        port = 433

[[services]]
    internal_port = 8080
    protocol = "tcp"
    [[services.ports]]
        handlers = ["http"]
        port = 80

After fly deploy =

I found to recover proxying to the VM you can apply the Machine config again manually via API (Machines API · Fly Docs).

curl -i -X POST -H "Authorization: Bearer ${FLY_API_TOKEN}" -H "Content-Type: application/json" "http://${FLY_API_HOSTNAME}/v1/apps/myapp/machines/e784e2d6c2d983" -d "$(cat workingconfig.json)"

I know Machines are WIP territory, I’m just making you aware of it as it was very confusing to me switching from my existing fly.toml to using Machines. There are no warnings that fly deploy with a fly.toml on Machines/Apps v2 will break proxying.

I’ll drop fly.toml and use Machines API calls directly from now on.

You’ve specified two different [[services]] blocks here but they’re using the same internal port. Try

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

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

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

Is this a typo? It would need to be port = 443 to work on https by default. What you have might make https://example.com:433 work though.

1 Like

Thank you, sometimes we miss the most obvious typo until somebody else looks at the problem. :slight_smile:

1 Like

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