Error: volume already claimed. Litefs, consul with bluegreen strategy

Hi,

I’m trying to set up litefs for the first time.

I’m stuck at attaching consul where it looks to me the app and consul is trying to claim the same volume?

litefs.yml

fuse:
  dir: "${LITEFS_DIR}"

data:
  dir: "/data/sqlite"

lease:
  # Use Consul for distributed lease management
  type: "consul"
  # Consul server address (provided by Fly.io)
  consul:
    url: "${FLY_CONSUL_URL}"
    # Key prefix in Consul KV store - use the same key across all nodes
    key: "litefs/my-db"
  candidate: true
  # The hostname to advertise to other nodes
  advertise-url: "http://${FLY_APP_NAME}.internal:20202"

exec:
  - cmd: "path-to-binary"

#fly.toml

[mounts]
  source = "my_volume"
  destination = "/data"

[env]
  LITEFS_DIR = "/data/litefs"

I tried

  1. fly volumes create
  2. deploy with the new fly.toml (mounting persistent volume)
  3. fly consul attach
Error: failed to launch VM: failed_precondition: volume already claimed by machine {current_app_blue_machine}

So I tried to scale down to 0 then run consul

  1. fly consul attach
  2. fly deploy
Error: failed to launch VM: failed_precondition: volume already claimed by machine {current_app_blue_machine}

The issue may be related to bluegreen strategy and persistent volume rather then litefs and consul I’m not sure.

Right, unfortunately those two are incompatible, :cactus::

The bluegreen strategy cannot be used for Machines with attached volumes.

Generally, this is geared toward apps that use a separate Postgres database (or that’s my inference, anyway).

rolling and immediate are the only possibilities when your app has persistent volumes.

LiteFS itself takes a little head-scratching at first, but it’s typically really solid after the initial acclimation period.

Hope this helps!

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