R
Railway7mo ago
Faolain

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?
No description
Solution:
try specifying the full path to your desired railway json
Jump to solution
19 Replies
Percy
Percy7mo ago
Project ID: N/A
Faolain
Faolain7mo ago
N/A
Brody
Brody7mo ago
what specific inputs have you tried?
Faolain
Faolain7mo ago
railway-workers.json which is the file that exists within the repo
Brody
Brody7mo ago
where does it exist in the repo?
Faolain
Faolain7mo ago
root alongside the working and existing railway.json (as there are two config files, one for the application and one for the workers)
Brody
Brody7mo ago
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
Faolain
Faolain7mo ago
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
Brody
Brody7mo ago
you said your workers railway.json exists in the root of the repo?
Faolain
Faolain7mo ago
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.
Brody
Brody7mo ago
are you able to share your repo?
Faolain
Faolain7mo ago
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
Brody
Brody7mo ago
try specifying the full path to your desired railway json
Brody
Brody7mo ago
as for a redeploy, just use the bookmarklet https://bookmarklets.up.railway.app/service-redeploy/
Faolain
Faolain7mo ago
thank you will try that, also thanks for bookmarklet
Brody
Brody7mo ago
this is a monorepo right?
Faolain
Faolain7mo ago
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.
Brody
Brody7mo ago
alright let me know how it goes
Faolain
Faolain7mo ago
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