Deployment and migration

Hi there,

I recently migrated an Elixir app to Fly.io and it works very well so far except for the speed of deployment and the migration. I followed the guide (Deploy an Elixir Phoenix Application) to configure my app.

Regarding the issue with the speed of deployment, whenever I run flyctl deploy, the process hangs for anything between 5 and 10 minutes on the following step (see below):

==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-empty-feather-57 ready
==> Building image with Buildpacks
--> docker host: 20.10.12 linux x86_64
20: Pulling from heroku/buildpacks
Digest: sha256:14b5c97bc4319c128d210e0054299c5bfe8fd3200b77bf442e86760011529e1f
Status: Image is up to date for heroku/buildpacks:20
20: Pulling from heroku/pack
Digest: sha256:d2a6f44fbf59ef7d5a2fdb3b9dd790153451603b7fa6e7f71ae6821300a44a13
Status: Image is up to date for heroku/pack:20
Downloading from https://cnb-shim.herokuapp.com/v1/hashnuke/elixir
1.89 MB/-1 B

Do you know any way to speed up the building process? It looks to me like downloading the buildpack is very slow.

The second issue regarding the migrations is simple: the migrations simply do not run. Is there anyway to specify a release command? I did not alter the generated fly.toml configuration yet.

Thanks for your help!

1 Like

Buildpacks are slow, unfortunately. The delay you’re seeing is a bunch of buildpack work that we don’t optimize as well as Heroku. The fastest way to deploy a Phoenix app is to use a Dockerfile. If you’re running Phoenix 1.6.4 or newer, fly launch will generate a Dockerfile for you. If you’re running an older version, we have a guide that’ll help you get going: Deploy an Elixir Phoenix Application (pre v1.6.3)

That guide includes release command instructions. Just add something like this to your fly.toml:

[deploy]
  release_command = "/app/entry eval HelloElixir.Release.migrate"

Hey Kurt,

Thank you so much. I did a new flyctl launch and it generated the Dockerfile properly with the release command.

It works well now!

Best,
David