views:

62

answers:

3

I have an Erlang application that is deployed on a server with Windows Server 2008.

The way I do this:

  1. Copy application folder in Erlang lib directory.
  2. Open command line (cmd). Execute erl.
  3. Execute application:start(app_name) in Erlang shell.

Are there any better approaches to launch the application? How to make the application to launch on Windows startup?

+3  A: 

I have no experience with Windows but...

`1. First of all, you might want to have a look to the concept of release in Erlang. Essentially,

When we have written one or more applications, we might want to create a complete system consisting of these applications and a subset of the Erlang/OTP applications. This is called a release.

`2. Then, you might want to create a script that contains something like:

erl -boot ch_rel-1

Where essentially you're starting Erlang/OTP using a boot script that you created above (just follow the instructions in the releases page)

`3. This article explains how to create startup scripts in Windows Server 2008 (not tested, just googled):

http://technet.microsoft.com/en-us/magazine/dd630947.aspx

Hope this helps. Nice question.

Roberto Aloi
+1  A: 

Perhaps rebar might help. It makes building an app skeleton and release quite easy. A nice tutorial is here.

puzza007
Rebar is great. But I still would advise everyone to understand what's behind the scenes at first. Once that's clear, using an automatic tool will be very helpful.
Roberto Aloi
A: 

After getting familiar with releases, take a look at manual pages (erl -man ) for start_erl and erlsrv. I used them to start embedded system ( http://www.erlang.org/doc/embedded/embedded_nt.html ) in windows 2003, hope it still works for you in windows 2008. After creating service with erlsrv it is possible to manage it via standard windows command line and GUI tools, e.g. setting start mode and restart policy.

May be you could start just your application by supplying "-s app_name" as erl/start_erl additional flag, but I didn't try that, as I had to go long route with embedded system release. In that case make sure you have "start() -> application:start(?MODULE)." in your "app_name.erl".

probsolver