tengen-io / server

:white_circle: Server implementation of the board game Go
MIT License
13 stars 4 forks source link

Automate Database migrations #32

Open camirmas opened 5 years ago

camirmas commented 5 years ago

It would be nice to be able to auto-migrate when we redeploy. This will likely involve jumping into docker land, but also figuring out how to run the migrations themselves. The current setup involves entering a running docker instance and manually running migrations via the migrate tool.

I don't have a great idea for how to do this yet so I'll leave it to the implementer to determine the options here.

eaceaser commented 5 years ago

So, I'm not sure how I feel about truly automated migrations at this point; I think the schema is in flux enough right now that we should be comfortable blowing away the DB and starting from scratch with different schemas as necessary.

To answer your direct question right now though; with access to the k8s cluster, migrations can be run:

By hand

  1. Port forwarding to the postgresql pod, and running the migrate tool locally
  2. Execing a shell into the server pod and running the migrate tool from there. This is the closest to the docker workflow.

Automated

  1. We run a one-time job in k8s on deploy that runs the migrate tool.