I need to access a fly.io hosted database from the managed version of Retool. What is the best way to do this? Retool supports ssh tunneling and direct TCP database connections. It doesn’t support wireguard or running custom commands.
Is it possible to connect to a fly.io Postgres instance through pure SSH tunneling without having to use a bastion/proxy? I would also prefer not to have to renew SSH certs every 72 hours.
$ fly ips allocate-v4 # you can also allocate ipv6
2. Configure External Port
Start by saving the database’s fly config to disk in an empty dir:
$ fly config save --app $YOUR_DB
This will create a new fly.toml file with the database config. You can also save it as something like fly.db.toml in your existing app’s directory. Add the following services section to the config (remember to remove the empty services section at the top first):
internal_port = 5432 # Postgres instance
protocol = "tcp"
# Example of opening port 12500 for insecure connections.
handlers = 
port = 12500
3. Deploy changes
First, you’d need to confirm the database version: