Hey,
Am trying to perform migration on github action but i cant directly connect to the postgres instance on fly because of the IP. So i need to connect to it through poxy flyctl proxy 5432 -a <postgres-app-name> . The step of connecting to postgres on github action works fine but the issue is that when connection the posgres is established, the terminal remains open this makes the steps on github action to run for ever.
Is there any way to run the connection in the background so i can run other commands.
or other way of connecting to postgres with keeping the terminal open ?
I wasn’t aware of release_command - sounds perfect. Though the docs say that the command runs in a temporary VM. I will need some context, specifically the sqlx-cli, to invoke the migration.
And specifically for sqlx-cli - it expects the DATABASE_URL env var, but the DATABASE_URL that the Fly App uses is a bit different. SQLx expects the dbname parameter as part of the URL, whereas the Fly App connect directly to the correct dbname.
Is there an idiomatic way of working that out?
Release commands run in a temporary VM, but they still have the same image, so you just have to make sure that sqlx-cli is installed in your app’s image. Note that the filesystem is ephemeral, though!
As for DATABASE_URL, that’s on you to specify. Probably the simplest solution is to have the release command be a shell script that sets up the environment variables, then calls sqlx-cli from that