R
Railway•13mo ago
salief

Configuring a turborepo

Is anyone able to help me configure my turborepo?
64 Replies
Percy
Percy•13mo ago
Project ID: N/A
salief
saliefOP•13mo ago
+
Brody
Brody•13mo ago
following up here, did that help?
salief
saliefOP•13mo 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•13mo ago
im sorry i dont know typescript myself
salief
saliefOP•13mo ago
Haha, its a pain Sometimes But also we love it What do you mostly code in?
Brody
Brody•13mo ago
Go
salief
saliefOP•13mo ago
Is there a way I can not specify a build command
Brody
Brody•13mo ago
its typescript you need to build something
salief
saliefOP•13mo 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•13mo ago
you will want to find a way to seperate the build and start commands
salief
saliefOP•13mo 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•13mo ago
well first off, what apps do you have in your turborepo?
salief
saliefOP•13mo 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•13mo ago
then just make sure your package.json doesnt have a build script at all
salief
saliefOP•13mo ago
Ok, thats how it was in the past
Brody
Brody•13mo ago
your nextjs and ponder apps will need to be in two seprate railway services two apps in turbo = 2 railway services
salief
saliefOP•13mo 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•13mo 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
saliefOP•13mo ago
Yes, just added that in I have a global build script though For building the other packages
Brody
Brody•13mo ago
it is named "build"
salief
saliefOP•13mo 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•13mo ago
does that need to run to be able to run ponder?
salief
saliefOP•13mo 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•13mo 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
saliefOP•13mo ago
Ok sweet will try that
Brody
Brody•13mo ago
then the start command would be pnpm run start:delta in the service settings
salief
saliefOP•13mo ago
No description
salief
saliefOP•13mo ago
spamming my configs for a second
salief
saliefOP•13mo ago
No description
salief
saliefOP•13mo ago
No description
Brody
Brody•13mo ago
yep keep the root dir set to just the root
salief
saliefOP•13mo ago
fingers crossed XD
Brody
Brody•13mo ago
you dont need a run? (i dont use pnpm)
salief
saliefOP•13mo ago
no
Brody
Brody•13mo ago
okay cool, noted
salief
saliefOP•13mo ago
You're very helpful, appreciate you taking the time
Brody
Brody•13mo ago
thank you 🙂
salief
saliefOP•13mo ago
Ugh, we were close But it pooped out in the deploy step
salief
saliefOP•13mo ago
Me trying to get this to work with Arc is laughable
Brody
Brody•13mo ago
oh im not sure if that works with arc works with safari though
salief
saliefOP•13mo ago
Basically the error is that it can't find a workspace dependency it relies on
Brody
Brody•13mo ago
how would you normally remedy that?
salief
saliefOP•13mo ago
Idk, pnpm workspaces just kinda work But the docs are cognizant of workspaces And the start command works locally
Brody
Brody•13mo ago
ill be honest i dont even know what a workspace dependency is lol
salief
saliefOP•13mo 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
saliefOP•13mo ago
No description
salief
saliefOP•13mo 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•13mo ago
i knew you needed some kind of build command
salief
saliefOP•13mo ago
Ok, redeploying We're in business Thanks again Have a wonderful weekend
Brody
Brody•13mo ago
no problem, but do tell what build command you used! you too!! 🙂
salief
saliefOP•13mo 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•13mo ago
put pnpm build --filter=offchain-schema in the build command?
salief
saliefOP•13mo ago
Nope
Brody
Brody•13mo ago
oh really, that didnt work?
salief
saliefOP•13mo 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•13mo 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
saliefOP•13mo ago
Ahh interesting I don't have a build command for that in my root package So could add that
Brody
Brody•13mo ago
cant hurt to try a few things right?
salief
saliefOP•13mo ago
For sure Now that I have one way that I know works !
Brody
Brody•13mo ago
yep true, can always go back to it
salief
saliefOP•13mo ago
+
Want results from more Discord servers?
Add your server