Hi, all!
I’ve been playing with an Elixir pet project that I deployed on Google Cloud Run following @dazuma community tutorial I found on Google Cloud page (Run an Elixir Phoenix app on Compute Engine)
This tutorial is pretty neat and I managed to adapt it to Mix Release (the tutorial uses Distillery) and have it CD’d using Github Actions.
The one thing I’m not totally comfortable with is the way it handles migrations. The procedure suggested is to proxy the database connection and run the migrations locally, which seems to be a step you should automate. (It seems to be risky as well?)
So, I stumbled upon this post Migrations not being run/detected on a deployed mix release and learned you can use eval to circumvent the fact you won’t have access to Mix once the image is deployed to something like Cloud Run, but here is what I don’t get:
How do you go about running this command?
I naively tried to add it to my Dockefile on CMD and the command does run, it performs the migration, but then the deployment fails. I don’t understand Docker quite well, but it seems to be because there is only one command the image will run, yeah?
Also, I spend a lot of time looking around and I haven’t seen anyone trying to run the migration step within Dockerfile so I’m assuming there is a reason not to do it. But at the same time I don’t understand how to run eval (or access the release in any way) once the image is built.
Any ideas?
Thanks