Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fly launch on Elixir apps is brittle #397

Closed
mrkurt opened this issue Apr 12, 2021 · 1 comment
Closed

fly launch on Elixir apps is brittle #397

mrkurt opened this issue Apr 12, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@mrkurt
Copy link
Member

mrkurt commented Apr 12, 2021

These are just notes on problems with fly launch on Elixir apps. They're mostly gaps in the buildpack: https://github.com/HashNuke/heroku-buildpack-elixir

We can fix these things in flyctl and/or fork the buildpack to make it match what we're doing.

Build needs env vars

The Elixir buildpack doesn't default any environment variables, so it won't build properly from scratch. I've worked around it by setting this:

[build]
  builder = "heroku/buildpacks:20"
  buildpacks = ["https://cnb-shim.herokuapp.com/v1/hashnuke/elixir"]
  [build.args]
    DATABASE_URL="none"
    SECRET_KEY_BASE="none"

We should do that by default, and also ensure that they're overridable once deployed.

Buildpack requires (or will soon require) as config file

IMPORTANT: The default elixir_version will be removed on 2021-06-01. Please explicitly set an elixir_version in your elixir_buildpack.config before then or your deploys will fail.

I had to create elixir_buildpack.config and add elixir_version=1.7 to it. Many of our users won't have the buildpack configured, we should be able to detect Elixir version from mix.exs, since that can specify required version.

We should either write a basic elixir_buildpack.config if the file doesn't already exist, inject one at build time, or fork the buildpack and add support for environment variable based settings.

Elixir and Erlang releases need to match

If we do detect Elixir version, we also need to find an appropriate OTP version to set. These are documented, and the buildpack uses a hardcoded list of available OTP versions.

Ecto in Phoenix does not enable IPv6

The good news is there's a PR for future Phoenix versions that solves this. The bad news is that existing Phoenix apps don't include the Repo setting.

We should detect this and fix it if we can, or at least make a bunch of noise about what the user needs to do if we can't. It's relatively simple to add, and while it might dirty up flyctl a little bit, I think it's worth making magical.

@mrkurt mrkurt added the bug Something isn't working label Apr 12, 2021
@mrkurt mrkurt changed the title Elixir won't build by default because buildpack is missing env vars fly launch on Elixir apps is brittle Apr 12, 2021
@jsierles
Copy link
Member

jsierles commented Feb 8, 2022

For now, we're leaning on the new Phoenix Dockerfile, so we can revisit this if we ever go back to buildpacks.

@jsierles jsierles closed this as completed Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants