From: Roberto S. <rs...@gm...> - 2006-07-31 20:16:25
|
In the past and with various frameworks / languages, the steps for deploying an app on a production machine for me looks always something like that ? stop web server (or app server) create new app root directory install the new release (the complete app) into the new app root directory update database if necessary move symbolic link to new to the new app root directory start web server (or app server) (In RubyOnRails all these steps can even be automated, including checkout from Subversion) But now with Erlang and yaws we have hot code swap and there is no need to shut down the server. So has anybody experience or suggestions for a good way to deploy a yaws app so it runs without interruption while updating, but still having a quick-access fallback solution in case something goes wrong with the update ? regards -- Roberto Saccon |
From: Michael M. <ya...@au...> - 2006-07-31 20:53:33
|
I imagine there are different ways of structuring yaws applications and doing hot upgrades. Here is how I have done it ... in yaws.conf (amongst other things) id = yaws runmod = expmaster runmod = expcache runmod = dbexp runmod = filewatch runmod = autosys_alarm and then, for example, if I have an updated module (dbexp) to drop into the ebin_dir, ... yaws -I dbexp -load yaws NOTICE that the arguments for -I and -load are reversed. I am not sure if you still need to do that with latest yaws. If there are problems with the new module, drop old module in ebin_dir and -load again. Of course, all the new and old modules need to be compatible! ~M On Mon, Jul 31, 2006 at 05:16:23PM -0300, Roberto Saccon wrote: > In the past and with various frameworks / languages, the steps for > deploying an app on a production machine for me looks always something > like that ? > > stop web server (or app server) > create new app root directory > install the new release (the complete app) into the new app root directory > update database if necessary > move symbolic link to new to the new app root directory > start web server (or app server) > > (In RubyOnRails all these steps can even be automated, including > checkout from Subversion) > > But now with Erlang and yaws we have hot code swap and there is no > need to shut down the server. So has anybody experience or suggestions > for a good way to deploy a yaws app so it runs without interruption > while updating, but still having a quick-access fallback solution in > case something goes wrong with the update ? > > regards > -- > Roberto Saccon > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Erlyaws-list mailing list > Erl...@li... > https://lists.sourceforge.net/lists/listinfo/erlyaws-list -- Michael McDaniel Portland, Oregon, USA http://autosys.us +1 503 283 5284 |
From: Mikael K. <mik...@cr...> - 2006-08-01 08:46:08
|
As you say Erlang/OTP provide a framework for hot upgrade, so the remaining= =20 problem is actually to be able to deploy Erlang/OTP applications=20 independently of each other into a running Yaws server. I have been working on this - see earlier posting: http://sourceforge.net/mailarchive/message.php?msg_id=3D20040414 I hope I can check in something into the Yaws applications directory later= =20 this month. Regards Mikael m=E5ndag 31 juli 2006 22:16 skrev Roberto Saccon: > In the past and with various frameworks / languages, the steps for > deploying an app on a production machine for me looks always something > like that ? > > stop web server (or app server) > create new app root directory > install the new release (the complete app) into the new app root directory > update database if necessary > move symbolic link to new to the new app root directory > start web server (or app server) > > (In RubyOnRails all these steps can even be automated, including > checkout from Subversion) > > But now with Erlang and yaws we have hot code swap and there is no > need to shut down the server. So has anybody experience or suggestions > for a good way to deploy a yaws app so it runs without interruption > while updating, but still having a quick-access fallback solution in > case something goes wrong with the update ? > > regards > --=20 > Roberto Saccon |
From: Torbjorn T. <to...@to...> - 2006-08-02 07:11:34
|
I think I have shown this before on this list, anyway... Here is a nice way of upgrading your system. What you do is to compile your Erlang code, then point a Web-browser to http://...../lm.yaws, and you're done. 1. Create a file: lm.yaws ----------------------------- <erl> out(A) -> mymod:lm(), {redirect, ["/index.yaws"]}. </erl> ------------------------------ 2. Put the following code in a module (e.g: mymod.erl) ------------------------------ lm() -> [c:l(M) || M <- mm()]. mm() -> modified_modules(). modified_modules() -> [M || {M, _} <- code:all_loaded(), module_modified(M) == true]. module_modified(Module) -> case code:is_loaded(Module) of {file, preloaded} -> false; {file, Path} -> CompileOpts = proplists:get_value(compile, Module:module_info()), CompileTime = proplists:get_value(time, CompileOpts), Src = proplists:get_value(source, CompileOpts), module_modified(Path, CompileTime, Src); _ -> false end. module_modified(Path, PrevCompileTime, PrevSrc) -> case find_module_file(Path) of false -> false; ModPath -> case beam_lib:chunks(ModPath, ["CInf"]) of {ok, {_, [{_, CB}]}} -> CompileOpts = binary_to_term(CB), CompileTime = proplists:get_value(time, CompileOpts), Src = proplists:get_value(source, CompileOpts), not (CompileTime == PrevCompileTime) and (Src == PrevSrc); _ -> false end end. find_module_file(Path) -> case file:read_file_info(Path) of {ok, _} -> Path; _ -> %% may be the path was changed? case code:where_is_file(filename:basename(Path)) of non_existing -> false; NewPath -> NewPath end end. ------------------------------------------- Cheers, Tobbe Roberto Saccon wrote: > In the past and with various frameworks / languages, the steps for > deploying an app on a production machine for me looks always something > like that ? > > stop web server (or app server) > create new app root directory > install the new release (the complete app) into the new app root directory > update database if necessary > move symbolic link to new to the new app root directory > start web server (or app server) > > (In RubyOnRails all these steps can even be automated, including > checkout from Subversion) > > But now with Erlang and yaws we have hot code swap and there is no > need to shut down the server. So has anybody experience or suggestions > for a good way to deploy a yaws app so it runs without interruption > while updating, but still having a quick-access fallback solution in > case something goes wrong with the update ? > > regards |
From: Roberto S. <rs...@gm...> - 2006-08-02 07:40:44
|
Tobbe, great stuff, thanks, that's seems to do the trick ... regards Roberto On 8/2/06, Torbjorn Tornkvist <to...@to...> wrote: > > I think I have shown this before on this list, anyway... > > Here is a nice way of upgrading your system. > What you do is to compile your Erlang code, > then point a Web-browser to http://...../lm.yaws, > and you're done. > > 1. Create a file: lm.yaws > ----------------------------- > <erl> > out(A) -> > mymod:lm(), > {redirect, ["/index.yaws"]}. > > </erl> > ------------------------------ > > 2. Put the following code in a module (e.g: mymod.erl) > ------------------------------ > lm() -> > [c:l(M) || M <- mm()]. > > mm() -> > modified_modules(). > > modified_modules() -> > [M || {M, _} <- code:all_loaded(), module_modified(M) == true]. > > module_modified(Module) -> > case code:is_loaded(Module) of > {file, preloaded} -> > false; > {file, Path} -> > CompileOpts = proplists:get_value(compile, > Module:module_info()), > CompileTime = proplists:get_value(time, CompileOpts), > Src = proplists:get_value(source, CompileOpts), > module_modified(Path, CompileTime, Src); > _ -> > false > end. > > module_modified(Path, PrevCompileTime, PrevSrc) -> > case find_module_file(Path) of > false -> > false; > ModPath -> > case beam_lib:chunks(ModPath, ["CInf"]) of > {ok, {_, [{_, CB}]}} -> > CompileOpts = binary_to_term(CB), > CompileTime = proplists:get_value(time, CompileOpts), > Src = proplists:get_value(source, CompileOpts), > not (CompileTime == PrevCompileTime) and (Src == > PrevSrc); > _ -> > false > end > end. > > find_module_file(Path) -> > case file:read_file_info(Path) of > {ok, _} -> > Path; > _ -> > %% may be the path was changed? > case code:where_is_file(filename:basename(Path)) of > non_existing -> > false; > NewPath -> > NewPath > end > end. > ------------------------------------------- > > > Cheers, Tobbe > > > Roberto Saccon wrote: > > In the past and with various frameworks / languages, the steps for > > deploying an app on a production machine for me looks always something > > like that ? > > > > stop web server (or app server) > > create new app root directory > > install the new release (the complete app) into the new app root directory > > update database if necessary > > move symbolic link to new to the new app root directory > > start web server (or app server) > > > > (In RubyOnRails all these steps can even be automated, including > > checkout from Subversion) > > > > But now with Erlang and yaws we have hot code swap and there is no > > need to shut down the server. So has anybody experience or suggestions > > for a good way to deploy a yaws app so it runs without interruption > > while updating, but still having a quick-access fallback solution in > > case something goes wrong with the update ? > > > > regards > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Erlyaws-list mailing list > Erl...@li... > https://lists.sourceforge.net/lists/listinfo/erlyaws-list > -- Roberto Saccon |