Specify OTP/Erlang and Elixir versions on deploy

We have a Phoenix application that we would like to deploy to Fly (it’s currently on Heroku). This application has a hard requirement of OTP version <= 23. Can we specify the version we want at launch/deploy time? If so, how?

Hey @building39 ,

If you are deploying to fly with heroku buildpacks you should be able to keep your version config that you already have setup in elixir_buildpack.config. However, you may want to use Docker and mix release, to have more fine-grained control over your builds and especially to take advantage of clustering on fly’s private network. Running fly launch will generate a fly.toml and a Dockerfile plus related release files for you, or you can run mix phx.gen.release --docker (which fly launch calls to under the hood). At the top of the generated Dockerfile you’ll see something like this:

ARG ELIXIR_VERSION=1.13.4
ARG OTP_VERSION=25.0
ARG DEBIAN_VERSION=bullseye-20210902-slim

ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"

Hex.pm provides images for every compatible Elixir/OTP version pair, so you can change this to whatever versions you need. I recommend reading carefully through the Phoenix deployment docs about deploying with releases and on fly, especially the section on clustering if that’s your goal.

Excellent! I’ll try that. Thanks for the quick response.

1 Like