DATABASE_URLcan be made available at compile time adding it to
mix run --no-haltwill be run.
heroku create --buildpack "https://github.com/HashNuke/heroku-buildpack-elixir.git"
heroku config:set BUILDPACK_URL="https://github.com/HashNuke/heroku-buildpack-elixir.git"
The above method always uses the latest version of the buildpack. To use a specific older version of the buildpack, see notes below.
elixir_buildpack.config file in your app's root dir. The file's syntax is bash.
If you don't specify a config option, then the default option from the buildpack's
elixir_buildpack.config file will be used.
Here's a full config file with all available options:
# Erlang version erlang_version=18.1.3 # Elixir version elixir_version=1.0.4 # Always rebuild from scratch on every deploy? always_rebuild=false # Export heroku config vars config_vars_to_export=(DATABASE_URL) # A command to run right after compiling the app post_compile="pwd"
heroku config:set MY_VAR=the_value
Add your own
Procfile to your application, else the default web task
mix run --no-halt will be used.
If you create an application with this buildpack, then a free database addon
heroku-postgresql:hobby-dev is also added. The database credentials are available from the env var
Your application should build embedded and start permanent. Build embedded will consolidate protocols for a performance boost, start permanent will ensure that Heroku restarts your application if it crashes. See below for an example of how to use these features in your Mix project:
defmodule MyApp.Mixfile do use Mix.Project def project do [app: :my_app, version: "0.0.1", build_embedded: Mix.env == :prod, start_permanent: Mix.env == :prod] end end
The buildpack will execute the command configured in
post_compile in the root directory of your application after it has been compiled. This script can be used to build or prepare things for your application, for example compiling assets.
Using the above methods always uses the latest version of the buildpack. We attempt to maintain the buildpack for as many old Elixir and Erlang releases as possible. But sometimes it does get hard since there's a matrix of 3 variables involved here (Erlang version, Elixir version and Heroku stack). If your application cannot be updated for some reason and requires an older version of the buildpack then use the releases page to pick a tag to use. Use the buildpack url with the tag name.
For example, if you pick the tag "v3", then the buildpack url for your app would be:
We only create a new tag/release when we've made breaking changes. So consider all tagged versions older than master as not recommended for use and not supported any further.
© Akash Manohar under The MIT License. Feel free to do whatever you want with it.
Copy the snippet above into CLI.