#Typeorm migration with docker compose

3 messages · Page 1 of 1 (latest)

tulip raven
#

I'm trying to understand the best approach to migrate my database automatically to the sever when I push my code
Im using github actions on a self hosted sever to build the nestjs dockerfile with docker compose along with a postgres image.

I'm now confused/failed at which step should i run the migration? At the build level? At the container running level? Or do it outside inside the actions workflow? As for now I have tried to build it inside the dockerfile, I don't get any error but there's no migration happening either, anyone has any idea?

vapid finch
#

I actually have a pretty interesting solution for this that I've rolled myself. I use a tool called watchtower that watches dockerhub at a configured interval for updates to the docker images, then pulls the new images, gracefully shuts down the original, and soins up the replacement in its place. With that mentionedm, I create three docker images, a server, a web app, and a migrations image, each considered their own "application" inside of an nx monorepo