Deploying a Phoenix 1.3 Umbrella app to Heroku

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.1
elixir_version=1.4.2
runtime_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!

HackerNoon.com

#BlackLivesMatter

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store