Running multiple services in a monorepo at once using
railway run
romeobalta
PROOP

2 years ago

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?

5 Replies

romeobalta
PROOP

2 years ago

9036a39d-e130-43bb-b6ef-6c938d5eb2b3


brody
EMPLOYEE

2 years ago

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


romeobalta
PROOP

2 years ago

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!


brody
EMPLOYEE

2 years ago

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


brody
EMPLOYEE

2 years ago

i assume your dev command uses something like concurrently to then run your other scripts to start the services


Loading...