Deploy Erlang Target System to Heroku
In this post these new tools will be used:
- rebar3 fork - my fork of rebar that has major refactoring and binary package support (Requires 17.x right now)
- hk - new cli client for Heroku
- hk slug plugin - plugin for hk that uploads the target system
- Heroku Cedar-14 - new Heroku Cedar on Ubuntu 14.04
- Heroku Slug API
First, clone minasan and create the Heroku application on Cedar-14:
$ git clone https://github.com/tsloughter/minasan.git $ cd minasan $ heroku create --stack cedar-14Now that Heroku has the cedar-14 stack if you are also running a recent Linux distro you can upload the target system created by _relx_ directly to your app, before now we would have to build it on Heroku or in a system with an older glibc to work on Heroku's Ubuntu 10.04. Since _minasan_ is using binary packages and a fork of _rebar_ be sure to use the _rebar_ included in the repo, same goes for _relx _so that including the Procfile in the tarball works. The first step will be to update the package index for _rebar_, then compiling and building the release tarball (with _erts_ included and _dev-mode_ off so the Erlang runtime is included):
$ ./rebar update $ ./rebar compile $ ./relx -i true --dev-mode false release tarUsing the new Slug API endpoint through _hk slug_ the tarball can be pushed directly as a slug to your app and then scale up the web process to at least 1:
$ hk slug _rel/minasan/minasan-0.0.1.tar.gz $ hk scale web=1 $ hk open
Your browser should now open to your new app.
A few things to note:
- './rebar pkgs' will show you a list of available packages to use in rebar deps
- Currently 'hk slug' only support sending a tarball that does not yet have the structure of a slug. So it is unpacked and repacked. I plan to support directories and properly formatted tarballs.