- Run
mix releaselocally on your project. - Build the Dockerfile locally to verify it builds correctly.
docker build . - Check the
:prodconfig inconfig/runtime.exs, which is not used locally. Carefully review it. - Run
fly logsto check server logs.
- Run
fly logs -a <pg-db-name>to check database app’s server logs. - Run
fly checks list -a <pg-db-name>to check the database app’s health. - Run
fly status -a <pg-db-name> --allto see if any VMs failed. - Run
fly vm status <id> -a <pg-db-name>to debug a specific VM.
Diagnosis Tip
Most difficulties center around application config. Applications generated with an older version of Phoenix are configured differently than a newly generated app. If you have problems like connecting to your database, usually an IPv6 configuration update is needed. The internal networks at Fly.io use a IPv6 addresses. Elixir/OTP needs some config to work smoothly. One way to identify an issue is to generate a new Elixir application using a current version of Phoenix. Deploy that to Fly.io with a database. With that, you have a local working example to compare against. Don’t worry, you can easilydestroy the test app when you’re ready to.
Suggested files to pay attention to when looking for config differences.
config/config.exsconfig/prod.exsconfig/runtime.exsDockerfilemix.exs
Not Enough Connections
A common failure mode is the application exhausting the number of free connections, your defaultfly.toml has the following settings:
hard_limit and soft_limit closer to your needs will free up the number of live connections per node. A safe starting point could be 1000 for the hard_limit and 975 for the soft_limit. The “right” amount depends on how much data is actively stored in the LiveView processes. That value will vary for each application.
Clustering
Here are some troubleshooting tips when working with Clustering. When using IEx to remote into a running application to diagnose connection issues, note if you see this warning when connecting:--pty option.
Another indication of this situation is when typing Node.self(), the name of the node is returned with a prefix similar to “rem-ea46-”.
Example:
Testing Node Connectivity
Usinglibcluster is an easy way to auto-cluster an Elixir application. However, going through the process manually can help diagnose issues.
We can open two terminals locally on our machine. In terminal A, we get an IEx terminal to one node. Then in terminal B, we get an IEx terminal to a different node.
In each terminal, we can ask the node for it’s name:
true then it either connected to the other node or we entered into the wrong terminal and it says it’s connected to itself.
If we received a true response, we can check the list of connected nodes using this command: