Brand new Phoenix app failed due to unhealthy allocations

Hello, I have a newly generated Phoenix app v1.6.10

Up until I ran the flyctl launch command, there was no Dockerfile, release.ex, or any other deployment-related files. All that to say, I’m trying to deploy a vanilla phoenix application.

Whenever I run flyctrl deploy I get the following error:

1 desired, 1 placed, 0 healthy, 1 unhealthy
--> v2 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v3

--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort

The link references a section on port checking and it says that when you deploy, you see a message like this:

TCP 80/443 ⇢ 8080

EDIT: when I run fly launch I see the TCP 80/443 → 8080 message. I do not see it when I run fly deploy

I do not see that message at all. I’m not sure how to troubleshoot this as I can’t seem to make anything out from the logs.

2022-06-24T23:37:40Z runner[4721ded1] lax [info]Starting instance
2022-06-24T23:37:41Z runner[4721ded1] lax [info]Configuring virtual machine
2022-06-24T23:37:41Z runner[4721ded1] lax [info]Pulling container image
2022-06-24T23:37:41Z runner[4721ded1] lax [info]Unpacking image
2022-06-24T23:37:41Z runner[4721ded1] lax [info]Preparing kernel init
2022-06-24T23:37:41Z runner[4721ded1] lax [info]Configuring firecracker
2022-06-24T23:37:41Z runner[4721ded1] lax [info]Starting virtual machine
2022-06-24T23:37:41Z app[4721ded1] lax [info]Starting init (commit: e21acb3)...
2022-06-24T23:37:42Z app[4721ded1] lax [info]Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
2022-06-24T23:37:42Z app[4721ded1] lax [info]no label, UUID={some-uuid-here}
2022-06-24T23:37:42Z app[4721ded1] lax [info]Preparing to run: `/app/bin/migrate` as nobody
2022-06-24T23:37:42Z app[4721ded1] lax [info]2022/06/24 23:37:42 listening on [fdaa:0:71ed:a7b:a596:4721:ded1:2]:22 (DNS: [fdaa::3]:53)
2022-06-24T23:37:44Z app[4721ded1] lax [info]23:37:44.867 [info] Migrations already up
2022-06-24T23:37:45Z app[4721ded1] lax [info]Main child exited normally with code: 0
2022-06-24T23:37:45Z app[4721ded1] lax [info]Reaped child process with pid: 569 and signal: SIGUSR1, core dumped? false
2022-06-24T23:37:45Z app[4721ded1] lax [info]Starting clean up.

Has anyone run into this issue before? This is my first experience with Fly.io and I’m not too sure where to go from here.

Thanks!

Turns out the default config doesn’t set the PORT environment variable referenced in the runtime.exs file.

Setting it to 8080 in the fly.toml file solves the issue!

[env]
  PHX_HOST = "some-super-dope-app.fly.dev"
  PORT = "8080"

Setting that solves the issue! I think that’s definitely something worth mentioning in the docs.

Fly doesn’t export PORT, but your runtime.exs will default then to 4000. Your generated fly.toml should have had:

[[services]]
  ...
  internal_port = 4000

Which would let fly forward the default phoenix 4000 port. Can you confirm whether this line was present in your fly.toml after running fly launch? Thanks!

My fly.toml file included the following after running fly launch.

[[services]]
  ...
  internal_port = 8080

I removed the PORT option I mentioned in my previous comment and updated the internal_port value to 4000 (matching your example).

After deploying once more, I found that everything runs as expected!

Thanks, @chrismccord!

This is a bug in app detection in our CLI. It’s detecting Phoenix 1.6.10 as Phoenix 1.6.1. 1.6.1 isn’t as magical, so I think we generated you a bad config file. The fix is here, it’ll go out in our CLI shortly: fix launch detection for Phoenix 1.6.10 and greater by mrkurt · Pull Request #1025 · superfly/flyctl · GitHub

1 Like

@kurt good to know! Now I’m wondering if there are other changes I should be making? Should I try re-generating these files by deleting them and running flyctl launch once more? Or maybe there’s not much more of a difference?

Yeah that’s worth a try. fly version update should get you version 0.0.336. If you run fly launch with that, you should get a functional app.

I generated a new Phoenix project yesterday on flyctl v0.0.335. Knowing about the 1.6.10 detection bug I intentionally downgraded to phx_new 1.6.9, I still ended up with a 1.6.10 Phoenix app because of optimistic versioning, while avoiding the launch bug. But I did notice that even on 1.6.9 the default internal port in fly.toml was 8080. That might be a separate issue or at least warrant a note in the docs?

Thanks for fixing that issue @kurt!

Port 8080 is correct. It should actually create a config section like this:

[env]
PORT=8080

If it’s not doing that, something is broken.

The new app I just created had no PORT set in the env. On another project I had added [env] PORT = "8080" and that worked for me. On this new one I followed the LiveBeats example and changed internal_port = 4000, with nothing set for PORT in the env. That also worked. The default fly.toml seems to be incompatible with the default runtime.exs

EDIT:

Also can confirm that v0.0.336 is still missing the Phoenix 1.6.10 check, and that the default fly.toml on Phoenix apps looks like this:

# fly.toml file generated for weathered-surf-3966 on 2022-06-25T19:38:43-04:00

app = "weathered-surf-3966"
kill_signal = "SIGTERM"
kill_timeout = 5
processes = []

[env]
  PHX_HOST = "weathered-surf-3966.fly.dev"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

[[services]]
  http_checks = []
  internal_port = 8080
  processes = ["app"]
  protocol = "tcp"
  script_checks = []
  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    force_https = true
    handlers = ["http"]
    port = 80

  [[services.ports]]
    handlers = ["tls", "http"]
    port = 443

  [[services.tcp_checks]]
    grace_period = "1s"
    interval = "15s"
    restart_limit = 0
    timeout = "2s"

If you try to deploy with this, it hangs indefinitely until fixing the port issue

Hi, I have built a new project, boilerplate.

I added some html, followed the tutorial to add Tailwind.

And then I ran fly launch

System information:

  • MacOSX latest stable version
  • Macbook Pro 2019 intel
  • Updated phoenix to 1.16.10
  • Didn’t create a database

Later on, tried creating with database (on the fly ctl), also didn’t work.

I suspect this is happening because of either my region (gru) and/or tailwind. So I tried creating a sample Phoenix project and just deploy it. It failed. Here’s how it went:

$ mix phx.new exemplo
    Fetch and install dependencies? [Yn] Y
$ cd exemplo
$ mix ecto.create
$ fly launch
    Would you like to setup a Postgresql database now? (y/N) y
    (...)
    We recommend upgrading to Phoenix 1.6.3 which includes a release configuration for Docker-based deployment.
$ fly launch

And then it fails.

Error message:

==> Creating release
Release v2 created
Release command detected: this new release will not be available until the command succeeds.

You can detach the terminal anytime without stopping the deployment
==> Release command
Command: /app/bin/migrate
	 Starting instance
	 Configuring virtual machine
	 Pulling container image
	 Unpacking image
	 Preparing kernel init
	 Starting virtual machine
	 Starting init (commit: e21acb3)...
	 Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
	 no label, UUID=d392b0bf-41f7-4fc6-85ab-a4255daa05eb
	 Preparing to run: `/app/bin/migrate` as nobody
	 2022/06/25 13:08:21 listening on [fdaa:0:71f1:a7b:1f60:18b3:4778:2]:22 (DNS: [fdaa::3]:53)
	 13:08:24.008 [error] Postgrex.Protocol (#PID<0.136.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.solitary-water-4912-db.internal:5432): non-existing domain - :nxdomain
	 13:08:24.008 [error] Postgrex.Protocol (#PID<0.135.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.solitary-water-4912-db.internal:5432): non-existing domain - :nxdomain
	 13:08:25.242 [error] Postgrex.Protocol (#PID<0.136.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.solitary-water-4912-db.internal:5432): non-existing domain - :nxdomain
	 13:08:25.402 [error] Postgrex.Protocol (#PID<0.135.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.solitary-water-4912-db.internal:5432): non-existing domain - :nxdomain
	   * The database does not exist
	   * The "schema_migrations" table, which Ecto uses for managing
	     migrations, was defined by another library
	   * There is a deadlock while migrating (such as using concurrent
	 To fix the first issue, run "mix ecto.create".
	 To address the second, you can run "mix ecto.drop" followed by
	 "mix ecto.create". Alternatively you may configure Ecto to use
	 another table and/or repository for managing migrations:
	     config :exemplo, Exemplo.Repo,
	       migration_repo: AnotherRepoForSchemaMigrations
	 The full error report is shown below.
	   2. Tracking down slow queries and making sure they are running fast enough
	   3. Increasing the pool_size (although this increases resource consumption)
	   4. Allowing requests to wait longer by increasing :queue_target and :queue_interval
	     (ecto_sql 3.8.3) lib/ecto/adapters/sql.ex:932: Ecto.Adapters.SQL.raise_sql_call_error/1
	     (elixir 1.13.4) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
	     (ecto_sql 3.8.3) lib/ecto/adapters/sql.ex:1024: Ecto.Adapters.SQL.execute_ddl/4
	     (ecto_sql 3.8.3) lib/ecto/migrator.ex:146: Ecto.Migrator.with_repo/3
	 Main child exited normally with code: 1
	 Reaped child process with pid: 569 and signal: SIGUSR1, core dumped? false
	 Starting clean up.
Error Release command failed, deployment aborted

I added no code. I left private info there just to help debug.

But wow, I already put 25usd in my account just to try this service and I can’t deploy even a boilerplate.

It feels tiring, as a potential customer.

Here’s the full log

❯ mix phx.new exemplo
* creating exemplo/config/config.exs
* creating exemplo/config/dev.exs
* creating exemplo/config/prod.exs
* creating exemplo/config/runtime.exs
* creating exemplo/config/test.exs
* creating exemplo/lib/exemplo/application.ex
* creating exemplo/lib/exemplo.ex
* creating exemplo/lib/exemplo_web/views/error_helpers.ex
* creating exemplo/lib/exemplo_web/views/error_view.ex
* creating exemplo/lib/exemplo_web/endpoint.ex
* creating exemplo/lib/exemplo_web/router.ex
* creating exemplo/lib/exemplo_web/telemetry.ex
* creating exemplo/lib/exemplo_web.ex
* creating exemplo/mix.exs
* creating exemplo/README.md
* creating exemplo/.formatter.exs
* creating exemplo/.gitignore
* creating exemplo/test/support/channel_case.ex
* creating exemplo/test/support/conn_case.ex
* creating exemplo/test/test_helper.exs
* creating exemplo/test/exemplo_web/views/error_view_test.exs
* creating exemplo/lib/exemplo/repo.ex
* creating exemplo/priv/repo/migrations/.formatter.exs
* creating exemplo/priv/repo/seeds.exs
* creating exemplo/test/support/data_case.ex
* creating exemplo/lib/exemplo_web/controllers/page_controller.ex
* creating exemplo/lib/exemplo_web/views/page_view.ex
* creating exemplo/test/exemplo_web/controllers/page_controller_test.exs
* creating exemplo/test/exemplo_web/views/page_view_test.exs
* creating exemplo/assets/vendor/topbar.js
* creating exemplo/lib/exemplo_web/templates/layout/root.html.heex
* creating exemplo/lib/exemplo_web/templates/layout/app.html.heex
* creating exemplo/lib/exemplo_web/templates/layout/live.html.heex
* creating exemplo/lib/exemplo_web/views/layout_view.ex
* creating exemplo/lib/exemplo_web/templates/page/index.html.heex
* creating exemplo/test/exemplo_web/views/layout_view_test.exs
* creating exemplo/lib/exemplo/mailer.ex
* creating exemplo/lib/exemplo_web/gettext.ex
* creating exemplo/priv/gettext/en/LC_MESSAGES/errors.po
* creating exemplo/priv/gettext/errors.pot
* creating exemplo/assets/css/phoenix.css
* creating exemplo/assets/css/app.css
* creating exemplo/assets/js/app.js
* creating exemplo/priv/static/robots.txt
* creating exemplo/priv/static/images/phoenix.png
* creating exemplo/priv/static/favicon.ico

Fetch and install dependencies? [Yn]
* running mix deps.get
* running mix deps.compile

We are almost there! The following steps are missing:

    $ cd exemplo

Then configure your database in config/dev.exs and run:

    $ mix ecto.create

Start your Phoenix app with:

    $ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

    $ iex -S mix phx.server

❯ cd exemplo
❯ mix ecto.create
Compiling 14 files (.ex)
Generated exemplo app
The database for Exemplo.Repo has been created
❯ fly launch
Creating app in /Users/jeanlucaslima/dev/github.com/jeanlucaslima/exemplo
Scanning source code
Detected a Phoenix app
? App Name (leave blank to use an auto-generated name):
Automatically selected personal organization: Jean Lucas
? Select region: gru (São Paulo)
Created app solitary-water-4912 in organization personal
Set secrets on solitary-water-4912: SECRET_KEY_BASE
Preparing system for Elixir builds
Installing application dependencies
Running Docker release generator
Wrote config file fly.toml
? Would you like to setup a Postgresql database now? Yes
For pricing information visit: https://fly.io/docs/about/pricing/#postgresql-clusters
? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
Creating postgres cluster solitary-water-4912-db in organization personal
Postgres cluster solitary-water-4912-db created
  Username:    postgres
  Password:    [redacted]
  Hostname:    solitary-water-4912-db.internal
  Proxy Port:  5432
  PG Port: 5433
Save your credentials in a secure place, you won't be able to see them again!

Monitoring Deployment

1 desired, 1 placed, 1 healthy, 0 unhealthy [health checks: 3 total, 3 passing]
--> v0 deployed successfully

Connect to postgres
Any app within the personal organization can connect to postgres using the above credentials and the hostname "solitary-water-4912-db.internal."
For example: postgres://postgres:296055e332e4c4a2634aa903a9ffedd01c890c8a3e79aefc@solitary-water-4912-db.internal:5432

See the postgres docs for more information on next steps, managing postgres, connecting from outside fly:  https://fly.io/docs/reference/postgres/

Postgres cluster solitary-water-4912-db is now attached to solitary-water-4912
The following secret was added to solitary-water-4912:
  DATABASE_URL=postgres://solitary_water_4912:QQDdJaswY9LSYtE@top2.nearest.of.solitary-water-4912-db.internal:5432/solitary_water_4912
Postgres cluster solitary-water-4912-db is now attached to solitary-water-4912

We recommend upgrading to Phoenix 1.6.3 which includes a release configuration for Docker-based deployment.

If you do upgrade, you can run 'fly launch' again to get the required deployment setup.

If you don't want to uprade, you'll need to add a few files and configuration options manually.
We've placed a Dockerfile compatible with other Phoenix 1.6 apps in this directory. See
https://hexdocs.pm/phoenix/fly.html for details, including instructions for setting up
a Postgresql database.

❯ fly launch
An existing fly.toml file was found for app solitary-water-4912
App is not running, deploy...
Deploying solitary-water-4912
==> Validating app configuration
--> Validating app configuration done
Services
TCP 80/443 ⇢ 8080
Remote builder fly-builder-damp-shadow-4483 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon  40.02kB
[+] Building 54.2s (28/28) FINISHED
 => [internal] load remote build context                                                                                                                                                     0.0s
 => copy /context /                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/debian:bullseye-20210902-slim                                                                                                             1.6s
 => [internal] load metadata for docker.io/hexpm/elixir:1.13.4-erlang-25.0.2-debian-bullseye-20210902-slim                                                                                   1.6s
 => [builder  1/17] FROM docker.io/hexpm/elixir:1.13.4-erlang-25.0.2-debian-bullseye-20210902-slim@sha256:9d9b1c244804e80da042719578670ad08018efc614bb266641f96a288a898b1e                   0.0s
 => [stage-1 1/6] FROM docker.io/library/debian:bullseye-20210902-slim@sha256:e3ed4be20c22a1358020358331d177aa2860632f25b21681d79204ace20455a6                                               0.0s
 => CACHED [stage-1 2/6] RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales   && apt-get clean && rm -f /var/lib/apt/lists/*_*                               0.0s
 => CACHED [stage-1 3/6] RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen                                                                                                    0.0s
 => CACHED [stage-1 4/6] WORKDIR /app                                                                                                                                                        0.0s
 => CACHED [stage-1 5/6] RUN chown nobody /app                                                                                                                                               0.0s
 => CACHED [builder  2/17] RUN apt-get update -y && apt-get install -y build-essential git     && apt-get clean && rm -f /var/lib/apt/lists/*_*                                              0.0s
 => CACHED [builder  3/17] WORKDIR /app                                                                                                                                                      0.0s
 => CACHED [builder  4/17] RUN mix local.hex --force &&     mix local.rebar --force                                                                                                          0.0s
 => [builder  5/17] COPY mix.exs mix.lock ./                                                                                                                                                 0.0s
 => [builder  6/17] RUN mix deps.get --only prod                                                                                                                                             5.1s
 => [builder  7/17] RUN mkdir config                                                                                                                                                         0.3s
 => [builder  8/17] COPY config/config.exs config/prod.exs config/                                                                                                                           0.0s
 => [builder  9/17] RUN mix deps.compile                                                                                                                                                    41.3s
 => [builder 10/17] COPY priv priv                                                                                                                                                           0.0s
 => [builder 11/17] COPY lib lib                                                                                                                                                             0.0s
 => [builder 12/17] COPY assets assets                                                                                                                                                       0.0s
 => [builder 13/17] RUN mix assets.deploy                                                                                                                                                    2.4s
 => [builder 14/17] RUN mix compile                                                                                                                                                          0.9s
 => [builder 15/17] COPY config/runtime.exs config/                                                                                                                                          0.0s
 => [builder 16/17] COPY rel rel                                                                                                                                                             0.0s
 => [builder 17/17] RUN mix release                                                                                                                                                          1.9s
 => [stage-1 6/6] COPY --from=builder --chown=nobody:root /app/_build/prod/rel/exemplo ./                                                                                                    0.2s
 => exporting to image                                                                                                                                                                       0.2s
 => => exporting layers                                                                                                                                                                      0.2s
 => => writing image sha256:2889a58a47775fcc2511989acc37749bff771567960bb61ed39fdaa67bda9784                                                                                                 0.0s
 => => naming to registry.fly.io/solitary-water-4912:deployment-1656162406                                                                                                                   0.0s
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/solitary-water-4912]
301ddad2998d: Pushed
74ac0eec01c4: Mounted from dark-sun-6389
eea61e80bc84: Mounted from dark-sun-6389
3c648ad50c8b: Mounted from dark-sun-6389
d41c4ebb1dbd: Mounted from dark-sun-6389
ba5a5fe43301: Mounted from dark-sun-6389
deployment-1656162406: digest: sha256:93639018a97d771227e8e84e232ed32a40ba6be9ea6c482b714adf285c779da3 size: 1576
--> Pushing image done
Image: registry.fly.io/solitary-water-4912:deployment-1656162406
Image size: 117 MB
==> Creating release
Release v2 created
Release command detected: this new release will not be available until the command succeeds.

You can detach the terminal anytime without stopping the deployment
==> Release command
Command: /app/bin/migrate
	 Starting instance
	 Configuring virtual machine
	 Pulling container image
	 Unpacking image
	 Preparing kernel init
	 Starting virtual machine
	 Starting init (commit: e21acb3)...
	 Setting up swapspace version 1, size = 512 MiB (536866816 bytes)
	 no label, UUID=d392b0bf-41f7-4fc6-85ab-a4255daa05eb
	 Preparing to run: `/app/bin/migrate` as nobody
	 2022/06/25 13:08:21 listening on [fdaa:0:71f1:a7b:1f60:18b3:4778:2]:22 (DNS: [fdaa::3]:53)
	 13:08:24.008 [error] Postgrex.Protocol (#PID<0.136.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.solitary-water-4912-db.internal:5432): non-existing domain - :nxdomain
	 13:08:24.008 [error] Postgrex.Protocol (#PID<0.135.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.solitary-water-4912-db.internal:5432): non-existing domain - :nxdomain
	 13:08:25.242 [error] Postgrex.Protocol (#PID<0.136.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.solitary-water-4912-db.internal:5432): non-existing domain - :nxdomain
	 13:08:25.402 [error] Postgrex.Protocol (#PID<0.135.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (top2.nearest.of.solitary-water-4912-db.internal:5432): non-existing domain - :nxdomain
	   * The database does not exist
	   * The "schema_migrations" table, which Ecto uses for managing
	     migrations, was defined by another library
	   * There is a deadlock while migrating (such as using concurrent
	 To fix the first issue, run "mix ecto.create".
	 To address the second, you can run "mix ecto.drop" followed by
	 "mix ecto.create". Alternatively you may configure Ecto to use
	 another table and/or repository for managing migrations:
	     config :exemplo, Exemplo.Repo,
	       migration_repo: AnotherRepoForSchemaMigrations
	 The full error report is shown below.
	   2. Tracking down slow queries and making sure they are running fast enough
	   3. Increasing the pool_size (although this increases resource consumption)
	   4. Allowing requests to wait longer by increasing :queue_target and :queue_interval
	     (ecto_sql 3.8.3) lib/ecto/adapters/sql.ex:932: Ecto.Adapters.SQL.raise_sql_call_error/1
	     (elixir 1.13.4) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
	     (ecto_sql 3.8.3) lib/ecto/adapters/sql.ex:1024: Ecto.Adapters.SQL.execute_ddl/4
	     (ecto_sql 3.8.3) lib/ecto/migrator.ex:146: Ecto.Migrator.with_repo/3
	 Main child exited normally with code: 1
	 Reaped child process with pid: 569 and signal: SIGUSR1, core dumped? false
	 Starting clean up.
Error Release command failed, deployment aborted

If the standard is it and I’m missing something… How can I get a refund on the credits I put into it?

What does mix phx.new -v report? Did you upgrade your latest phoenix installer in between the 1.6.3 notice and your second time running fly launch? If not, you need to be on a newer phoenix since fly launch uses the phoenix release/docker generator under the hood. You can get a new app going with the following:

$ mix archive.install hex phx_new
$ mix phx.new example
$ cd example
$ fly launch

I’ll try that on a brand new project, @chrismccord. In one of my iterations I did change manually to 1.16.10 and updated, but yet got the same error. I’ll report it here.

The project structure/config changed on newer phoenix’s to better support releases, so easiest would be to start a fresh project on latest phx installer since you don’t have an existing app.

Looks like it’s that because the error message changed.

Yet it isn’t that.

But I tried upgrading it from 1.16.0 to 1.16.10 before and it didn’t work, that was the cli suggestion.

Now the project is not live, I have new errors. Will put them on the next reply.

Feedbacks:

(1) The error message couldn’t be worse, I spent hours not figuring out what I messed up because of the way it communicated I thought it was either environment or a database error.

(2) Even with phoenix 1.16.10 installed, I got the following message:

We recommend upgrading to Phoenix 1.6.3 which includes a release configuration for Docker-based deployment. 

If you do upgrade, you can run 'fly launch' again to get the required deployment setup.

Running fly launch again after that got me deployed.
This is not an ideal dev experience, especially if someone is just testing it out before deciding which tool to use.

❯ mix phx.new -v
Phoenix installer v1.6.10

❯ mix phx.new marmitex
* creating marmitex/config/config.exs
* creating marmitex/config/dev.exs
* creating marmitex/config/prod.exs
* creating marmitex/config/runtime.exs
* creating marmitex/config/test.exs
* creating marmitex/lib/marmitex/application.ex
* creating marmitex/lib/marmitex.ex
* creating marmitex/lib/marmitex_web/views/error_helpers.ex
* creating marmitex/lib/marmitex_web/views/error_view.ex
* creating marmitex/lib/marmitex_web/endpoint.ex
* creating marmitex/lib/marmitex_web/router.ex
* creating marmitex/lib/marmitex_web/telemetry.ex
* creating marmitex/lib/marmitex_web.ex
* creating marmitex/mix.exs
* creating marmitex/README.md
* creating marmitex/.formatter.exs
* creating marmitex/.gitignore
* creating marmitex/test/support/conn_case.ex
* creating marmitex/test/test_helper.exs
* creating marmitex/test/marmitex_web/views/error_view_test.exs
* creating marmitex/lib/marmitex/repo.ex
* creating marmitex/priv/repo/migrations/.formatter.exs
* creating marmitex/priv/repo/seeds.exs
* creating marmitex/test/support/data_case.ex
* creating marmitex/lib/marmitex_web/controllers/page_controller.ex
* creating marmitex/lib/marmitex_web/views/page_view.ex
* creating marmitex/test/marmitex_web/controllers/page_controller_test.exs
* creating marmitex/test/marmitex_web/views/page_view_test.exs
* creating marmitex/assets/vendor/topbar.js
* creating marmitex/lib/marmitex_web/templates/layout/root.html.heex
* creating marmitex/lib/marmitex_web/templates/layout/app.html.heex
* creating marmitex/lib/marmitex_web/templates/layout/live.html.heex
* creating marmitex/lib/marmitex_web/views/layout_view.ex
* creating marmitex/lib/marmitex_web/templates/page/index.html.heex
* creating marmitex/test/marmitex_web/views/layout_view_test.exs
* creating marmitex/lib/marmitex/mailer.ex
* creating marmitex/lib/marmitex_web/gettext.ex
* creating marmitex/priv/gettext/en/LC_MESSAGES/errors.po
* creating marmitex/priv/gettext/errors.pot
* creating marmitex/assets/css/phoenix.css
* creating marmitex/assets/css/app.css
* creating marmitex/assets/js/app.js
* creating marmitex/priv/static/robots.txt
* creating marmitex/priv/static/images/phoenix.png
* creating marmitex/priv/static/favicon.ico

Fetch and install dependencies? [Yn]
* running mix deps.get
* running mix deps.compile

We are almost there! The following steps are missing:

    $ cd marmitex

Then configure your database in config/dev.exs and run:

    $ mix ecto.create

Start your Phoenix app with:

    $ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

    $ iex -S mix phx.server

❯ cd marmitex

❯ mix ecto.create
Compiling 14 files (.ex)
Generated marmitex app
The database for Marmitex.Repo has already been created

❯ fly launch
Creating app in /Users/jeanlucaslima/dev/github.com/marmitadigital/marmitex
Scanning source code
Detected a Phoenix app
? App Name (leave blank to use an auto-generated name):
Automatically selected personal organization: Jean Lucas
? Select region: gru (São Paulo)
Created app blue-dew-8837 in organization personal
Set secrets on blue-dew-8837: SECRET_KEY_BASE
Preparing system for Elixir builds
Installing application dependencies
Running Docker release generator
Wrote config file fly.toml
? Would you like to setup a Postgresql database now? Yes
For pricing information visit: https://fly.io/docs/about/pricing/#postgresql-clusters
? Select configuration: Production - Highly available, 1x shared CPU, 256MB RAM, 10GB disk
Creating postgres cluster blue-dew-8837-db in organization personal
Postgres cluster blue-dew-8837-db created
  Username:    postgres
  Password:    [redacted]
  Hostname:    blue-dew-8837-db.internal
  Proxy Port:  5432
  PG Port: 5433
Save your credentials in a secure place, you won't be able to see them again!

Monitoring Deployment

2 desired, 2 placed, 2 healthy, 0 unhealthy [health checks: 6 total, 6 passing]
--> v0 deployed successfully

Connect to postgres
Any app within the personal organization can connect to postgres using the above credentials and the hostname "blue-dew-8837-db.internal."
For example: postgres://postgres:221974b6fd2d816e65fe6d7aaba597d00d0a059b7bce4256@blue-dew-8837-db.internal:5432

See the postgres docs for more information on next steps, managing postgres, connecting from outside fly:  https://fly.io/docs/reference/postgres/

Postgres cluster blue-dew-8837-db is now attached to blue-dew-8837
The following secret was added to blue-dew-8837:
  DATABASE_URL=postgres://blue_dew_8837:TC3lHl18UVwBkyB@top2.nearest.of.blue-dew-8837-db.internal:5432/blue_dew_8837
Postgres cluster blue-dew-8837-db is now attached to blue-dew-8837

We recommend upgrading to Phoenix 1.6.3 which includes a release configuration for Docker-based deployment.

If you do upgrade, you can run 'fly launch' again to get the required deployment setup.

If you don't want to uprade, you'll need to add a few files and configuration options manually.
We've placed a Dockerfile compatible with other Phoenix 1.6 apps in this directory. See
https://hexdocs.pm/phoenix/fly.html for details, including instructions for setting up
a Postgresql database.

# did this to be triple sure phoenix was in the right version
❯ cat mix.exs | grep ":phoenix"
      {:phoenix, "~> 1.6.10"},
      {:phoenix_ecto, "~> 4.4"},
      {:phoenix_html, "~> 3.0"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:phoenix_live_view, "~> 0.17.5"},
      {:phoenix_live_dashboard, "~> 0.6"},
❯ fly launch
An existing fly.toml file was found for app blue-dew-8837
App is not running, deploy...
Deploying blue-dew-8837
==> Validating app configuration
--> Validating app configuration done
Services
TCP 80/443 ⇢ 8080
Remote builder fly-builder-blue-cherry-400 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon  40.37kB
[+] Building 92.3s (28/28) FINISHED
 => [internal] load remote build context                                                                                                                        0.0s
 => copy /context /                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/hexpm/elixir:1.13.4-erlang-25.0.2-debian-bullseye-20210902-slim                                                      2.1s
 => [internal] load metadata for docker.io/library/debian:bullseye-20210902-slim                                                                                2.1s
 => [builder  1/17] FROM docker.io/hexpm/elixir:1.13.4-erlang-25.0.2-debian-bullseye-20210902-slim@sha256:9d9b1c244804e80da042719578670ad08018efc614bb266641f9  2.5s
 => => resolve docker.io/hexpm/elixir:1.13.4-erlang-25.0.2-debian-bullseye-20210902-slim@sha256:9d9b1c244804e80da042719578670ad08018efc614bb266641f96a288a898b  0.0s
 => => sha256:247ec2825166b6f151e5e8477bd79616e47200edccdebbefd1d8b5075a450200 5.06MB / 5.06MB                                                                  0.1s
 => => sha256:9d9b1c244804e80da042719578670ad08018efc614bb266641f96a288a898b1e 772B / 772B                                                                      0.0s
 => => sha256:3d33e8efd534a27054b5f21d1b6a12b1b0155f82d026cfa1396f5b2eb5643812 1.16kB / 1.16kB                                                                  0.0s
 => => sha256:0d8f1c16af737465560144aeb21cf0678f4ae382c52eaddbf9519039feac0efd 2.33kB / 2.33kB                                                                  0.0s
 => => sha256:11193a2496952011f9e3047cbccd0566ee78fe5ab8ff446c6ea8107a5026e48e 16.23MB / 16.23MB                                                                0.3s
 => => sha256:0245b0f09800ea694d5cfba629bd93700e51b0663e8b4f36daada1c9ee9fa7a7 44.38MB / 44.38MB                                                                0.6s
 => => sha256:f8416d8bac72cefc0ce17bd2dc0c03aa43e123d309db92ee23be9382192cf2ed 31.37MB / 31.37MB                                                                0.4s
 => => extracting sha256:f8416d8bac72cefc0ce17bd2dc0c03aa43e123d309db92ee23be9382192cf2ed                                                                       0.8s
 => => extracting sha256:11193a2496952011f9e3047cbccd0566ee78fe5ab8ff446c6ea8107a5026e48e                                                                       0.2s
 => => extracting sha256:0245b0f09800ea694d5cfba629bd93700e51b0663e8b4f36daada1c9ee9fa7a7                                                                       0.7s
 => => extracting sha256:247ec2825166b6f151e5e8477bd79616e47200edccdebbefd1d8b5075a450200                                                                       0.1s
 => [stage-1 1/6] FROM docker.io/library/debian:bullseye-20210902-slim@sha256:e3ed4be20c22a1358020358331d177aa2860632f25b21681d79204ace20455a6                  1.4s
 => => resolve docker.io/library/debian:bullseye-20210902-slim@sha256:e3ed4be20c22a1358020358331d177aa2860632f25b21681d79204ace20455a6                          0.0s
 => => sha256:e3ed4be20c22a1358020358331d177aa2860632f25b21681d79204ace20455a6 1.85kB / 1.85kB                                                                  0.0s
 => => sha256:8aa2e47f9a6cf001ecf3ad0f8439e1005743a3024b98e7bbf023ace55afea903 529B / 529B                                                                      0.0s
 => => sha256:7beb0248fd8163ea6effdf58af3e836c47f2f97d7e44e5109c95333c92190a48 1.46kB / 1.46kB                                                                  0.0s
 => => sha256:f8416d8bac72cefc0ce17bd2dc0c03aa43e123d309db92ee23be9382192cf2ed 31.37MB / 31.37MB                                                                0.4s
 => => extracting sha256:f8416d8bac72cefc0ce17bd2dc0c03aa43e123d309db92ee23be9382192cf2ed                                                                       0.8s
 => [stage-1 2/6] RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales   && apt-get clean && rm -f /var/lib/apt/lists/*_*        10.6s
 => [builder  2/17] RUN apt-get update -y && apt-get install -y build-essential git     && apt-get clean && rm -f /var/lib/apt/lists/*_*                       26.5s
 => [stage-1 3/6] RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen                                                                              1.7s
 => [stage-1 4/6] WORKDIR /app                                                                                                                                  0.0s
 => [stage-1 5/6] RUN chown nobody /app                                                                                                                         0.3s
 => [builder  3/17] WORKDIR /app                                                                                                                                0.0s
 => [builder  4/17] RUN mix local.hex --force &&     mix local.rebar --force                                                                                    8.1s
 => [builder  5/17] COPY mix.exs mix.lock ./                                                                                                                    0.0s
 => [builder  6/17] RUN mix deps.get --only prod                                                                                                                3.6s
 => [builder  7/17] RUN mkdir config                                                                                                                            0.3s
 => [builder  8/17] COPY config/config.exs config/prod.exs config/                                                                                              0.0s
 => [builder  9/17] RUN mix deps.compile                                                                                                                       42.8s
 => [builder 10/17] COPY priv priv                                                                                                                              0.0s
 => [builder 11/17] COPY lib lib                                                                                                                                0.0s
 => [builder 12/17] COPY assets assets                                                                                                                          0.0s
 => [builder 13/17] RUN mix assets.deploy                                                                                                                       2.6s
 => [builder 14/17] RUN mix compile                                                                                                                             1.0s
 => [builder 15/17] COPY config/runtime.exs config/                                                                                                             0.0s
 => [builder 16/17] COPY rel rel                                                                                                                                0.0s
 => [builder 17/17] RUN mix release                                                                                                                             2.0s
 => [stage-1 6/6] COPY --from=builder --chown=nobody:root /app/_build/prod/rel/marmitex ./                                                                      0.2s
 => exporting to image                                                                                                                                          0.2s
 => => exporting layers                                                                                                                                         0.2s
 => => writing image sha256:8f4eb814be2a93a28bf43c48f2b3668ab414ce72b5c586568fceb16519e2e017                                                                    0.0s
 => => naming to registry.fly.io/blue-dew-8837:deployment-1656168917                                                                                            0.0s
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/blue-dew-8837]
36fe7a0002e8: Pushed
e49a9e8f9d26: Pushed
1e02e925aaf5: Pushed
898a59035382: Pushed
dbcff59e3ee5: Pushed
ba5a5fe43301: Pushed
deployment-1656168917: digest: sha256:21588f33e3a1ce392945d5880afb00abca6f40d8dbc28c23863bb50f9e919f31 size: 1576
--> Pushing image done
Image: registry.fly.io/blue-dew-8837:deployment-1656168917
Image size: 118 MB
==> Creating release
Release v2 created
Release command detected: this new release will not be available until the command succeeds.

You can detach the terminal anytime without stopping the deployment
==> Release command
Command: /app/bin/migrate
	 Starting instance
	 Configuring virtual machine
	 Pulling container image
	 Unpacking image
	 Preparing kernel init
	 Configuring firecracker
	 Starting init (commit: e21acb3)...
	 Preparing to run: `/app/bin/migrate` as nobody
	 2022/06/25 14:57:32 listening on [fdaa:0:71f1:a7b:1f60:3365:1741:2]:22 (DNS: [fdaa::3]:53)
	 Reaped child process with pid: 569 and signal: SIGUSR1, core dumped? false
	 Starting clean up.
Monitoring Deployment

1 desired, 1 placed, 0 healthy, 0 unhealthy [health checks: 1 total, 1 critical]
1 desired, 1 placed, 0 healthy, 1 unhealthy [health checks: 1 total, 1 critical]
v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to
Failed Instances

==> Failure #1

Instance
  ID            = 34f5023e
  Process       =
  Version       = 0
  Region        = gru
  Desired       = run
  Status        = running
  Health Checks = 1 total, 1 critical
  Restarts      = 0
  Created       = 4m56s ago

Recent Events
TIMESTAMP            TYPE       MESSAGE
2022-06-25T14:57:48Z Received   Task received by client
2022-06-25T14:57:48Z Task Setup Building Task Directory
2022-06-25T14:57:52Z Started    Task started by client

Recent Logs
2022-06-25T14:57:51.000 [info] Configuring firecracker
2022-06-25T14:57:52.000 [info] Starting virtual machine
2022-06-25T14:57:52.000 [info] Starting init (commit: e21acb3)...
2022-06-25T14:57:52.000 [info] Preparing to run: `/app/bin/server` as nobody
2022-06-25T14:57:52.000 [info] 2022/06/25 14:57:52 listening on [fdaa:0:71f1:a7b:1f60:34f5:23e:2]:22 (DNS: [fdaa::3]:53)
2022-06-25T14:57:53.000 [info] Reaped child process with pid: 551, exit code: 0
2022-06-25T14:57:54.000 [info] 14:57:54.488 [info] Running MarmitexWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2022-06-25T14:57:54.000 [info] 14:57:54.491 [info] Access MarmitexWeb.Endpoint at https://blue-dew-8837.fly.dev
2022-06-25T14:57:55.000 [info] Reaped child process with pid: 572 and signal: SIGUSR1, core dumped? false
***v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1

Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort

Even with a brand new project it didn’t go on. I feel lost tbh. Reading the link sent me on the final message about how to troubleshoot. But it feels like I shouldn’t be troubleshooting a hello world created by Phoenix.

Hello! This is actually due to a bug in our CLI. It was treating Phoenix 1.6.10 projects as Phoenix 1.6.1. We just shipped a fix, so you should have a better experience if you run fly version update, remove fly.toml and Dockerfile from your directory, then run fly launch again.