Skip to content

[Deployment] Heroku

Dimitrios Zorbas edited this page Mar 24, 2018 · 8 revisions

Table of Contents

You can have a look at the demo dashboard code deployed at Heroku at https://kitto.herokuapp.com

A dashboard generated via mix kitto.new <dashboard_name> creates all files necessary to deploy to Heroku.

Use heroku-buildpack-elixir to manage Elixir/OTP installation, mix dependencies and compilation.

Create a Heroku app

From the root of your dashboard source code run:

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

Given you're using git for your dashboard, this command will create a heroku remote

Add nodejs buildpack

Nodejs is required for the js/scss files to be compiled by webpack.

heroku buildpacks:add heroku/nodejs

Then you'll see:

Buildpack added. Next release on your-dashboard-name will use:
  1. https://github.com/HashNuke/heroku-buildpack-elixir.git
  2. heroku/nodejs

More info about deploying with git: https://devcenter.heroku.com/articles/git

Configure Binding Address

# File: config/prod.exs

config :kitto,
  ip: {0, 0, 0, 0},
  port: {:system, "PORT"} # set by Heroku

Configure Assets

# File: config/prod.exs

config :kitto,
  watch_assets?: false,
  serve_assets: true,
  assets_path: "priv/static"

Deploy

git push heroku master

..and you're up and running!

Note If you generated your dashboard app using an installer prior to the 0.3.0 release, you also have to follow some additional steps (contributed by @cforcey).