Hello everyone. I.ve been playing with Payload for a few weeks now and i really enjoy it. Got the project running locally and is really smooth. But now im facing some problems to deploy it.
I have a gitlab pipeline that is creating a docker image (pretty much following the docker image in docs - https://payloadcms.com/docs/production/deployment#docker)
Now the problem im facing is running the DB migrations. My postgres DB runs in another docker container.
Now i dont want to run the migrations manually every time im doing a deploy. So what options do i have here ?
- i was thinking that in my Docker file i could copy the migration files and after a new deploy i could run the
yarn migrateand so nomatter what deployment im making i know that migrations are always gonna be ran at the beginning.
Not sure what is the best way but for now im tring to do something like this at the end of my Dockerfile
CMD ["pnpm", "migrate"]
CMD ["pnpm", "serve"]
- Maybe have another step after deploy step that will run the migrations somehow.. i dont think is a good idea tho.