[erlang-questions] Keeping application configuration parameters after installing new release
Johan van der Vleuten
Tue Dec 6 14:52:59 CET 2016
I am fairly new to Erlang, so reading a lot of docs and trying out lots of
new things. The problem I am now facing and cannot get an elegant solution
for is the following:
When I upgrade a release, containing an application which has set
application parameters using 'application:set_env/3', they are disgarded
after having called 'release_handler:install_release/1'.
This is described in the manual here:
This means that parameter values set in the other system configuration
> files and values set using application:set_env/3 are disregarded.
> When an installed release is made permanent, the system process init is
> set to point out the new sys.config.
The application using application:set_env/3 in this case is riak_core,
which I have as a dependency. I circumnavigate this by including the old
sys.config in the release (which has been generated by cuttlefish before)
and then calling a function inside riak_core that re-appends the remaining
application parameters they made earlier with 'application:set_env/3'
calls. I include this function call in my relup file.
However, this does not seem like an elegant solution to my problem. Is
there another way to *not* discard the application parameters at all during
an upgrade of a new release? How to use the same parameters currently in
the running release?
If I don't include a sys.config in the release folder ($ROOT/Releases/VSN),
all system config and application parameters are cleared. I have checked
this myself, unless I am doing something very wrong.
I could also extract all current application's parameters using
application:get_all_env/1 for every app running, before releasing, and put
those in the new sys.config file.
Could not find this problem or a solution in the mailing list before or on
any other site. Maybe I am doing something wrong with my releases and
upgrading them in general... Any other ideas or people facing this problem?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions