[erlang-questions] Is priv a good place to store data?

Richard Carlsson <>
Thu Jan 14 00:03:45 CET 2016

The priv directory was never intended for dynamic data, only for static
files that are shipped with the release. Although some people put dynamic
data under priv (and I've done it myself back before I knew the proper ways
of OTP), it's a mistake that tends to come back and bite you one way or
another, screwing up release handling, making backups more complicated, etc.

Preferably, you should be able to wipe out the entire directory where all
your apps are installed, reinstall the code, and restart the system,
without losing any live data or configuration files.


2016-01-13 20:38 GMT+01:00 Jesper Louis Andersen <

> On Wed, Jan 13, 2016 at 8:16 PM, Lyn Headley <> wrote:
>> I am building an app which will need to store some data in files. I am
>> wondering if others use the priv directory for this, or whether they
>> use another place, perhaps somewhere outside of the application tree
>> entirely.
> From experience: keep the static artifact away from the dynamic data
> whenever you can. It makes software upgrades much simpler since you can
> install another artifact next to the one you already have, move a symbolic
> link, and run it against the data, kept separate. It simplifies
> partitioning, it simplifies backup, and you can lock down writing to the
> tree for the user running your release.
> So my usual solution is: use priv for read-only data the given application
> is using, and use the application configuration environment to pick up the
> storage area for dynamic data.
> --
> J.
> _______________________________________________
> erlang-questions mailing list
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160114/446fcd9b/attachment.html>

More information about the erlang-questions mailing list