If you follow the steps documented in Add volume storage · Fly Docs, then it should work.
In summary, execute these steps in this exact order:
- Launch app without deploying:
fly launch
- Add mounts entry to fly.toml;
[mounts] source="memos_data" destination="/var/opt/memos"
- Deploy app:
fly deploy
A volume with the name you specified, will be created and attached to your app.
I still didn’t understand why trying to attach the volume after the app is deployed do not work. This is what @kentcdodds does here: Persist Application Data Between Deployments | Epic Web Dev by Kent C. Dodds and it worked for him.
I found another related post here that might help if you want to attach a volume to a running app. I did not dig into that, nor tried to reproduce, but here it is:
Cheers!