New commands: `fly consul attach` and `fly consul detach`

flyct 0.0.537 was just released and includes two new commands:

fly consul attach will provision a Consul cluster and set a FLY_CONSUL_URL secret in your app.

fly consul detach will remove the FLY_CONSUL_URL secret from your app.

This simplifies the workflow when a Consul cluster is needed. For example, we were able to simplify our LiteFS Lease Configuration instructions with this command.

These new commands replace fly.toml experimental enable_consul field. That field is not supported in apps v2. We recommend using fly consul attach and fly consul detach going forward.

Give these a try and let us know if you run into any issues!

9 Likes

Is this multi-tenant or dedicated cluster?
Will there be a cost?

This is backed by the same multitenant consul clusters that back our pg offerings. There are currently no costs for using our multitenant consul clusters.

4 Likes

Check out the announcement Sneak peak: global lock service post for the details on how this Consul service works.

So I had enabled the consul cluster via graphql and then hardcoded the url into the litefs config file.

Do I need to future-proof this by swapping over to the cli method, which appears to add it as a secret in vault?

The only reason I can think of needing to do this is in case there is some internal migration. Or is this url never going to change?

I don’t foresee a situation where the Consul url will change. That would break a lot of workloads.

You don’t need to change anything. Your setup will continue working as-is.

If you would like to migrate to this newer setup, which is optional:

You can safely urn fly consul attach on your litefs application. That will use the existing Consul url and set the FLY_CONSUL_URL secret for you. Then you would need to update your litefs config to use the secret:

  consul:
    url: "${FLY_CONSUL_URL}"
1 Like