superfly / flyctl

Command line tools for fly.io services
https://fly.io
Apache License 2.0
1.39k stars 232 forks source link

Error: failed running /opt/homebrew/bin/mix phx.gen.release --docker: exit status 1 #3089

Open buildreactive opened 9 months ago

buildreactive commented 9 months ago

Describe the bug flyctl fails to launch app and exits without useful diagnostics:

Running Docker release generator
Error: failed running /opt/homebrew/bin/mix phx.gen.release --docker: exit status 1

** Paste your fly.toml flyctl exits before writing the fly.toml (so there is none).

Command output:

> fly launch
Scanning source code
Resolving Hex dependencies...
Resolution completed in 0.151s
Unchanged:
  ash 2.17.4
  bunt 0.2.1
  castore 1.0.4
  comparable 1.0.0
  cowboy 2.10.0
  cowboy_telemetry 0.4.0
  cowlib 2.12.1
  credo 1.7.1
  db_connection 2.6.0
  decimal 2.1.1
  dialyxir 1.4.2
  earmark 1.4.46
  ecto 3.11.0
  ecto_sql 3.11.0
  elixir_make 0.7.7
  erlex 0.2.6
  esbuild 0.8.1
  ets 0.9.0
  expo 0.4.1
  file_system 0.2.10
  finch 0.16.0
  floki 0.35.2
  gettext 0.23.1
  hpax 0.1.2
  jason 1.4.1
  lettuce 0.3.0
  libgraph 0.16.0
  mime 2.0.5
  mint 1.5.1
  mix_test_interactive 1.2.2
  nimble_options 1.0.2
  nimble_pool 1.0.0
  phoenix 1.7.10
  phoenix_ecto 4.4.3
  phoenix_html 3.3.3
  phoenix_live_dashboard 0.8.3
  phoenix_live_reload 1.4.1
  phoenix_live_view 0.20.1
  phoenix_pubsub 2.1.3
  phoenix_template 1.0.3
  picosat_elixir 0.2.3
  plug 1.15.2
  plug_cowboy 2.6.1
  plug_crypto 2.0.0
  postgrex 0.17.3
  propcheck 1.4.1
  proper 1.4.0
  ranch 1.8.0
  sourceror 0.14.1
  spark 1.1.51
  stream_data 0.6.0
  swoosh 1.14.1
  tailwind 0.2.2
  telemetry 1.2.1
  telemetry_metrics 0.6.1
  telemetry_poller 1.0.0
  typable 0.3.0
  typed_struct 0.3.0
  websock 0.5.3
  websock_adapter 0.5.5
[info] current directory: /Users/zac/Projects/BossLogic/boss_umbrella
[info] watching folders: ["lib"]
Detected a Phoenix app
Creating app in /Users/zac/Projects/BossLogic/boss_umbrella
We're about to launch your Phoenix app on Fly.io. Here's what you're getting:

Organization: Zac                    (fly launch defaults to the personal org)
Name:         boss-umbrella          (derived from your directory name)
Region:       Ashburn, Virginia (US) (this is the fastest region for you)
App Machines: shared-cpu-1x, 1GB RAM (most apps need about 1GB of RAM)
Postgres:     <none>                 (not requested)
Redis:        <none>                 (not requested)

? Do you want to tweak these settings before proceeding? No
Created app 'boss-umbrella' in organization 'personal'
Admin URL: https://fly.io/apps/boss-umbrella
Hostname: boss-umbrella.fly.dev
Set secrets on boss-umbrella: SECRET_KEY_BASE
Preparing system for Elixir builds
Installing application dependencies
Running Docker release generator
Error: failed running /opt/homebrew/bin/mix phx.gen.release --docker: exit status 1

I tried running the following to get diagnostic output:

> LOG_LEVEL=debug fly launch --remote-only

Results were uninformative. Truncating as there was a lot of output.

DEBUG {}
DEBUG <-- 200 https://api.fly.io/graphql (135.09ms)

DEBUG {
  "data": {
    "setSecrets": {
      "release": null
    }
  }
}

Set secrets on boss-umbrella: SECRET_KEY_BASE
Preparing system for Elixir builds
Installing application dependencies
Running Docker release generator
DEBUG Task manager done
Error: failed running /opt/homebrew/bin/mix phx.gen.release --docker: exit status 1

The next line should have been:

Wrote config file fly.toml

But it never gets there.

buildreactive commented 9 months ago

Oh.

I see. Took a while figure this out but fly launch doesn't seem to work with umbrella apps. :( Looks like it's trying to do a phx.gen.release in the root:

mix phx.gen.release
** (Mix) mix phx.gen.release is not supported in umbrella applications.

Run this task in your web application instead.

But if I try from the individual applications I run into other problems:

 => CACHED [builder 14/17] RUN mix compile                                                                                                                 0.0s
 => ERROR [builder 15/17] COPY config/runtime.exs config/                                                                                                  0.0s
------
 > [builder  5/17] COPY mix.exs mix.lock ./:
------
------
 > [builder  8/17] COPY config/config.exs config/prod.exs config/:
------
------
 > [builder 15/17] COPY config/runtime.exs config/:
------
Error: failed to fetch an image or build from source: error building: failed to solve: failed to compute cache key: "/config/runtime.exs" not found: not found