Hi,
I’m trying to deploy a Phoenix (1.7) application however I’m not able to connect to the application:
flyctl logs
2023-03-15T12:28:29Z runner[1c47e583] lhr [info]Starting instance
2023-03-15T12:28:29Z runner[1c47e583] lhr [info]Configuring virtual machine
2023-03-15T12:28:29Z runner[1c47e583] lhr [info]Pulling container image
2023-03-15T12:28:30Z runner[1c47e583] lhr [info]Unpacking image
2023-03-15T12:28:30Z runner[1c47e583] lhr [info]Preparing kernel init
2023-03-15T12:28:30Z runner[1c47e583] lhr [info]Configuring firecracker
2023-03-15T12:28:30Z runner[1c47e583] lhr [info]Starting virtual machine
2023-03-15T12:28:30Z app[1c47e583] lhr [info]Starting init (commit: 08b4c2b)...
2023-03-15T12:28:30Z app[1c47e583] lhr [info]Preparing to run: `/app/bin/migrate` as nobody
2023-03-15T12:28:30Z app[1c47e583] lhr [info]2023/03/15 12:28:30 listening on [fdaa:1:811c:a7b:bada:1c47:e583:2]:22 (DNS: [fdaa::3]:53)
2023-03-15T12:28:33Z app[1c47e583] lhr [info]12:28:33.661 [info] Migrations already up
2023-03-15T12:28:33Z app[1c47e583] lhr [info]Starting clean up.
2023-03-15T12:28:41Z health[c88de016] lhr [warn]Health check on port 8080 is in a 'warning' state. Your app may not be responding properly. Services exposed on ports [80, 443] may have intermittent failures until the health check passes.
2023-03-15T12:28:49Z health[c88de016] lhr [error]Health check on port 8080 has failed. Your app is not responding properly. Services exposed on ports [80, 443] will have intermittent failures until the health check passes.
fly.toml
:
# fly.toml file generated for liveview-chat-example on 2023-03-15T11:43:34Z
app = "liveview-chat-example"
kill_signal = "SIGTERM"
kill_timeout = 5
primary_region = "lhr"
processes = []
[deploy]
release_command = "/app/bin/migrate"
[env]
PHX_HOST = "liveview-chat-example.fly.dev"
PORT = "8080"
[experimental]
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 1000
soft_limit = 1000
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"
I’ve tried to restart the vm but the error is still the same. Could it be an error on fly.io side or it there anything wrong with my configuration?
Thanks
I don’t see the Phoenix listening on port 8080 line.
Could you share your whole process? For example was this a fresh mix phx.new app with fly launch
?
1 Like
Thank you for your help with this.
The application has been updated from Phoenix 1.6 to 1.7 and at the same time attempted to deploy to Fly.io (it was on Heroku previously). So the fly launch
command was ran recently.
I’ve also attempted today to relaunch the application by deleting the fly.toml
and Dockerfile
files and rerunning flyctl launch
but have the same result.
I’ve tried to change the external port in fly.toml
to 4000
(I saw someone on another “old” post doing this) but had the same issue.
My flyctl
version is up to date (ran flyctl version update
today)
The code I’m working on can be found on this PR on Github: [PR] Adding configuration to deploy to fly.io and upgrading to Phoenix 1.7 by LuchoTurtle · Pull Request #111 · dwyl/phoenix-liveview-chat-example · GitHub
Hope this help. I’ll keep having a look at my code at the same time to see if I’m missing something.
Thank you so much for sharing your code that is a huge help.
Are those the only logs or is there anything else?
With flyctl status --all
:
Then flyctl vm status c88de016
I’ve tried to restart the vm with flyctl vm restart c88de016
and got VM c88de016 is being restarted
then checking the status again:
And I’m stuck at this stage
Trying to load https://liveview-chat-example.fly.dev display the following logs with flyctl logs
:
You undid this change right?
Are there any logs below “listening on [fdaa…”?
is the code in the pr the latest version you’ve been debugging with?
You undid this change right?
Yes I’ve removed this change.
is the code in the pr the latest version you’ve been debugging with?
I’ve just pushed the latest changes so it should be up to date now.
Are there any logs below “listening on [fdaa…”?
No I don’t think.
Just run again flyctl vm status c88de016
and this is the full output:
I was able to reproduce this on fly and locally.
If you run
MIX_ENV=prod mix compile
MIX_ENV=prod mix assets.deploy
MIX_ENV=prod mix release
MIX_ENV=prod DATABASE_URL=postgres://postgres:postgres@localhost/liveview_chat_example_dev SECRET_KEY_BASE=<long string> _build/prod/rel/bin/server
It also hangs.
I was able to spot the typo. [PR] Adding configuration to deploy to fly.io and upgrading to Phoenix 1.7 by LuchoTurtle · Pull Request #111 · dwyl/phoenix-liveview-chat-example · GitHub
1 Like
Amazing!! And also so stupid from my part to not have spotted this typo! Lesson learnt!
Good idea to test it also locally!
Thank you so much for finding the solution to this, I wasn’t 100% sure if the error was due to something failing on Fly or if it was a configuration error on the application itself.
1 Like
This was a tricky one! really hard to tell whats going on when erlang just… hangs.