R
Railway•8mo ago
salief

Configuring a turborepo

Is anyone able to help me configure my turborepo?
64 Replies
Percy
Percy•8mo ago
Project ID: N/A
salief
salief•8mo ago
+
Brody
Brody•8mo ago
following up here, did that help?
salief
salief•8mo ago
Thank you, I'm actually a bum and got side tracked About to try again now This is not specific to Railway but I'm running into an issue where my build command is failing even though in my tsconfig I'm telling it to ignore the files that it is failing to build
Brody
Brody•8mo ago
im sorry i dont know typescript myself
salief
salief•8mo ago
Haha, its a pain Sometimes But also we love it What do you mostly code in?
Brody
Brody•8mo ago
Go
salief
salief•8mo ago
Is there a way I can not specify a build command
Brody
Brody•8mo ago
its typescript you need to build something
salief
salief•8mo ago
Apparently the app handles builds via esbuild and those cmds are tucked into the like dev and start commands Would it be funky to just pass it one of those?
Brody
Brody•8mo ago
you will want to find a way to seperate the build and start commands
salief
salief•8mo ago
Hmm Esbuild seems to be a dependency that is included in another dep Do you think there is a way for me to access it?
Brody
Brody•8mo ago
well first off, what apps do you have in your turborepo?
salief
salief•8mo ago
I've got a Next.js app, this indexer called Ponder, and then some random packages that have few dependencies and build fine The one I'm having issues with is Ponder Which has the build commands coupled with its dev and start commands
Brody
Brody•8mo ago
then just make sure your package.json doesnt have a build script at all
salief
salief•8mo ago
Ok, thats how it was in the past
Brody
Brody•8mo ago
your nextjs and ponder apps will need to be in two seprate railway services two apps in turbo = 2 railway services
salief
salief•8mo ago
Yeah, the next app will be deployed to Vercel And the Ponder app on Railway So I just shouldn't put anything on Railway when it asks for a build command?
Brody
Brody•8mo ago
okay thats good too correct, but you also have to make sure you dont have a build script either, since that would be used instead do you have a specfic script to start ponder? like start:ponder
salief
salief•8mo ago
Yes, just added that in I have a global build script though For building the other packages
Brody
Brody•8mo ago
it is named "build"
salief
salief•8mo ago
"start:delta": "pnpm start --filter=delta",
"build:site": "pnpm build --filter=site",
"dev:site": "pnpm dev --filter=site"
"start:delta": "pnpm start --filter=delta",
"build:site": "pnpm build --filter=site",
"dev:site": "pnpm dev --filter=site"
delta is ponder site is nextjs so i removed the build command at the root but there also exists this "build": "turbo build", should have mentioned
Brody
Brody•8mo ago
does that need to run to be able to run ponder?
salief
salief•8mo ago
The root build command does not need to run to run ponder I wanted to avoid the nextjs app building in railway like at all
Brody
Brody•8mo ago
okay then railway would automatically run it anyway, so in the service settings just set something like echo build as the build command
salief
salief•8mo ago
Ok sweet will try that
Brody
Brody•8mo ago
then the start command would be pnpm run start:delta in the service settings
salief
salief•8mo ago
No description
salief
salief•8mo ago
spamming my configs for a second
salief
salief•8mo ago
No description
salief
salief•8mo ago
No description
Brody
Brody•8mo ago
yep keep the root dir set to just the root
salief
salief•8mo ago
fingers crossed XD
Brody
Brody•8mo ago
you dont need a run? (i dont use pnpm)
salief
salief•8mo ago
no
Brody
Brody•8mo ago
okay cool, noted
salief
salief•8mo ago
You're very helpful, appreciate you taking the time
Brody
Brody•8mo ago
thank you 🙂
salief
salief•8mo ago
Ugh, we were close But it pooped out in the deploy step
salief
salief•8mo ago
Me trying to get this to work with Arc is laughable
Brody
Brody•8mo ago
oh im not sure if that works with arc works with safari though
salief
salief•8mo ago
Basically the error is that it can't find a workspace dependency it relies on
Brody
Brody•8mo ago
how would you normally remedy that?
salief
salief•8mo ago
Idk, pnpm workspaces just kinda work But the docs are cognizant of workspaces And the start command works locally
Brody
Brody•8mo ago
ill be honest i dont even know what a workspace dependency is lol
salief
salief•8mo ago
Its just you can create a package in your monorepo, thats shared across other directories But you don't need to publish it to npm
salief
salief•8mo ago
No description
salief
salief•8mo ago
https://docs.railway.app/deploy/monorepo Ooo I know why The package also needs to build To get a /dist directory setup Cause thats what ponder is looking at
Brody
Brody•8mo ago
i knew you needed some kind of build command
salief
salief•8mo ago
Ok, redeploying We're in business Thanks again Have a wonderful weekend
Brody
Brody•8mo ago
no problem, but do tell what build command you used! you too!! 🙂
salief
salief•8mo ago
"start:delta": "pnpm build --filter=offchain-schema && pnpm start --filter=delta"
"start:delta": "pnpm build --filter=offchain-schema && pnpm start --filter=delta"
So still echo build on Railway But before the app starts it builds the workspace package offchain-schema
Brody
Brody•8mo ago
put pnpm build --filter=offchain-schema in the build command?
salief
salief•8mo ago
Nope
Brody
Brody•8mo ago
oh really, that didnt work?
salief
salief•8mo ago
I didn't even try that, to me it makes less sense I feel like the build cmd would be reserved for building the app railway is trying to deploy? Cause theoretically this workspace dependency is not necessary
Brody
Brody•8mo ago
nope, you can use that command input field to build something your app depends on too its preferable to keep build stuff in the build stage, as to not delay the start of the app, since now you build during runtime
salief
salief•8mo ago
Ahh interesting I don't have a build command for that in my root package So could add that
Brody
Brody•8mo ago
cant hurt to try a few things right?
salief
salief•8mo ago
For sure Now that I have one way that I know works !
Brody
Brody•8mo ago
yep true, can always go back to it
salief
salief•8mo ago
+