Skip to content

ChrisWhealy/cf-buildpack-erlang

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 

Repository files navigation

Cloud Foundry Build Pack: Erlang

This is an updated Cloud Foundry build pack for Erlang OTP apps. Apps are built using Rebar3 which in turn, assumes your Erlang app is a standard OTP app.

Update

The following updates have been made:

  • Erlang tarballs are downloaded from Heroku Cedar 14 stack
  • Rebar3 is used instead of Rebar2.x
  • Default Erlang OTP version is now 20.1, not master.

Select an Erlang version

The Erlang/OTP release version that will be used to build and run your application is now obtained from a dot file called .preferred_otp_version. If this file is missing, the OTP version will default to 20.1.

If this file can be found in the root directory of your repo, it must contain only the OTP version number you require. Pre-compiled binaries from version from 17.0 upwards are available from the Cedar 14 stack.

Example

If your .preferred_otp_version file contains 19.2, then the file OTP-19.2.tar.gz will be downloaded from https://s3.amazonaws.com/heroku-buildpack-elixir/erlang/cedar-14/.

Create an Erlang Release

Please ensure that the rebar.config file of your OTP app contains a release definition. Something like:

{relx, [
    {release,
      { <app_name>, "1.0.0" },
      [ <app_name>, sasl, runtime_tools]
    },

    {sys_config, "./config/sys.config"},
    {vm_args,    "./config/vm.args"},

    {dev_mode, false},
    {include_erts, true}
  ]
}.

IMPORTANT
In your vm.args file, add the +B flag to disable the break handler. This then means that your app can be terminated with a single Ctrl-C, instead of the normal Ctrl-C followed by another Ctrl-C.

Create a Procfile for CF to run

Erlang releases are run via their application name, so in the root directory of your repo, create a Procfile containing the following:

web: _build/default/rel/<app_name>/bin/<app_name> foreground

IMPORTANT
You must use the foreground command to start your app, not the start command. The start command returns control to the OS which makes Cloud Foundry think your app has terminated with exit code 0. This causes a startup error saying Codependent process exited and even though there's nothing wrong with your app, Cloud Foundry will not be able to run it.

Build your CF App

$ cf push <app_name> -b https://github.com/ChrisWhealy/cf-buildpack-erlang

About

Erlang buildpack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%