After some attempts I’ve succeeded in deploying the umbrella. Unlike a plain Phoenix app, the deployment of an Umbrella application with the current builder needs some more steps. Hope this explanation could be useful to someone else Fly newbie struggling with umbrellas:
Plain App
A plain Phoenix app need just these four steps to be deployed successfully:
$ mix phx.new hello --no-ecto --install
$ cd hello
$ export SECRET_KEY_BASE=$(mix phx.gen.secret)
$ fly launch
Umbrella App
Instead, the following are all the exact steps needed today to deploy a minimal umbrella application
- 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
- adds
elixir_buildpack.config
with the preferred Ex/Ph versions:
$ cat <<EOF>./elixir_buildpack.config
elixir_version=1.13.3
erlang_version=24.0
EOF
- deploy the assets from within the web app directory:
$ cd apps/hello_web
$ MIX_ENV=prod mix assets.deploy
$ cd ../../
- Setup the Fly’s 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!
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
server: true
inconfig/runtime.exs
- you have to add the required
elixir_buildpack.config
file to the project - you have to build the application assets
- you have to set the
SECRET_KEY_BASE
executingfly secrets
afterfly launch
and beforefly 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)