Kubernetes cluster and Phoenix - automate `mix ecto.migrate`?


I’m pushing my Phoenix app to a Kubernetes cluster for review. I use GitLab to create a service for the web server and another service for a temporary postgres pod.

What I would like to do is automate mix ecto.create and mix ecto.migrate. However, there is a timing issue - there’s a short period of time when the postgres server is not ready yet.

I could poll the postgres service in my deployment script before creating the web application service. But is this the most practical method?

Thank you

1 Like