deploy, RUN mix release, "failed to compute cache key: not found"

Trying to deploy my first fly app.

Converted the Phoenix app from 1.60 to 1.66 and then ran

flyctl --app cgspace deploy .

Seems like it’s close to working; here’s the tail end of the deploy output:

flyctl --app cgspace deploy .
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-dawn-pond-7249 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
[+] Building 30.2s (0/1)
[+] Building 91.1s (27/27) FINISHED
 => [internal] load remote build context                                                                           0.0s
 => copy /context /
//....etc...
 => [builder 16/17] COPY rel rel                                                                                   0.0s
 => [builder 17/17] RUN mix release                                                                                2.6s
 => ERROR [stage-1 6/6] COPY --from=builder --chown=nobody:root /app/_build/prod/rel/cgspace ./                    0.0s
------
 > [stage-1 6/6] COPY --from=builder --chown=nobody:root /app/_build/prod/rel/cgspace ./:
------
Error failed to fetch an image or build from source: error building: failed to compute cache key: "/app/_build/prod/rel/cgspace" not found: not found

Hello @sensiblearts!

Since this app was updated, it’s possible that differences between the Phx generators used originally on your app and the newer releases may be the problem.

Looking at the log, my guess is it’s something in the ./rel/ folder. That’s part of the Elixir release config. The logs shows it failed during the remote Docker build, but you can test it a little locally too.

Try running mix release. Does that compile without error?

1 Like

SOLVED:

Your mix.exs release name must match the app name:

releases: [
        # bad cgbeta1: [
   
     # good:
        cgspace: [
          include_executables_for: [:unix],
          applications: [cgspace: :permanent]
        ],
      ]
1 Like

Glad you found the solution!

1 Like

Thank you, I made it past that and now am getting this??:

==> Release command detected: /app/bin/migrate

--> This release will not be available until the release command succeeds.
         Starting instance
         Configuring virtual machine
         Pulling container image
         Unpacking image
         Preparing kernel init
         Configuring firecracker
         2022/01/05 21:51:01 listening on [fdaa:0:4327:a7b:81:5c52:5568:2]:22 (DNS: [fdaa::3]:53)
         ERROR! Config provider Config.Reader failed with:
             (elixir 1.13.1) lib/code.ex:403: Code.validated_eval_string/3
             (elixir 1.13.1) lib/config/provider.ex:238: Config.Provider.boot_providers/4
         init terminating in do_boot ({,[{Elixir.Code,validated_eval_string,3,[{_},{_}]},{Elixir.Config,__eval__!,3,[{_},{_}]},{Elixir.Config.Reader,read!,2,[{_},{_}]},{Elixir.Config.Reader,load,2,[{_},{_}]},{Elixir.Config.Provider,-run_providers/2-fun-0-,2,[{_},{_}]},{Elixir.Enum,-reduce/3-lists^foldl/2-0-,3,[{_},{_}]},{Elixir.Config.Provider,boot_providers,4,[{_},{_}]}]})
         Main child exited normally with code: 1
         Starting clean up.
Error Release command failed, deployment aborted

Any thoughts on the next obstacle (above, Config.Reader)? thanks

Looks like it built the release and tried to run the migrations and blew up.

The hint is ERROR! Config provider Config.Reader failed.

Something in the app config is still wrong. Check the app names used in your config/runtime.exs.

1 Like

Thanks. I’ll dig into it.

While you’re here: is the PostGIS extension enabled? I saw a post that it was now available. My migrations create the extension.

Good question! Here’s some details on that: Deploying postgis

Thank you, @Mark I got the app deployed.

There is some glitch in the tailwindcss pipeline, but I’ll figure it out.

Just wanted to let you know that migrations ran smoothly, so the PostGIS must be supported now in the default postgres image.
cgspace.fly.dev

Nice!

Check out the recent Phoenix project improvement for getting TailwindCSS support working. Tailwind Standalone for Phoenix · Fly

But it looks like the “purge” step is too aggressive. You may need to tweak the generated Dockefile.

In the Dockerfile, look for a comment with “note: if your project uses a tool like https://purgecss.com/” and follow it to make the change. This may be your issue.

Thanks. You told me this before but I’m getting old and thick-headed.

Will report back.

1 Like

I HUMBLY APOLOGIZE for not paying more attention to your earlier “purge step” suggestion.

That fixed it!

I owe you a beer

2 Likes