Monorepo
If I am inside monorepo how will assigning domain work I wanna asign domain in two aspects
85 Replies
Project ID:
N/A
lets say your monorepo has two services, this means you will need two railway services, and this also means each service will have its own domain
so change root directory?
yes, you would need to set the root directory in each of the services settings
oh and variables too?
I have dotenv-cli setup for my root hmmm
what if it's a shared monorepo tho
but then what about port
my backend is on 8000 and frontend on 3000
you still need two services
hmmm so technically how am I going to share stuff š
the source is still the same repo
I don't understandd
š
by chance have you read that docs section i linked?
yea
I have this command setup to run everything
for now since I have not yet laid the build script to build my monorepo
not my main motive rn
you need two services, please reference the docs section i linked
ill check once again
i assume this is a frontend and backend?
yea
The start command can be overridden in the Railway settings ( eg. npm run start:backend and npm run start:frontend).but I only have one service right š¤
you need two services
that I get
but I don't get how will it be shared
the source of the service is the same repo
so i remove deployments from this?
the "root"
what
like the start commands
from deel I remove the commands to start?
how many services in your repo do you have? just a frontend and backend?
yes.
then you need 2 services, it looks like you have 3
one service for the frontend, and one service for the backend
and connect them both to the root of my monorepo but run only "one"
am I right?
you would need to set the appropriate build and start commands for both services
Ohk
I will try thanks
why does it keep on killing itself
you're on the trial plan, and are likely trying to use more than 512mb of ram
oh hm
upgrade time!!
yea
š„³
I just did
š„³ š„³
welcome to the club
haha
it still didn't work
idk wth is wrong
I am trying something else
did you get the same killed?
Yea
that's not ideal
Ohk i think it works now was a turbo repo issue ig
hobby plan is where it's at anyway
yea thats not a problem needed the upgrade either ways
but
my url doesn't serve anything
the app seems to be running
what status code do you get
404
I still see dev, please do not run anything in development mode
yea its on purpose
404 for every route?
yea
its compiling tho
so idk whats happening
the next app should compile (build) in the build stage, and you shouldn't run dev on railway
mhm
okay I will try build
next build and next start, that's all you should need, maybe some prisma stuff too
trying
so what kind of backend is this?
if next is the frontend
it's not a backend it's just some services which I need
welp you said yes to backend and frontend when I asked, so I can only go off what you said
Welp technically a backend over a backend
Hard to explain
:p
Okay build worked
š„³
this after I setup my services
I don't know whats wrong š¤
maybe because they're sharing same scope and it's overwriting in some way
Works perfectly fine locally. So I am not sure
even though the two services share the same source they do not share the same filesystem
hmmm
what version of node are you using locally?
20.6.0
railway uses node 16 by default
idts that should be an issue here
oh you'd be surprised
I'm not saying it is the issue, but it couldn't hurt to try
unfortunately railway only supports up to node 18 natively
but let's try that anyway, set
engines.node
to 18
in your package.jsonlemme try if its working on node 18
locallu
even if it does, railway is a docker environment, it's a whole other ball game if you never developed your app with a docker deployment in mind
The main issue is it's looking for prisma client and it's not able to find it
can test that
is their anyway to directly serve docker images then? that should be easier I could just publish images directly and have everything running but I am afraid that would need two services too?
there is, but that would require you write a dockerfile
completely fine w that too
If it saves me from two services somehow?
well if you know how to write a dockerfile, write the dockerfile and let railway build with the dockerfile
no need to publish an image
it will build the services itself?
or can I give it the whole monorepo and two ports two handle inside one service
you give it a Dockerfile and it will build the service using that dockerfile
hmm
is their any example of dockerfile for monorepo on railway?
For the services and stuff and handling the whole monorepo and all
will something bare minimum like this work out of the box
like for domains too
or do I need to write docker file for each.
Idk whats wrong sometimes it deploys just fine
and sometimes it doesn't want to
ik it doesn't make sense but that is what is happening
"build": "dotenv -e ../../.env prisma db push && dotenv -e ../../.env prisma generate && next build",
this is how my build script looks\ rn
it says prisma client generated too
deel-web:start: Error: Cannot find module '.prisma/client/index'` but it's disappearing apparantely
it's strange sometimes it wants to work sometimes it doesn't
Lemme know if anyone has anything for me š¦
do these services run in different environment
or same
I get my one service running and other stops working gives me a feeling that theyre running in shared context
( hard to debug things as well )