Deploying Erlang Mochiweb app using Dokku

Deploying Erlang with rebar is very easy in Dokku. I'm gonna use hello-erlang to deploy the erlang application which is using mochiweb to server an HTTP request. The dependecy on Mochiweb is mentioned in rebar.config.

First clone the repository to your local PC

$ git clone https://github.com/jkvor/hello-erlang.git

Then create a .env file

$ echo BUILDPACK_URL="https://github.com/archaelus/heroku-buildpack-erlang.git" > .env

Then create a .preferred_otp_version file

$ echo OTP_R16B03 > .preferred_otp_version

This contains the information regarding which version of Erlang to install. Other version are mentioned here

Then do a git commit with a message and add remote repository for pushing the bits to your Dokku

$ git remote add somename [email protected]:hello-erlang

Now the last step is to push the changes to you Dokku as

$ git push somename master

Now you will see that Dokku will use that buildpack to install Erlang and Rebar and then that will download the Mochiweb and run your application. Just navigate to the URL printed at the end and you have a running Erlang application deployed using Dokku awesomeness

You might also like