❓ How can I run a migration task once if I have multiple app containers?
owen-marit
PROOP

10 months ago

I have multiple apps and have a pre-deploy, but don't want both services to run the pre-deploy task (otherwise could have migrations colliding with one another)

Even if I have a separate container, how would I orchestrate it so the container with the migration run first?

Solved$20 Bounty

7 Replies

owen-marit
PROOP

10 months ago

Use Cursor.sh and it came up with a clever way to use Database Advisory Locks.


owen-marit
PROOP

10 months ago

Here's the script

1410873970936512512


10 months ago

To clarify @Mint Avenger , did that script solve your issue or are you still looking for a solution?


10 months ago

If you’re using GitHub Actions, you can handle migrations there and configure each service to toggle Wait for CI.


owen-marit
PROOP

10 months ago

That script solved my issue. It handles multiple containers trying to migrate.


10 months ago

Wonderful.


10 months ago

!s


Status changed to Solved noahd 10 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...