a year ago
I want to run some migrations as soon as my preview environment is created but before any services are deployed and ran. Is there a straightforward way to achieve this? For now one of my services, on boot connects to db and starts querying it immediately so I need the db to be in correct state before the service starts.
One way I'm thinking of rn, is that retrigger start for the service once migration is complete but just want to know if there is a better way to do so.
6 Replies
a year ago
nvm I figured a way out
a year ago
If you could share what you did that would be great! My recommendation would have been to put it into the build command and use the external URL
Status changed to Awaiting User Response Railway • over 1 year ago
a year ago
Okay so in a nutshell here's how it works
I enabled the "Wait for CI" flag for my applications that need to talk to DB so,
When a new Pull Request (PR) is opened:
Railway automatically creates a preview environment
Simultaneously, my GitHub Action is triggered
The GitHub Action then:
Fetches the newly created environment
Runs the necessary database migrations
Once the migrations are complete, and CI is passed, Railway deploys my applications.
Status changed to Awaiting Railway Response Railway • over 1 year ago
a year ago
Didn't think this would be so easy to do, really appreciate the DX on railway!!
a year ago
Awesome! Would you mind if I made this thread public so other weary travelers can take inspiration from it?
Status changed to Awaiting User Response Railway • over 1 year ago
a year ago
sure!
Status changed to Awaiting Railway Response Railway • over 1 year ago
a year ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open jake • over 1 year ago
Status changed to Solved jake • over 1 year ago
Status changed to Open jake • over 1 year ago
Status changed to Solved jake • over 1 year ago