How do I scale my app (with a volume) to multiple instances?

I just migrated my app kcd to the V2 platform and now I’m trying to scale things up. I read that fly scale count doesn’t yet work for apps with volumes and that I should use fly machine clone, but then that says that it creates a volume for you if the machine you’re cloning has one, but that:

It’s up to you to decide what to put on the new volume; fly machine clone will not automatically copy the contents of the original Machine’s volume.

This has me scratching my head. I have no idea how to do this. I think I don’t need to put anything in there because I’m using LiteFS which should handle that, but I don’t want to do anything until I’m sure. It’s definitely more work than I want it to be here. Can someone give me direction?

Honestly, I never really liked that with v1 you had to create volumes and then scale up. I would much rather a command that “does it all” with something like:

fly instance add --region ams

And it takes care of creating any necessary volumes etc. That would make the most sense to me.

1 Like

Hi @kentcdodds

Scaling in in v2 apps should be roughly the same process. Create the volumes first then use the scale command.

But it doesn’t work that way as I said

What’s the error you’re getting?

I’m pretty sure that I had all this working last month :slight_smile:

If I recall correctly, all I had to do was to ensure that I did not run migrations on the second instance.

@charsleysa and @rubys, here’s what happens when I try to run fly scale count 2 on kcd which is a v2 app with a volume and LiteFS:

~/code/ (main) 🤠
$ fly scale count 2
App 'kcd' is going to be scaled according to this plan:
  +1 machines for group 'app' on region 'den' with size 'shared-cpu-1x'
Error: 'fly scale count' can't scale up groups with mounts, use 'fly machine clone' to add machines for: app

That’s what I did. I’m confident that scale with volumes will be supported at some point, but for now, clone the machine and litefs will populate the empty volume.

That worked for me. Thanks!

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