paint-brush
Deploying a Phoenix 1.3 Umbrella app to Herokuby@marcdel
1,279 reads
1,279 reads

Deploying a Phoenix 1.3 Umbrella app to Heroku

by Marc DelagrammatikasApril 18th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The <a href="https://hackernoon.com/tagged/heroku" target="_blank">Heroku</a> buildpacks make some assumptions about your project based on earlier versions, but with a few tweaks can be used with version 1.4 of Elixir and 1.3 of <a href="https://hackernoon.com/tagged/phoenix" target="_blank">Phoenix</a>.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Deploying a Phoenix 1.3 Umbrella app to Heroku
Marc Delagrammatikas HackerNoon profile picture

The Heroku buildpacks make some assumptions about your project based on earlier versions, but with a few tweaks can be used with version 1.4 of Elixir and 1.3 of Phoenix.

This assumes you created your project with mix phx.new hello_phoenix --umbrella. Replace hello_phoenix and HelloPhoenix with your app name where appropriate.

Most of the instructions at http://www.phoenixframework.org/docs/heroku are still valid. Complete those and then make the following changes:

  • This may be obvious, but the config/prod.exs mentioned is the one in the web app folder: hello_phoenix_umbrella/apps/hello_phoenix_web/config/prod.exs.
  • Change the reference in prod.exs from HelloPhoenix.Endpoint to HelloPhoenix.Web.Endpoint.
  • You’ll also need to remove import_config "prod.secret.exs" from hello_phoenix_umbrella/config/prod.exs.
  • Create a file named phoenix_static_buildpack.config in the root of your project and add the following line phoenix_relative_path=apps/hello_phoenix_web.
  • Change the line in your Procfile to web: MIX_ENV=prod mix phx.server.
  • If your app uses a database you can add this line to your Procfile to run migrations on release: release: mix ecto.migrate.
  • Create a file named elixir_buildpack.config and set your Erlang and Elixir versions and runtime path (/app is the root of your project):



erlang_version=19.1elixir_version=1.4.2runtime_path=/app

If you’re using Elm:

There is an open issue to support Elm in the Phoenix buildpack 🤗. For now, if you’re compiling your Elm app with elm-brunch, you can just add elm as a dependency to your apps/hello_phoenix_web/assets/package.json.

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.

To learn more, read our about page, like/message us on Facebook, or simply, tweet/DM @HackerNoon.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!