Trouble deploying monorepo app
I've been spinning my wheels for a while no trying to get my monorepo app to deploy and figured I'd come here to see if anyone could help out!
Am I able to just run
Any help is appreciated!
ts-node
off of the monorepo source code and not have to compile any dependencies? My trouble seems to be trying to compile the app as the shared dependencies are not loading correctly. I realize this is more of a ts build config concern than a Railway concern, which is why I was leaning towards finding an approach that can just run the ts-node command off of the uncompiled code to just bypass this all together. I tried running railway up
from the root of the monorepo, but I get a 413 saying that its too large. When I'm running up
from the app directory/workspace itself, is that just uploading the code from that directory? The dependencies are handled at the top level of the monorepo so I'm just trying to wrap my head around what approach I should be taking. I've followed the guides, but still cant seem to get anywhere.Any help is appreciated!
91 Replies
Project ID:
d36cedc3-d1a4-453b-9e36-45d7299cabfd
d36cedc3-d1a4-453b-9e36-45d7299cabfd
how big are the contents of the repo?
The entire monorepo is large (1.6gb) with node_modules. The app trying to be deployed is much smaller.
Not sure how to tell how large the app trying to be deployed and just its required dependencies is. Without node_modules its 195mb
Latest deploy logs show it attempting the start command, but cant resolve the dependencies.
Yea, this shouldn't be failing on that
first off
Flagging this thread. A team member will be with you shortly.
ok-
Should I be running
railway link
from within the app directory, or from the root? Currently there is only one app that is being deployed to Railway from the monorepo
Appreciate your help btw!well, one impossible problem at a time
#10 0.478 /bin/bash: line 1: yarn: command not found
Is your project a Deno project?
Least we can doOne of the apps has deno deployed functions (supabase database), but not the one currently attempting to be deployed
I switched that to a npm command, was a little thrown off yarn wasnt available
Okay, it seems to be that we are confusing the providers
Can ya tell me how your monorepo is structured?
Screenshot of the folder dir would be fine
expanded app is the one attempting to be deployed
Okay, so I have changed the root dir to /app
app
is the directory for another app not being deployed to railway, do you mean relay
?oh! yes, relay
meaning: you want /relay to be deployed
correct
cool, kicking off a build
We really should
ls
after a failure like this š
well, duh
its packages/relay yea?ah - im also running up locally since git doesnt have everything
yep, so you would up from that directory
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
you just need your start command
yeah
packages/relay
This is what I setup for ya btw
cool, so im
yarn workspace relay railway up
no need for that
just
railway up
after railway link
So the root directory was the missing bit?
Nice, so looks like that was in prod, off the latest Github branch - while i was trying to deploye staging with local, shared code seemed to be what was going a little nuts
Hmm - so this build seems to just be failing immediately https://railway.app/project/d36cedc3-d1a4-453b-9e36-45d7299cabfd/service/d6fef121-dc63-46e1-85ae-a9c75f47dbfc/settings
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Yes:
so you need to specify your start command
Thats off of
main
on Github, im trying to run up locally to staging, which has a start commandnpm start --filter=relay
only makes sense in the context of your yarn workspace
gotcha
OH
okSo whats happening here is that your Railway up in the package folder is messing with the setting
thats fine
can ya run
railway up
from root?Ok - back to the 413 error
are node modules in your git ignore?
yeah
wondering why we are trying to ship that š
I made an empty service for ya, can ya
up
in the directory to nice-sign
Ah yep, same 413
within
packages/relay
not rootRailway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
It should go to this service, not the one linked to the GH repo
you might need to run
railway link
again possiblyIm able to select
nice-sign
as the project, but up gives the 413within the relay package folder?
or root
root
yes, you need to
cd
to packages/relay
and then run up
The mental model to think about it here is, in your monorepo, each of your packages is a service.
For your local dev, doing railway up just throws up your whole directory for us to build
so at the end of this
In a perfect world: you would have your git repo with a different root directory for each of your services.
I saw that
Different root in git not being packages/name like now you mean?
Also was also to push to
nice-signs
, with a different error, so making progress! https://railway.app/project/d36cedc3-d1a4-453b-9e36-45d7299cabfd/service/51e7f0d9-fe9d-4cde-bd23-319fad7b09d5?id=24e6b8da-ceb0-4d53-a636-bf613481765dRailway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
new errors are good
Looking at logs
Do you have a dep that is outside of your package?
Ill need to create a build command that puts all dependencies for
relay
within its directory though?
Yes, relay
imports some of the shared packages from the monorepoyep, thats where its failing
Lets see if there is a better way where you don't have to do that
one sec, thinking
Which is where I started with trying to do all of this from root so that the node modules were all set up like local
Yea, I understand what you are trying to get at
Talking to the team, one sec.
If ya can, I understand if ya can't, can ya make the repo public or invite coffee-cup?
I can invite someone
cool
also, can ya drop your root package.json and the one in
packages/relay
root
relay
Invite? https://github.com/coffee-cup
GitHub
coffee-cup - Overview
ā„ļø web and iOS. coffee-cup has 156 repositories available. Follow their code on GitHub.
Assuming so since I see some railway activity on there
Wait not yet!
We think if we fix the 413 you should be good to go
I think
up
doesn't support all the turporepo goodness we have built out...
so you would have to up
from root, but I am just confused why we think its too large
okay, I guess we found the culprit
can you add a .railwayignore
and add node_modules to thatin root or in relay?
in addition, can you make sure that you add any node_modules folder to be ignored within any sub-directory?
in root
Yeah just double checked the
.gitignore
's - they all have node_modules
Hmm still get the 413 with all of thatstrange...
I don't know what else to do here except to tell you to commit your work to main in the meantime, we have a 1 Gb upload limit and something is running into that
at least the git config is working, just confused why the CLI isn't working
Hmm ok - anyway to run it off this branch instead of main so i dont have to merge?
Yes, lemme point you to that setting
under service settings and then your branch
hmm - i just deleted every
node_module
folder and ran the railway cli after installing it globally and still get the 413
can confirm entire directory is 385mb after doing thatGotcha, might be an updated limit or something. I will talk to a team member about this and get resolution there.
However, in all fairness, it likely won't be fixed soon. (You should at least have the documented limit.)
Would my best bet being trying to figure out a build command that includes all of relays dependencies and deploying just that?
and bypass the monorepo as much as possible
well, with
railway up
we only up the local folder- I would honestly just stick with the git flow to even take advantage of all the cool stuff you get out of your exisiting workflow
Any reason to the (percieved, making an assumption here) adversion to deploying your working branch for dev?
This would work for the record, just don't want you to do pointless work if you don't have to.No adversion there - was just doing it locally for quicker feedback but can push to the branch to test out instead
Gotcha- code is glass making I feel. The shorter the cycle the better.
Lets get the base case up and running and then we can move ya over to the CLI. We will have some internal discussions in the meantime.
Should I be able to run yarn commands with my setup? I know early on you were saying it detected the wrong project type
Trying to get back to using the git workflow, with normal yarn commands but back to the yarn command not founds bits
You should
Looking into it, one sec
So is there a Dockerfile in that repo?
There is - noticed when I switched the root directory it picked up the dockerfile
do you want to use Docker?
I may end up doing that - the last deploy just worked using it
Wanna jump on a meet? I think a high bandwith convo like this can be solved quickly over a call
Yeah that works!
spinning it up
\
Ok - brain busting. This build compared to the most recent is able to find the dependencies, with the same commands? https://railway.app/project/d36cedc3-d1a4-453b-9e36-45d7299cabfd/service/d6fef121-dc63-46e1-85ae-a9c75f47dbfc?id=bd6fbf48-0551-4ca1-a72e-cd93ed34dc23
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Oh this is just weird?
Yeah tried adding the env var and redeploying and its back to the dependency missing bits
added: NIXPACKS_NO_CACHE
I hope its not an issue with our builder reusing an old busted image
Okay, it was cache, ofc
So for my own sanity - did the build command need tsc or could it be stubbed? I think we were debugging with it stubbed - I jsut redployed this working one and it worked - https://railway.app/project/d36cedc3-d1a4-453b-9e36-45d7299cabfd/service/d6fef121-dc63-46e1-85ae-a9c75f47dbfc?id=aae3a9be-9d87-4137-81ff-6b9a0b59f806
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Should be fine moving forward
Hmm yeah - only promoting that old one seems to be working š¤