volume is not attached to vm

I followed this document and created volume with fly volumes create -a redishttp db.

fly vol list command gives me this output

ID                      STATE   NAME    SIZE    REGION  ZONE    ENCRYPTED       ATTACHED VM     CREATED AT
vol_e628r6gxywqvwmnp    created db      3GB     lhr     59c1    true                            24 minutes ago

I can also see volume on volumes section in web UI. However when I build and deploy with following fyl.toml file I am getting an error.

app = "redishttp"
primary_region = "lhr"

[build]
 dockerfile = "Dockerfile"
 ignorefile = ".dockerignore"

[mounts]
  source="db"
  destination="/mnt/db"

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = true
  auto_start_machines = true
  min_machines_running = 0

and error I am getting is

Process group 'app' needs volumes with name 'db' to fullfill mounts defined in fly.toml; Run `fly volume create db -r REGION` for the following regions and counts: lhr=1

I restarted my machine and when I issue fly vol list I don’t see anything under ATTACHED VM.

Can anyone assist me please?

Hi @user12345

You can find more 'how-to" info about adding volumes here: Add Volume Storage · Fly Docs

When you run fly deploy it’s creating 2 Machines (VMs) by default, which means it’s looking for 1 more volume to attach to the second Machine. You can create another volume and it will deploy successfully, but volumes don’t sync automatically, so your app would have to make that happen.

If you only want one Machine with an attached volume, then deploy with:

fly deploy --ha=false

Note: If you’ve deployed successfully before adding the volume, then you might need to destroy one of the Machines before deploying. Run fly status to see how many machines your app has. You can scale down to 1 machine using fly scale count 1.

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