Erlang/OTP applications are supported when using the rebar build tool and appropriate configuration to generate releases.
Due to the somewhat irregular nature of Erlang application layouts, support currently only exists for applications using Rebar, and packaged into Erlang releases (usually via the rebar generate command).
To demonstrate Erlang deployment, we'll deploy the Sean Cribb's riak_id application (https://github.com/seancribbs/riak_id).
- On your development system, ensure that you have Erlang R14B02 installed.
- In an appropriate directory:
git clone https://github.com/seancribbs/riak\_id
cd riak_id
wget --no-check-certificate https://github.com/downloads/basho/rebar/rebar
echo -riak_core http '[{"0.0.0.0", '$VMC_APP_PORT'}]' >rel/files/vmc.args
- Add
{copy, "files/vmc.args", "etc/vmc.args"},
to rel/reltool.config directly before{template, "files/app.config", "etc/app.config"}
make rel
cd rel/riak_id
vmc push riak_id --url riak_id.vcap.me -n
Visit http://riak_id.vcap.me/id. You should see a generated number. Multiple successive refreshes should generate new numbers. See the project page for an explanation of the meaning of these.
Notable things in this deployment:
- The application code was untouched
- A file vmc.args was added to the release template. This file details the additional vm arguments that will be provided as the application is launched, thereby allowing for customisation of items such as the http port.
- Multiple instances are not supported on the same machine, as the underlying riak_core also requires a unique handoff port, which we're unable to allocate.
- An application containing custom nifs won't deploy correctly unless the development machine is of an equivalent architecture to the deployment host (eg linux x64).