What I’m trying to do
I’m trying to migrate my SaaS from Vercel to fly io. I want the whole infrastructure on flyio, starting from Postgres.
What’s working until now
- Created an account
- Installed the fly cli tool and logged in
- Successfully created an app (or a fly machine, idk)
- I chose the development instance from the list
The problem
I can’t stablish an external connection if my life depended on it.
When
13/08/2024
What I’ve tried
I followed the docs on how to stablish an external connection:
Most of the steps were not required as it was already configured from the beginning.
# fly config show --app diet-it
{
"app": "diet-it",
"primary_region": "gru",
"env": {
"FLY_SCALE_TO_ZERO": "1h",
"PRIMARY_REGION": "gru"
},
"mounts": [
{
"source": "pg_data",
"destination": "/data"
}
],
"services": [
{
"protocol": "tcp",
"internal_port": 5432,
"auto_start_machines": true,
"ports": [
{
"port": 5432,
"handlers": [
"pg_tls"
]
}
],
"concurrency": {
"type": "connections",
"hard_limit": 1000,
"soft_limit": 1000
}
},
{
"protocol": "tcp",
"internal_port": 5433,
"auto_start_machines": true,
"ports": [
{
"port": 5433,
"handlers": [
"pg_tls"
]
}
],
"concurrency": {
"type": "connections",
"hard_limit": 1000,
"soft_limit": 1000
}
}
],
"checks": {
"pg": {
"port": 5500,
"type": "http",
"interval": "15s",
"timeout": "10s",
"path": "/flycheck/pg"
},
"role": {
"port": 5500,
"type": "http",
"interval": "15s",
"timeout": "10s",
"path": "/flycheck/role"
},
"vm": {
"port": 5500,
"type": "http",
"interval": "15s",
"timeout": "10s",
"path": "/flycheck/vm"
}
},
"metrics": [
{
"port": 9187,
"path": "/metrics"
}
]
}
Here’s the output of some of the relevant commands:
# fly services list --app diet-it
PROTOCOL PORTS HANDLERS FORCE HTTPS PROCESS GROUP REGIONS MACHINES
TCP 5432 => 5432 [PG_TLS] False gru 1
TCP 5433 => 5433 [PG_TLS] False gru 1
# fly app list
NAME OWNER STATUS LATEST DEPLOY
diet-it diet-it suspended
# fly machine restart d891974b429928
Restarting machine d891974b429928
Waiting for d891974b429928 to become healthy (started, 3/3)
Machine d891974b429928 restarted successfully!
# fly app list
NAME OWNER STATUS LATEST DEPLOY
diet-it diet-it deployed
# fly ip list --app diet-it
VERSION IP TYPE REGION CREATED AT
v6 fdaa:9:d488:0:1::3 private global 23h38m ago
My tests
I always restarted the machine and made sure they were running before testing them
# pg_isready --host=diet-it.fly.dev --username=postgres --port=5432
diet-it.fly.dev:5432 - no response
# pg_isready --host=diet-it.fly.dev --username=postgres --port=5433
diet-it.fly.dev:5433 - no response
# pg_isready --host=dietit.fly.dev --username=postgres --port=5432
diet-it.fly.dev:5432 - no response
# pg_isready --host=dietit.fly.dev --username=postgres --port=5433
diet-it.fly.dev:5433 - no response
# pg_isready --host=[fdaa:9:d488:a7b:136:3b13:34ec:2] --username=postgres --port=5432
[fdaa:9:d488:a7b:136:3b13:34ec:2]:5432 - no response
# pg_isready --host=fdaa:9:d488:0:1::3 --username=postgres --port=5432
fdaa:9:d488:0:1::3:5432 - no response
Question
What am I don’t wrong and how can I fix it? I need to be able to connect to this database with other fly instances, but also with external connections not whithing the fly io infrastructure