Multiple railway.json files in a monorepo
Hey guys I'm looking to deploy a worker separate from the application which will be two services on railway. I was attempting to do this by specifying the name of the second railway config file such as railway-workers.json within the settings tab as shown in the attached image but I kept getting an error back
config file railway-workers.json does not exist
Is this because you cannot rename the file? if so what's the best approach here? To keep railway.json and put in another directory?19 Replies
Project ID:
N/A
N/A
what specific inputs have you tried?
railway-workers.json
which is the file that exists within the repowhere does it exist in the repo?
root
alongside the working and existing railway.json (as there are two config files, one for the application and one for the workers)
when you set a root directory in the service settings, only that specific folder is copied into the container, so if you wanted to use the railway-workers.json file it would need to be in the same root directory as you've set in the settings
yes correct, it exists there
again, it exists the alongside working railway.json
it's just a copy and paste with a minor change in the start command in place
you said your workers railway.json exists in the root of the repo?
to be more specific no inside of the monorepo it exists within
packages/backend
and the railway.json works correctly
all I'm doing is copying and pasting the railway.json in place and renaming it to railway-workers.json so that it can call an alternative start command. This filename is given at the settings page on railway and fails to be found.are you able to share your repo?
hmm I can do this on the main litestar one
not immediately though, in the meantime to accelerate testing and maybe obviate the need for that, is it known if one needs to use railway.json as the name or can the file be different?
Additionally, previously when inputting a different name in the settings page it was redeploying but now it no longer seems to, what's the way to trigger the redeploy with the config settings inside of the settings page, and not use the default railway.json?
Solution
try specifying the full path to your desired railway json
as for a redeploy, just use the bookmarklet https://bookmarklets.up.railway.app/service-redeploy/
thank you will try that, also thanks for bookmarklet
this is a monorepo right?
prior to you asking to provide full path, I had moved it to a folder and used full path and that worked
so I'm going to rename it back to railway-workers.json and see if that works, if it does then yes full path is required. Might be good to have that on the settings page as the implication is right above it you set the relative repo path....it is not intuitive for a user to have to put the full path again.
alright let me know how it goes
This worked thanks Brody! tldr full path is needed regardless of whether it's the same name of railway.json or railway-workers.json. please maybe tell railway team to note that on the frontend UI