Tips for fast first-time Phoenix deployment

Hey Fly! I just followed Chris’s example on creating a live Fly Elixir application in two-commands. I ran into a couple issues, so wanted to document here in case anyone else experiences the same:

  1. If you have issues running migrations, make sure you have socket_options: [:inet6] configured for your app Repo.
  2. Once you have your migrations running, your app won’t start unless your Endpoint has server: true configured (I did this in config/prod.exs).
  3. Also in your app Endpoint, update url: [host: "", port: 80] to use the actual hostname of your server. It might be possible to pull this from the environment.

That’s it! All in all, it was super easy to get started and I’m looking forward to deploying many more apps on Fly.


Hi @jtormey , thanks for your report love it!

I take succes from fly launch and deploy with Elixir Phoenix LiveView 1.6 with Tailwindcss project.
Now I trying config and deploy same project with Bulmacss lib.

I hope soon release source code from my POCs.

I don’t understand the item 3 that you report, this is configure into prod.exs?

Sorry my poor english, I am brazillian.

Thanks a lot for your atention and help.

@jtormey Here is the source code to Elixir Phoenix Live View ~> 1.6 with Bulma and Tailwind CSS libraries configured and working:

For point 3, to grab the hostname from the environment you can do:

app_name =
  System.get_env("FLY_APP_NAME") ||
    raise "FLY_APP_NAME not available"

config :yourapp, YourAppWeb.Endpoint,
  url: [host: "#{app_name}", port: 80],


I was able to resolve hostname and Ecto’s inet6 issues but I have been scratching my head for hours until I found your post and saw that server: true option. I feel a bit dumb because I still have no idea what are the ins and outs of this one.
Moreover I was confused when I ssh’d the app, attempting to start the server manually and saw Protocol 'inet6_tcp': the name myapp@1435f6d2 seems to be in use by another Erlang node.
I assumed “Errr, it should be running, right ?” but I guess a node is attributed even if the server is off.
I guess I have to stop playing around and go back reading the FM, at the “releases” chapter :nerd_face:.

IMHO that’s a big miss in the docs not to mention those “tips” (that i would personally call prerequisites…).
It may be deceptive for newcomers not te see the magic happen at the first attempt !

Thank you very much @jtormey for sharing and congrats to everyone at Fly for the great work :slight_smile:

Ok, I found that 1.6.6 generates some differences in runtime.exs. I generated my app with 1.6.2.
Time flies.

All of these would address all of our points.

if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do
  config :hello, HelloWeb.Endpoint, server: true

# ...
maybe_ipv6 = if System.get_env("ECTO_IPV6"), do: [:inet6], else: []
config :hello, Hello.Repo,
  # ...
  socket_options: maybe_ipv6
# ...
host = System.get_env("PHX_HOST") || ""

Thanks anyway for pointing the runtime.exs which was the cause of our troubles !

1 Like

I had this exact same problem today. 1.6.4 includes a lot of magic and I didn’t realize my mix was out of date.

Just found this today, it’s pretty cool :slight_smile: PhoenixDiff · v1.6.2 to v1.6.6
(GitHub - navinpeiris/phoenix-diff: See the changes needed when upgrading an Elixir Phoenix application)

Looking forward to see a mix.phx.app_update inspired by a feature of another pretty good framework

bin/rails app:update
       exist  config
    conflict  config/application.rb
Overwrite /myapp/config/application.rb? (enter "h" for help) [Ynaqdh]
       force  config/application.rb
      create  config/initializers/new_framework_defaults_7_0.rb