My Elixir/Phoenix app deployed successfully, but after a few hours it seems to constantly restart.
I’ve followed the Elixir & Phoenix guide, latest version as of July 12th.
I’ve tried a few things to fix:
- Built my release locally, with
MIX_ENV=prod mix release
- with associated necessary local environment variables and proper IPv6 local networking. My local server does not seem to run into these issues. - Built my deploy using
flyctl deploy --remote-only
to cut my local Docker setup out of the equation - I’m running a MBP 16" with an 8-Core Intel Core i9 - the image still has issues when I release this way
How should I proceed to test this?
Something is wrong with my app - but the issue only seems to show itself when running on Fly.
Here’s a sample of the logs:
2021-07-14T01:47:52.330482590Z app[848a90fd] ewr [info] Running: `bin/fitclub start` as nobody
2021-07-14T01:47:52.339742509Z app[848a90fd] ewr [info] 2021/07/14 01:47:52 listening on [fdaa:0:285f:a7b:ab3:848a:90fd:2]:22 (DNS: [fdaa::3]:53)
2021-07-14T01:47:53.336943776Z app[848a90fd] ewr [info] Reaped child process with pid: 547, exit code: 0
2021-07-14T01:47:56.678136687Z app[848a90fd] ewr [info] [info] Running FitclubWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2021-07-14T01:47:56.681211093Z app[848a90fd] ewr [info] [info] Access FitclubWeb.Endpoint at http://fitclub-stage.fly.dev
2021-07-14T01:47:57.342251518Z app[848a90fd] ewr [info] Reaped child process with pid: 568 and signal: SIGUSR1, core dumped? false
2021-07-14T01:47:57.342766577Z app[848a90fd] ewr [info] Reaped child process with pid: 573, exit code: 0
2021-07-14T01:50:16.510121686Z app[848a90fd] ewr [info] Reaped child process with pid: 624, exit code: 0
2021-07-14T01:50:16.510638509Z app[848a90fd] ewr [info] Reaped child process with pid: 626, exit code: 0
2021-07-14T01:50:16.511397512Z app[848a90fd] ewr [info] Reaped child process with pid: 645 and signal: SIGUSR1, core dumped? false
2021-07-14T01:50:17.513662008Z app[848a90fd] ewr [info] Reaped child process with pid: 647 and signal: SIGUSR1, core dumped? false
2021-07-14T01:50:17.514576707Z app[848a90fd] ewr [info] Reaped child process with pid: 571 and signal: SIGUSR1, core dumped? false
2021-07-14T01:50:19.517573716Z app[848a90fd] ewr [info] Reaped child process with pid: 681, exit code: 0
2021-07-14T01:50:19.518132949Z app[848a90fd] ewr [info] Reaped child process with pid: 683, exit code: 0
2021-07-14T01:50:27.527585460Z app[848a90fd] ewr [info] Reaped child process with pid: 702 and signal: SIGUSR1, core dumped? false
2021-07-14T01:50:29.530423737Z app[848a90fd] ewr [info] Main child exited normally with code: 0
2021-07-14T01:50:29.530686025Z app[848a90fd] ewr [info] Starting clean up.
2021-07-14T01:50:31.400285786Z runner[848a90fd] ewr [info] Starting instance
2021-07-14T01:50:31.429738823Z runner[848a90fd] ewr [info] Configuring virtual machine
2021-07-14T01:50:31.430675855Z runner[848a90fd] ewr [info] Pulling container image
2021-07-14T01:50:31.588688542Z runner[848a90fd] ewr [info] Unpacking image
2021-07-14T01:50:31.591985772Z runner[848a90fd] ewr [info] Preparing kernel init
2021-07-14T01:50:32.029536408Z runner[848a90fd] ewr [info] Configuring firecracker
2021-07-14T01:50:32.057381328Z runner[848a90fd] ewr [info] Starting virtual machine
2021-07-14T01:50:32.193265345Z app[848a90fd] ewr [info] Starting init (commit: cc4f071)...
2021-07-14T01:50:32.208863466Z app[848a90fd] ewr [info] Running: `bin/fitclub start` as nobody
2021-07-14T01:50:32.218317434Z app[848a90fd] ewr [info] 2021/07/14 01:50:32 listening on [fdaa:0:285f:a7b:ab3:848a:90fd:2]:22 (DNS: [fdaa::3]:53)
2021-07-14T01:50:33.215583785Z app[848a90fd] ewr [info] Reaped child process with pid: 547, exit code: 0
2021-07-14T01:50:36.518814357Z app[848a90fd] ewr [info] [info] Running FitclubWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2021-07-14T01:50:36.521640581Z app[848a90fd] ewr [info] [info] Access FitclubWeb.Endpoint at http://fitclub-stage.fly.dev
2021-07-14T01:50:37.220921674Z app[848a90fd] ewr [info] Reaped child process with pid: 568 and signal: SIGUSR1, core dumped? false
2021-07-14T01:50:37.221419030Z app[848a90fd] ewr [info] Reaped child process with pid: 573, exit code: 0
2021-07-14T01:51:13.333912150Z runner[848a90fd] ewr [info] Shutting down virtual machine
2021-07-14T01:51:13.390749512Z app[848a90fd] ewr [info] Sending signal SIGINT to main child process w/ PID 507
2021-07-14T01:51:13.391760515Z app[848a90fd] ewr [info] BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
2021-07-14T01:51:13.392391454Z app[848a90fd] ewr [info] (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
2021-07-14T01:51:24.224924073Z runner[848a90fd] ewr [info] Starting instance
2021-07-14T01:51:24.255400147Z runner[848a90fd] ewr [info] Configuring virtual machine
2021-07-14T01:51:24.256453119Z runner[848a90fd] ewr [info] Pulling container image
2021-07-14T01:51:24.404332917Z runner[848a90fd] ewr [info] Unpacking image
2021-07-14T01:51:24.407531790Z runner[848a90fd] ewr [info] Preparing kernel init
2021-07-14T01:51:24.841398651Z runner[848a90fd] ewr [info] Configuring firecracker
2021-07-14T01:51:24.873218870Z runner[848a90fd] ewr [info] Starting virtual machine
2021-07-14T01:51:25.002611424Z app[848a90fd] ewr [info] Starting init (commit: cc4f071)...
2021-07-14T01:51:25.019309807Z app[848a90fd] ewr [info] Running: `bin/fitclub start` as nobody
2021-07-14T01:51:25.027683611Z app[848a90fd] ewr [info] 2021/07/14 01:51:25 listening on [fdaa:0:285f:a7b:ab3:848a:90fd:2]:22 (DNS: [fdaa::3]:53)
2021-07-14T01:51:26.026085782Z app[848a90fd] ewr [info] Reaped child process with pid: 547, exit code: 0
2021-07-14T01:51:29.406696991Z app[848a90fd] ewr [info] [info] Running FitclubWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2021-07-14T01:51:29.409969123Z app[848a90fd] ewr [info] [info] Access FitclubWeb.Endpoint at http://fitclub-stage.fly.dev
2021-07-14T01:51:30.030815354Z app[848a90fd] ewr [info] Reaped child process with pid: 568 and signal: SIGUSR1, core dumped? false
2021-07-14T01:51:30.031379517Z app[848a90fd] ewr [info] Reaped child process with pid: 573, exit code: 0
2021-07-14T01:51:56.063673726Z app[848a90fd] ewr [info] Reaped child process with pid: 619, exit code: 0
2021-07-14T01:51:56.064415686Z app[848a90fd] ewr [info] Reaped child process with pid: 621, exit code: 0
2021-07-14T01:51:56.065309566Z app[848a90fd] ewr [info] Reaped child process with pid: 640 and signal: SIGUSR1, core dumped? false
2021-07-14T01:51:56.066065894Z app[848a90fd] ewr [info] Reaped child process with pid: 642 and signal: SIGUSR1, core dumped? false
2021-07-14T01:51:56.067224898Z app[848a90fd] ewr [info] Reaped child process with pid: 571 and signal: SIGUSR1, core dumped? false
2021-07-14T01:52:03.074914798Z app[848a90fd] ewr [info] Main child exited normally with code: 0
2021-07-14T01:52:03.075269172Z app[848a90fd] ewr [info] Starting clean up.
2021-07-14T01:52:06.138262359Z runner[848a90fd] ewr [info] Starting instance
2021-07-14T01:52:06.168388547Z runner[848a90fd] ewr [info] Configuring virtual machine
2021-07-14T01:52:06.169328144Z runner[848a90fd] ewr [info] Pulling container image
2021-07-14T01:52:06.529652537Z runner[848a90fd] ewr [info] Unpacking image
2021-07-14T01:52:06.535950593Z runner[848a90fd] ewr [info] Preparing kernel init
2021-07-14T01:52:06.934280787Z runner[848a90fd] ewr [info] Configuring firecracker
2021-07-14T01:52:06.972644620Z runner[848a90fd] ewr [info] Starting virtual machine
2021-07-14T01:52:07.098776121Z app[848a90fd] ewr [info] Starting init (commit: cc4f071)...
2021-07-14T01:52:07.114653544Z app[848a90fd] ewr [info] Running: `bin/fitclub start` as nobody
2021-07-14T01:52:07.124007451Z app[848a90fd] ewr [info] 2021/07/14 01:52:07 listening on [fdaa:0:285f:a7b:ab3:848a:90fd:2]:22 (DNS: [fdaa::3]:53)
2021-07-14T01:52:08.121382630Z app[848a90fd] ewr [info] Reaped child process with pid: 547, exit code: 0
2021-07-14T01:52:11.621162950Z app[848a90fd] ewr [info] [info] Running FitclubWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2021-07-14T01:52:11.624582383Z app[848a90fd] ewr [info] [info] Access FitclubWeb.Endpoint at http://fitclub-stage.fly.dev
2021-07-14T01:52:12.126066024Z app[848a90fd] ewr [info] Reaped child process with pid: 568 and signal: SIGUSR1, core dumped? false
2021-07-14T01:52:12.126650836Z app[848a90fd] ewr [info] Reaped child process with pid: 573, exit code: 0
2021-07-14T01:53:54.248339453Z app[848a90fd] ewr [info] Reaped child process with pid: 648, exit code: 0
2021-07-14T01:53:54.248897774Z app[848a90fd] ewr [info] Reaped child process with pid: 650, exit code: 0
2021-07-14T01:53:54.249740136Z app[848a90fd] ewr [info] Reaped child process with pid: 669 and signal: SIGUSR1, core dumped? false
2021-07-14T01:53:55.252734510Z app[848a90fd] ewr [info] Reaped child process with pid: 671 and signal: SIGUSR1, core dumped? false
2021-07-14T01:53:55.253912630Z app[848a90fd] ewr [info] Reaped child process with pid: 571 and signal: SIGUSR1, core dumped? false
2021-07-14T01:54:04.915436128Z app[848a90fd] ewr [info] ERROR! Got infinite loop when running Config.Provider. Please make sure "/app/releases/0.1.0/sys.config" is writable and accessible or choose a different path
2021-07-14T01:54:04.918893102Z app[848a90fd] ewr [info] {"init terminating in do_boot",{<<"aborting boot">>,[{'Elixir.Config.Provider',boot,2,[]}]}}
2021-07-14T01:54:04.920083185Z app[848a90fd] ewr [info] init terminating in do_boot ({,[{Elixir.Config.Provider,boot,2,[]}]})
2021-07-14T01:54:05.073372721Z app[848a90fd] ewr [info] Crash dump is being written to: erl_crash.dump...done
2021-07-14T01:54:05.264998777Z app[848a90fd] ewr [info] Main child exited normally with code: 1
2021-07-14T01:54:05.265775524Z app[848a90fd] ewr [info] Reaped child process with pid: 674 and signal: SIGUSR1, core dumped? false
2021-07-14T01:54:05.266044946Z app[848a90fd] ewr [info] Starting clean up.
2021-07-14T01:54:08.167341230Z runner[848a90fd] ewr [info] Starting instance
2021-07-14T01:54:08.201459069Z runner[848a90fd] ewr [info] Configuring virtual machine
2021-07-14T01:54:08.202456796Z runner[848a90fd] ewr [info] Pulling container image
2021-07-14T01:54:08.347426891Z runner[848a90fd] ewr [info] Unpacking image
2021-07-14T01:54:08.353660775Z runner[848a90fd] ewr [info] Preparing kernel init
2021-07-14T01:54:08.789044050Z runner[848a90fd] ewr [info] Configuring firecracker
2021-07-14T01:54:08.816168329Z runner[848a90fd] ewr [info] Starting virtual machine
2021-07-14T01:54:08.953194478Z app[848a90fd] ewr [info] Starting init (commit: cc4f071)...
2021-07-14T01:54:08.970114563Z app[848a90fd] ewr [info] Running: `bin/fitclub start` as nobody
2021-07-14T01:54:08.979830489Z app[848a90fd] ewr [info] 2021/07/14 01:54:08 listening on [fdaa:0:285f:a7b:ab3:848a:90fd:2]:22 (DNS: [fdaa::3]:53)
2021-07-14T01:54:09.978090339Z app[848a90fd] ewr [info] Reaped child process with pid: 547, exit code: 0
2021-07-14T01:54:13.378275290Z app[848a90fd] ewr [info] [info] Running FitclubWeb.Endpoint with cowboy 2.9.0 at :::4000 (http)
2021-07-14T01:54:13.381802126Z app[848a90fd] ewr [info] [info] Access FitclubWeb.Endpoint at http://fitclub-stage.fly.dev
2021-07-14T01:54:13.983761953Z app[848a90fd] ewr [info] Reaped child process with pid: 568 and signal: SIGUSR1, core dumped? false
2021-07-14T01:54:13.984319954Z app[848a90fd] ewr [info] Reaped child process with pid: 573, exit code: 0
env.sh.eex
#!/bin/sh
ip=$(grep fly-local-6pn /etc/hosts | cut -f 1)
# Check blank IP
if [ -z "$ip" ]
then
ip="0:0:0:0:0:0:0:1"
fi
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE=$FLY_APP_NAME@$ip
echo "--------------------------------------------------"
echo $RELEASE_NODE
echo "--------------------------------------------------"
export ELIXIR_ERL_OPTIONS="-proto_dist inet6_tcp"
runtime.exs
import Config
if config_env() == :prod do
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||
raise """
environment variable SECRET_KEY_BASE is missing.
You can generate one by calling: mix phx.gen.secret
"""
app_name =
System.get_env("FLY_APP_NAME") ||
raise "FLY_APP_NAME not available"
config :fitclub, FitclubWeb.Endpoint,
server: true,
url: [host: "#{app_name}.fly.dev", port: 80],
force_ssl: [rewrite_on: [:x_forwarded_proto]],
http: [
port: String.to_integer(System.get_env("PORT") || "4000"),
# IMPORTANT: support IPv6 addresses
transport_options: [socket_opts: [:inet6]]
],
secret_key_base: secret_key_base
database_url =
System.get_env("DATABASE_URL") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
"""
config :fitclub, Fitclub.Repo,
url: database_url,
# IMPORTANT: Or it won't find the DB server
socket_options: [:inet6],
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
end