Deploying a Node js app from a turbo monorepo
I'm just trying to figure out if there are any docs on that. Having a relatively hard time with it; neither turbo nor railway has any info on it. I can't break up the repo as it's an important architecture choice we made. I can't be the first to want to do this, lol. 😓
49 Replies
Project ID:
d3b7d643-d9b3-47a3-b033-01a9008c998a
d3b7d643-d9b3-47a3-b033-01a9008c998a
does this help?
https://docs.railway.app/deploy/monorepo
not exactly, I already set the root directory and the build/start command. Problem is I'd also need to set a custom install command as the app I am deploying is dependant on some other packages
shouldn't those packages be in your package.json?
For context, this is what we did for Vercel for our next app and it worked
the packages are in package.json indeed, but there's some code (prisma) that gets generated postinstall
said code is used across apps and packages
are you wanting to deploy a frontend to railway?
Nope, just the backend
We need a service that runs cron jobs to manipulate data
gotcha
i think i can make this happen
Hey, any pointers and I'm more than happy tbh
build command:
install command:
start command:
Not sure I get it 🧐
fill those out 🙂
oh, suree
build command: cd ../.. && yarn build --filter=data...
install command: cd ../.. && yarn install
We actually don't have a start command and it dawns on me this may be an issue?
lol
haha yeah no start command means app wont start
I looked in the logs though, and it doesn't get to that point anyway though
well yes but i still need one
the error happens when trying to import one of the packages
'db-queries@*' is not in this registry.
true that
my bad, the start command is there, within the data
workspace. just not in monorepo rootand i will also need your railway.json file, this can be found in the details tab of a deployment
so start command would be:
yarn start
but i need the start command lol
ah okay
yeah, basically since it's local we don't need to exit the app dir
sure thing
ohh, I see, we just need to specify commands here
right?
This is actually pretty cool and easy
so, I'd have:
right?
nope
untested, i dont know anything about your app, ive just made the railway.json with the commands you gave me
Sounds good to me
Any docs on this in case I need to further play with it without bothering anybody?
wait thats wrong
fixed
what was wrong?
forgot
dependsOn
to make sure isntall
runs after setup
and before start
oh, okay
Thanks!
there are some lackluster docs here, they dont cover anything i just did though
https://docs.railway.app/deploy/config-as-code#json
how i know how to do this then? i read the schema and vscode will auto complete for me
like so
vscode will auto complete for megithub copilot is AMAZING EDIT: aaaand, that's not what happened lol
i dont use copilot
the schema auto complete is a native vscode feature
that said, it unfortunately still fails with the same error 😓
apparently it's trying to install
db-queries
(a local package) from npm
weirdid need to see the repo to make any further recommendations, im not even a js dev
I have an idea to change the way the packages get built and imported, but it's more work than I can do now (4 am here)
Can we keep this post open until tomorrow?
of course
P.S.: I didn't expect a quick answer when I opened this
🙂
I'll come back to you after I try that tomorrow. Here's hoping. Thanks for the help Brody 🙏🏻
no problem 🙂
I have a potentially stupid guess that the issue may happen because railway tries to install packages with
Nixpacks
and our repo uses yarn workspaces 🧐nixpacks is a app builder, not a package manager
ruled that out then
lol
So my idea of bundling the underlying packages with tsup didn't work, and it cost me half a day, lol. Scratched all that 😓
I'm out of ideas too
well, let's hope the weekend bestows me with new ideas. Thanks a lot for the help Brody
no problem