Update: Run a Phoenix 1.7 application on Scalingo using Releases

Note: This is an update of our post Run a Phoenix 1.6 application on Scalingo using Releases. As only details have changed, the descriptions and explanations of the linked post are still up to date. This post focusses on the changes and summarizes the code needed for phoenix 1.7.

.buildpacks

The main update in comparison to our old post is the change from heroku-buildpack-phoenix-static to gigalixir-buildpack-phoenix-static. The heroku packages seem partly outdated at this point. Therefore, the .buildpacks file should now look like this:

https://github.com/nwittstruck/heroku-buildpack-elixir#scalingo
https://github.com/gigalixir/gigalixir-buildpack-phoenix-static
https://github.com/chrismcg/heroku-buildpack-elixir-mix-release

Hint: For the release buildpack (last one), gigalixir also provides an alternative: gigalixir-buildpack-releases.

elixir_buildpack.config

The elixir buildpack changes can be adopted depending on the used elixir and erlang version in the app. An example can look like this:

elixir_version=1.15.8
erlang_version=26.2.5
release=false

The release property stays deactivated as it might create a conflicting release in the first buildpack.

Procfile

This stays the same and still starts the server from the release:

web: bash _build/prod/rel/mindwendel/bin/server

phoenix_static_buildpack.config

We have updated the node and npm versions here, despite that not much has changed.

node_version=18.20.4
npm_version=10.7.0

# Clean out cache contents from previous deploys
clean_cache=true

# We can change the filename for the compile script with this option
compile="compile"

# We can set the path to phoenix app. E.g. apps/phoenix_app when in umbrella.
phoenix_relative_path=.

# Remove node and node_modules directory to keep slug size down if it is not needed.
remove_node=false

# We can change path that npm dependencies are in relation to phoenix app. E.g. assets for phoenix 1.3 support.
assets_path=.

# We can change phoenix mix namespace tasks. E.g. `phoenix` for phoenix < 1.3 support.
phoenix_ex=phx

compile

Nothing needs to be changed here:

#!/bin/bash

cd $phoenix_dir
mix assets.deploy

mix phx.digest

if mix help phx.digest.clean 1>/dev/null 2>&1; then
  mix phx.digest.clean
fi

Additional information can be found in the old blog post: Run a Phoenix 1.6 application on Scalingo using Releases. If you would like to see a real life case of a phoenix app hosted on scalingo, have a look at the source code of mindwendel.

Need additional help? Contact us!

B310 Digital GmbH, c/o FLEET7, Fleethörn 7, 24103 Kiel hi@b310.de