Persistence through Fly Volumes | Elixir, Phoenix

Hi,

So i am sitting in a situation where i want to test an application I have, its written in Erlang/Elixir with Phoenix (mainly for routing and the MVC approach to data) - Currently I am still looking at the backend options to persist, I opted for Erlang’s DETS for now as it is built in but my question now with deployments.

Should I use volumes and just mount the path to where the files will be stored and every deploy, Fly will persist the data that it will know and not nuke the data when new images are deployed?

Currently I just want to see if it works well and as time goes on, ill probably use one of the rational databases or at least one with better support once i move my focus to that side of the application. For me now, data persistence so i can test other parts of the application hosted is the first check i would like to get out.

Thank you

Hi there

That’s correct, if you need your data to be persisted, you should use volumes. Deploying new images won’t delete the volume’s data.

But it is extremely easy to get a Phoenix app working with Postgres on Fly. fly launch will take care of most things, might be even easier than using DETS.

I mainly used out of having it around without anything extra but this has been in the back of my mind so i actually might use a weekend to get Postgres in.

Thank you

1 Like

Just to get clarity, i took a few min just to get this out the way but to help others. I managed to get it running, i had some weird CI issues initially because i never created the volume before it tried deploying. So after that and making the directory point to a directory the app i made would use for DETS i.e change it to be relative to where it is hosted on the box (knowing the app lives in /app/bin/ and i made the data live in the same directory) - this was all i had to be mindful of in the .toml file for the path.

It would be cool if there is some way we can have the .toml file pull from a directory set in a system env variable, it felt hard coded but all in all, this will be a part of the system i am planning to change to use Postgress mainly because the support and community as well as some built in schema validation with change sets that i wont need to manually create seems to make more sense.

Hope this helps others that stumbles across this if relevant to them