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 :hello_web, HelloWeb.Endpoint, server: true
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.
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
$ fly deploy
Enjoy your app!
$ fly open
and the umbrella application is finally happily up and running!
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:
- you have to explicitly set
- you have to add the required
elixir_buildpack.configfile to the project
- you have to build the application assets
- you have to set the
SECRET_KEY_BASEexecuting fly secrets after fly launch and before fly deploy (you can’t just export it to an environment variable)
- the Fly builder will not generate a Docker file as is the case with plain apps (but if you supply one, the builder will use it)