Phoenix app hangs at startup

Hello,

I’m using fly.io for the first time, trying to deploy a Phoenix PoC. The app only serves WebSocket channels and has 2 JSON API routes on GET /scene and POST /scene.

I used fly launch to generate a Dockerfile and removed the assets-related parts, then deployed it with fly deploy. The deployment seemed to be OK, but after that the health checks fail:

==> Monitoring deployment

 1 desired, 1 placed, 0 healthy, 1 unhealthy [health checks: 1 total, 1 critical]
Failed Instances

Failure #1

Instance
ID              PROCESS VERSION REGION  DESIRED STATUS  HEALTH CHECKS           RESTARTS        CREATED
692f2f53                0       cdg     run     running 1 total, 1 critical     0               4m53s ago

Recent Events
TIMESTAMP               TYPE            MESSAGE
2022-03-10T07:11:12Z    Received        Task received by client
2022-03-10T07:11:12Z    Task Setup      Building Task Directory
2022-03-10T07:11:24Z    Started         Task started by client

2022-03-10T07:11:15Z   [info]Unpacking image
2022-03-10T07:11:22Z   [info]Preparing kernel init
2022-03-10T07:11:23Z   [info]Configuring firecracker
2022-03-10T07:11:24Z   [info]Starting virtual machine
2022-03-10T07:11:24Z   [info]Starting init (commit: 0c50bff)...
2022-03-10T07:11:24Z   [info]Preparing to run: `/app/bin/server` as nobody
2022-03-10T07:11:24Z   [info]2022/03/10 07:11:24 listening on [fdaa:0:5280:a7b:5adc:692f:2f53:2]:22 (DNS: [fdaa::3]:53)
--> v0 failed - Failed due to unhealthy allocations - no stable job version to auto revert to and deploying as v1

I also tried to open an IEx shell but it just hangs:

$ fly ssh console
Connecting to top1.nearest.of.multiplayer-poc.internal... complete
$ app/bin/server remote
# nothing happens

Oh that’s silly :see_no_evil:

My Phoenix app is named server, this creates an infinite exec loop in the rel/overlays/bin/server script:

#!/bin/sh
cd -P -- "$(dirname -- "$0")"
PHX_SERVER=true exec ./server start