fly launch and fly deploy failing

I have very simple elixir app no pheonix or database involved. i read forums and error message nothing seems to work.

Error Detail:

===> BUILDING
[builder] Warning: Buildpack 'hashnuke/elixir@0.1' requests deprecated API '0.4'
[builder] Timer: Builder started at 2024-10-06T16:44:11Z
[builder] 
[builder] #######################################################################
[builder] 
[builder] ERROR: This buildpack is a legacy buildpack that has been shimmed
[builder] for compatibility with Cloud Native Buildpacks (CNBs) using the
[builder] cnb-shim service:
[builder] https://github.com/heroku/cnb-shim
[builder] 
[builder] The cnb-shim service is not actively maintained and does not support
[builder] modern Buildpack API and lifecycle versions.
[builder] 
[builder] In addition, the legacy builder images that use shimmed buildpacks
[builder] (such as 'heroku/buildpacks:20' or 'heroku/builder-classic:22') are
[builder] no longer supported and do not receive any security updates or fixes.
[builder] 
[builder] Please switch to one of our newer 'heroku/builder:*' builder images:
[builder] https://github.com/heroku/cnb-builder-images#available-images
[builder] 
[builder] If you are using the Pack CLI, you will need to adjust your '--builder'
[builder] CLI argument, or else change the default builder configuration using:
[builder] 'pack config default-builder <new_builder_name>'
[builder] 
[builder] If you are using a third-party platform to deploy your app, check their
[builder] documentation for how to adjust the builder image used for your build.
[builder] 
[builder] If you manually specify a cnb-shim buildpack URL (that refers to
[builder] 'cnb-shim.herokuapp.com') you will also need to update that to
[builder] the ID of a non-shimmed buildpack.
[builder] 
[builder] See here for Heroku's supported CNB languages:
[builder] https://github.com/heroku/buildpacks#supported-languages
[builder] 
[builder] Or search for community buildpacks here:
[builder] https://registry.buildpacks.io/
[builder] 
[builder] To ignore this error, set the env var ALLOW_EOL_SHIMMED_BUILDER to 1.
[builder] 
[builder] #######################################################################
[builder] 
[builder] Timer: Builder ran for 8.27069ms and ended at 2024-10-06T16:44:11Z
[builder] ERROR: failed to build: exit status 1
==> Building image
✓ compatible remote builder found
INFO Override builder host with: https://fly-builder-ancient-glade-5882.fly.dev (was tcp://[fdaa:a:584c:a7b:68:6ba7:d185:2]:2375)

Remote builder fly-builder-ancient-glade-5882 ready
==> Building image with Buildpacks
--> docker host: 24.0.7 linux x86_64
20: Pulling from heroku/buildpacks
Digest: sha256:81a8c465955bd015c4eda1ac60a83e8ecc1d7f954e915b6b09012f46e09814b1
Status: Image is up to date for heroku/buildpacks:20
20-cnb: Pulling from heroku/heroku
Digest: sha256:fb00b60497e62c999fcbfa741861e13549f3bd88efd4d064fbaa97adc7e9ae4a
Status: Image is up to date for heroku/heroku:20-cnb
Downloading from https://cnb-shim.herokuapp.com/v1/hashnuke/elixir
1.82 MB/-1 B
Builder is trusted but additional modules were added; using the untrusted (5 phases) build flow
0.17.6: Pulling from buildpacksio/lifecycle
Digest: sha256:777c6e8ebdbd46b58ef9a154ab041c0cb3f2dd18f8f51ea725479a39139111a9
Status: Image is up to date for buildpacksio/lifecycle:0.17.6
===> ANALYZING
[analyzer] Timer: Analyzer started at 2024-10-06T16:44:32Z
[analyzer] Image with name "registry.fly.io/mixbot:cache" not found
[analyzer] Timer: Analyzer ran for 45.96µs and ended at 2024-10-06T16:44:32Z
===> DETECTING
[detector] Warning: Buildpack 'hashnuke/elixir@0.1' requests deprecated API '0.4'
[detector] Timer: Detector started at 2024-10-06T16:44:35Z
[detector] hashnuke/elixir 0.1
[detector] Timer: Detector ran for 6.10276ms and ended at 2024-10-06T16:44:35Z
===> RESTORING
[restorer] Warning: Buildpack 'hashnuke/elixir@0.1' requests deprecated API '0.4'
[restorer] Timer: Restorer started at 2024-10-06T16:44:36Z
[restorer] Timer: Restorer ran for 283.84µs and ended at 2024-10-06T16:44:36Z
===> BUILDING
[builder] Warning: Buildpack 'hashnuke/elixir@0.1' requests deprecated API '0.4'
[builder] Timer: Builder started at 2024-10-06T16:44:38Z
[builder] 
[builder] #######################################################################
[builder] 
[builder] ERROR: This buildpack is a legacy buildpack that has been shimmed
[builder] for compatibility with Cloud Native Buildpacks (CNBs) using the
[builder] cnb-shim service:
[builder] https://github.com/heroku/cnb-shim
[builder] 
[builder] The cnb-shim service is not actively maintained and does not support
[builder] modern Buildpack API and lifecycle versions.
[builder] 
[builder] In addition, the legacy builder images that use shimmed buildpacks
[builder] (such as 'heroku/buildpacks:20' or 'heroku/builder-classic:22') are
[builder] no longer supported and do not receive any security updates or fixes.
[builder] 
[builder] Please switch to one of our newer 'heroku/builder:*' builder images:
[builder] https://github.com/heroku/cnb-builder-images#available-images
[builder] 
[builder] If you are using the Pack CLI, you will need to adjust your '--builder'
[builder] CLI argument, or else change the default builder configuration using:
[builder] 'pack config default-builder <new_builder_name>'
[builder] 
[builder] If you are using a third-party platform to deploy your app, check their
[builder] documentation for how to adjust the builder image used for your build.
[builder] 
[builder] If you manually specify a cnb-shim buildpack URL (that refers to
[builder] 'cnb-shim.herokuapp.com') you will also need to update that to
[builder] the ID of a non-shimmed buildpack.
[builder] 
[builder] See here for Heroku's supported CNB languages:
[builder] https://github.com/heroku/buildpacks#supported-languages
[builder] 
[builder] Or search for community buildpacks here:
[builder] https://registry.buildpacks.io/
[builder] 
[builder] To ignore this error, set the env var ALLOW_EOL_SHIMMED_BUILDER to 1.
[builder] 
[builder] #######################################################################
[builder] 
[builder] Timer: Builder ran for 6.96281ms and ended at 2024-10-06T16:44:38Z
[builder] ERROR: failed to build: exit status 1
Error: failed to fetch an image or build from source: executing lifecycle: failed with status code: 51
elixir -v
Erlang/OTP 27 [erts-15.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Elixir 1.17.3 (compiled with Erlang/OTP 27)

My fly.toml file has this code

# fly.toml app configuration file generated for mixbot on 2024-10-06T19:21:35+03:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'mixbot'
primary_region = 'otp'

[build]
  builder = 'heroku/buildpacks:20'
  buildpacks = ['https://cnb-shim.herokuapp.com/v1/hashnuke/elixir']

[env]
  PORT = '8080'

[http_service]
  internal_port = 8080
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 0
  processes = ['app']

[[vm]]
  memory = '1gb'
  cpu_kind = 'shared'
  cpus = 1

fly-deploy.yaml has following code

# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
  push:
    branches:
      - main
jobs:
  deploy:
    name: Deploy app
    runs-on: ubuntu-latest
    concurrency: deploy-group    # optional: ensure only one action runs at a time
    steps:
      - uses: actions/checkout@v4
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - run: flyctl deploy --remote-only
        env:
          FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

Hmm it still doesn’t work after doing what the error message says?

yes it give one error saying about build pack not find something like that. i used heroku/buildpacks:24 but still no success.

If you’re getting the same error, either the ENV variable didn’t get piped through your docker or there’s a bug w/ the library.

what i dont get and i am an elixir noob here is why fly launch gives me outdated code?

The template probably gave you an old version some library which its deprecation date has expired… hence the error.

If you set that variable in your Dockerfile it should have ignored it.

so following dockerfile make my code work but all the tutorials were mentioning only fly launch should work and I was after that. only issue one command and deploy a simple app on fly.io has a huge appeal for noobs like me trying to figuring out stuff.

Don’t get me wrong after 5 days of head banging I am glad my code was running on fly.io

# Use the official Elixir image for a Linux environment
FROM elixir:1.17.3

# Install build dependencies for Bakeware
# RUN apt-get update && apt-get install -y \
#     build-essential \
#     git

# Set the working directory
WORKDIR /app

# Install Hex and Rebar
RUN mix local.hex --force && \
    mix local.rebar --force

# Copy the mix.exs and mix.lock files to set up the app
COPY mix.exs mix.lock ./

# Install dependencies
RUN mix deps.get

# Copy the rest of your application code to the container
COPY . .

# Set the environment to production for cross-compilation
ENV MIX_ENV=prod

# Compile the application and build the release using Bakeware
RUN  mix release unix

# Set up an entrypoint so we can manually extract the binary
ENTRYPOINT ["_build/prod/rel/unix/bin/unix", "start"]