Running multiple services in a monorepo at once using `railway run`
I have a turborepo with multiple apps (a next.js app, a fastify app and several node.js workers). I have a command (
bun dev
) that allows me to run all of these 5 apps in development mode at the same time. When using railway run
I must select a service and railway is kind enough to handle all of the env vars for me. But in this situation my services all require access to different env vars. Is there an easy way to setup the env vars for all of the services in a single place so I can then use railway up
to run my whole stack at once?Solution:Jump to solution
while it may not be the most elegant solution, you could add another empty service to your project that would act as a hub using reference variables to bring all the variables into a single service, then you would link to that service
5 Replies
Project ID:
9036a39d-e130-43bb-b6ef-6c938d5eb2b3
9036a39d-e130-43bb-b6ef-6c938d5eb2b3
Solution
while it may not be the most elegant solution, you could add another empty service to your project that would act as a hub using reference variables to bring all the variables into a single service, then you would link to that service
Yeah, that was kind of the solution I was thinking about as well. I wanted to know if there's something "better". Cheers, really appreciate it!
you may also be able to spawn a bunch of
railway run
processes and pass in your desired service to pull variables from with --service
i assume your dev command uses something like concurrently to then run your other scripts to start the services