Running the project
Although right after firing start.erl script your project is ready-to-develop you probably want to know how to manage it through some attached scripts.
Running the servers
As it has been mentioned in the install section, there are two available servers within the Erlang Web framework: INETS and Yaws. The differences between running the Erlang Virtual Machine in interactive and embedded mode are described on Erlang doc site.
Interactive mode (1.3 and above)
The autogenerated bin/start_interactive script provides three possible running modes:
bin/start_interactive will start the framework on top of Inets web server, in single_node mode
bin/start_interactive SERVER where SERVER == inets | yaws will start the framework on top of selected web server, in single_node mode
bin/start_interactive SERVER NODE_TYPE where NODE_TYPE == single_node | single_node_with_cache | frontend | backend will start the framework on top of selected web server, in the selected mode
The configuration of web servers is described here.
Interactive mode (1.2.1 and below)
In order to run the server in interactive mode on top of INETS server you should type:
bin/start_interactive
The configuration for the server (like port numbers, server name and so on) is read from the config/inets.conf file. The example one (which is copied during the installation process) could be found inside the priv directory of eptic application.
To do the same thing but using the Yaws web server run:
bin/start_interactive yaws
The configuration of Yaws server is parametrized with project.conf file.
EWGI in Interactive mode
Available since 1.3 rev. 282.
Recent changes made ErlangWeb able to be run with EWGI support. Currently EWGI in interactive mode can be run using two servers: Inets and MochiWeb.
In order to run EWGI with mochiweb you'll have to manually download and compile mochiweb sources. To download sources using subversion client you should enter the following commands in the lib/ directory:
svn checkout http://mochiweb.googlecode.com/svn/trunk/ mochiweb
When you have downloaded mochiweb sources it's time to compile them. This can be done easily by entering lib/mochiweb and issuing make command.
Then starting in EWGI-compliant mode is similar to starting a server without EWGI layer:
bin/start_interactive SERVER where SERVER == ewgi_inets | ewgi_mochiweb
Embedded mode
To run the system in the embedded mode type:
bin/start
The configuration is read from the sys.config and start_erl.data files (both of them have been created by start.erl script).
After the system start we can connect to its shell by running:
bin/connect
In order to detach from the shell press CTRL+D.
The system could be easily stopped:
bin/stop
EWGI in Embedded mode
EWGI support was also added to the embedded mode, however in such case it supports only the inets server. In order to make ErlangWeb generate config files for running in EWGI mode with Inets, you should, instead of calling ./bin/start.erl without parameters, issue the following command:
bin/start.erl ewgi_inets
After that the interaction between ErlangWeb and User looks pretty much the same as in the case when it is run without EWGI layer.
Adding the application
User can add a new application to the current project by running
bin/add.erl
Then he should follow the instructions displayed on the screen. The script will create the whole directory tree and update the main Emakefile file.
Compiling
After making some changes we will need to compile it. Erlang Web is distributed with the simple Emakefiles, so rebuilding the changed files could be done by running one command:
bin/compile.erl
The script is also responsible for creating the new release:
bin/compile.erl release Version [Server]
where Version is the release version and the optional parameter Server indicates the web server we want to use (by default it is INETS, specifying yaws will change it to the Yaws web server).
The additional help could be obtained after running the:
bin/compile.erl help
