Building version 0.1
rebar compile
rebar generate
mv rel/dummy rel/dummy_0.1
rebar clean
# start the release:
cd rel/dummy_0.1
bin/dummy console
erl> dummy_server:get_state().
erl> dummy_server:set_state(123).
erl> dummy_server:get_state().
Building version 0.2
# Now, in another terminal we prepare an upgrade..
# change release version numbers from 0.1 to 0.2 in
$EDITOR apps/dummy/src/dummy.app.src
$EDITOR rel/reltool.config
rebar compile
rebar generate
rebar generate-appups previous_release=dummy_0.1
rebar generate-upgrade previous_release=dummy_0.1
# Examine contents of upgrade package if you wish:
tar -zvtf rel/dummy_0.2.tar.gz
Deploying with release_handler
mv rel/dummy_0.2.tar.gz rel/dummy_0.1/releases/
# Now use release_handler in the running erlang console for the deploy:
erl> release_handler:unpack_release("dummy_0.2").
erl> release_handler:install_release("0.2").
erl> release_handler:make_permanent("0.2").
erl> release_handler:which_releases().
erl> dummy_server:get_state().
前面步骤转载自github
如果erl> release_handler:install_release("当前发布的版本号").出错,错误信息为{error,{no_matching_relup, 当前发布版本版本号 , 正在运行的版本版本号 }}。
需要将
正在运行的版本版本号下的releases/当前发布版本的版本号目录下的relup修改。
错误格式
{"当前发布版本号",
[{"正在运行版本号之前的版本号",[],
[{load_object_code,{obdserver,"当前发布版本号",
[carstate,getgpspos_handler,icar_protocol,
icarcal_handler,mongo_service,tools]}},
point_of_no_return,
。。。。。。
[{"正在运行版本号之前的版本号",[],[point_of_no_return]}]}.
正确格式
{"当前发布版本号",
[{"正在运行版本号",[],
[{load_object_code,{obdserver,"当前发布版本号",
[carstate,getgpspos_handler,icar_protocol,
icarcal_handler,mongo_service,tools]}},
point_of_no_return,
。。。。。。
[{"正在运行版本号",[],[point_of_no_return]}]}.