Coder Social home page Coder Social logo

heroku-buildpack-elixir's Introduction

Heroku Buildpack for Elixir

Features

  • Easy configuration with elixir_buildpack.config file
  • Use prebuilt Elixir binaries
  • DATABASE_URL can be made available at compile time adding it to config_vars_to_export in elixir_buildpack.config
  • Allows configuring Erlang
  • If your app doesn't have a Procfile, default web task mix run --no-halt will be run.
  • Consolidates protocols
  • Hex and rebar support
  • Caching of Hex packages, Mix dependencies and downloads

Version support info

  • Erlang - Prebuilt packages (17.5, 17.4, etc)
  • Elixir - Prebuilt releases (1.0.4, 1.0.3, etc) or prebuilt branches (master, stable, etc)

Usage

Create a Heroku app with this buildpack

heroku create --buildpack "https://github.com/HashNuke/heroku-buildpack-elixir.git"

Set the buildpack of an existing Heroku app

heroku config:set BUILDPACK_URL="https://github.com/HashNuke/heroku-buildpack-elixir.git"

Configuration

Create a 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=17.5

# 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)

Specifying Elixir version

  • Use prebuilt Elixir release
elixir_version=1.0.4
  • Use prebuilt Elixir branch, the branch specifier ensures that it will be downloaded every time
elixir_version=(branch master)

Specifying Erlang version

  • You can specify an Erlang release version like below
erlang_version=17.5

Specifying config vars to export at compile time

  • To set a config var on your heroku node you can exec from the shell:
heroku config:set MY_VAR=the_value
  • Add the config vars you want to be exported in your elixir_buildpack.config file:
config_vars_to_export=(DATABASE_URL MY_VAR)

Other notes

  • 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 DATABASE_URL.

  • 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

Credits

© Akash Manohar under The MIT License. Feel free to do whatever you want with it.

heroku-buildpack-elixir's People

Contributors

hashnuke avatar ericmj avatar sinetris avatar gjaldon avatar jjbohn avatar mxhold avatar mikker avatar ma2gedev avatar ventsislaf avatar niku avatar optikfluffel avatar trenpixster avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.