Polyglot developer, geometric tessellation fan, ambient DJ.

Umbrella apps on Fly.io

This first appeared in a forum post on community.fly.io

I've updated it a bit with some clarifications and a fix for a version-clash issue I had.

Setup the project

$ mix phx.new hello  --umbrella --no-ecto --install
$ cd hello_umbrella

Enable server in config/runtime.exs:

config :hello_web, HelloWeb.Endpoint, server: true

Add elixir_buildpack.config with the preferred Erlang and Elixir versions:

$ cat <<EOF>./elixir_buildpack.config
elixir_version=1.14
erlang_version=24.3
EOF

I had problems with too-specific versions in the above, so just use major versions, e.g. elixir_version=1.14 versus elixir_version=1.14.3-otp-24

Deploy the assets from within the web app directory:

$ cd apps/hello_web
$ MIX_ENV=prod mix assets.deploy
$ cd ../../

Setup the Fly stuff

$ fly launch

Answer “no” to deploy request and leave fly launch, then set up the secret:

$ export SECRET_KEY_BASE=$(mix phx.gen.secret)
$ fly secrets set SECRET_KEY_BASE=$SECRET_KEY_BASE

Deploy:

$ fly deploy

Enjoy your app!

$ fly open

and the umbrella application is finally happily up and running!

Summary

Besides the steps above, here are the summary of the current differences in how Fly handles deployment between plain and umbrella.

to deploy an Umbrella via Fly:

Discuss...