Initialize your git repository git init
. This would save you later a step to add heroku as remote.
Move configuration from config/prod.secret.exs
to config/prod.exs
and replace the following parts:
config :app_name, AppName.Endpoint,
secret_key_base: System.get_env("SECRET_KEY_BASE")
# Configure your database
config :app_name, AppName.Repo,
adapter: Ecto.Adapters.Postgres,
url: System.get_env("DATABASE_URL"),
size: 20 # The amount of database connections in the pool
Remove import_config "prod.secret.exs"
from config/prod.exs
.
Remove config/prod.secret.exs
file and its line in .gitignore
.
Create Heroku App:
heroku create app-name --region eu
Set the buildpacks stack:
heroku buildpacks:set https://github.com/gjaldon/phoenix-static-buildpack
heroku buildpacks:add --index 1 https://github.com/HashNuke/heroku-buildpack-elixir
# Buildpack added. Next release on app-name will use:
# 1. https://github.com/HashNuke/heroku-buildpack-elixir
# 2. https://github.com/gjaldon/phoenix-static-buildpack
Create Procfile
:
mix phoenix.server
Create elixir_buildpack.config
:
erlang_version=17.5
elixir_version=1.0.5
always_rebuild=true
config_vars_to_export=(DATABASE_URL SECRET_KEY_BASE)
Create phoenix_static_buildpack.config
:
node_version=0.12.7
npm_version=2.11.3
config_vars_to_export=(DATABASE_URL SECRET_KEY_BASE)
Set SECRET_KEY_BASE ENV variable in Heroku:
heroku config:set SECRET_KEY_BASE=some_secret_key
Commit the changes:
git commit -m "Configure app to run on Heroku"
Push to Heroku:
git push heroku