Hi,
Is it possible to run a command using flyctl within my running app? Similar to how docker allows you to do: docker exec -it my_container echo "I'm inside the container!" .
I would like to be able to use my production app to run my database migrations as it already has
access to the production database. I have included a script in my docker image to do this but I’m unable to find a way to run it as a one off command.
Funny you should ask. It will be this week. We’re exposing certificate-based SSH on our instances.
You’ll need WireGuard set up (it’s easy and we think you should do it regardless) — we’re working on not needing that too; the end-goal is a seamless flyctl exec where, for your use case, you don’t even need to know SSH is happening under the hood. But that’s a few weeks out.
But in the immediacy yeah, you’ll just be able to SSH into any of your instances. I’ll follow up here in addition to the top-level post I’ll make about it.
Just for the hell of it I’ll point out that technically you can already pop a shell on your instance; the test app I use, for instance, binds a golang (it was like the hello-world of the gliderlabs/ssh package) to a weirdo port.
But nobody should need to do stuff like this anymore after (hopefully) tomorrow.