Installation
compile.erl
In order to make the start of the adventure with Erlang Web easier, there is a start-up script, which can prepare all the environment for a new project. Currently only Linux-based systems are supported by the script.
Before we will be ready to use the framework for the first time, we should compile it.
To do so be sure to have all dependencies, erlang (base or hype) erlang-inets, yaws and the erlang tools, on most packaged distributions they are usually a set of different packages. Most of compiling errors are because of missing erlang packages.
Now that we have all dependencies should type in the sources root directory:
bin/compile.erl
The compile.erl script is also very useful when we want to compile the changed files. Since it uses the Emakefiles it behaves as standard GNU Make. So in order to recompile the changed files, simply run bin/compile.erl.
start.erl
Erlang Web framework supports now the two main servers implemented in Erlang: INETS and Yaws. Since we assume that installation process should be as easy as it is only possible, the next script will prepare the whole environment for us, including the server start scripts, release files for embedded mode and main configuration files.
Because after running the script we will be able to run the server in the embedded mode, we should now decide, which server we want to use. Of course, the changing later the server our service is going to run on top of is childishly easy.
To prepare the environment for the INETS server (it is done by default) we should type:
$PATH_TO_THE_ERLANG_WEB_ROOT_FOLDER/bin/start.erl
inside a directory where we want to start our work. If you want to start your work where you have just unpacked and compiled the sources of the Erlang Web, simply run:
bin/start.erl
In the other case - when we want to use Yaws web server, we should run:
$PATH_TO_THE_ERLANG_WEB_ROOT_FOLDER/bin/start.erl yaws
Both scripts should inform you about the progress and status of the installation process.
OK, the project environment is now ready to use - you should be able to run the server in both: interactive and embedded mode. The next steps you should overtake are described in Running the project section.
Results
start.erl script does the following actions:
- creates the mandatory directories for the Erlang Web framework, including:
- bin
- config
- docroot
- lib
- log
- pipes
- releases
- templates
- copies the binary executables:
- heart
- run_erl
- to_erl
- creates start scripts for both: interactive and embedded mode
creates start_erl.data configuration file
- prepares the required framework configuration files:
- dispatch.conf
- errors.conf
- project.conf
- builds simple welcome, 404 and 501 error pages
- copies the required autocomplete wpart files
- creates .rel and sys.config files
- generates boot file
- adds the escripts to the project environment:
- add.erl
- compile.erl
- e_component.erl
