R
Railway12mo ago
Mark

Deploy Angular Monorepo on railway

I currently have local monorepo project working and want to deploy it on railway. I make use of only 1 repo but I have different path files for the front and back end. I can start the back end using the command: "nx s data-api". And I can start the front end using: "nx s mtg-nx-project". I don't know how I can easily push my repo to railway. I know I will have to use multiple services since it is a front and back end, but I dont know how to go about this.
17 Replies
Percy
Percy12mo ago
Project ID: f26f9a95-b52f-4e13-bc1f-df55ab339164
Mark
MarkOP12mo ago
f26f9a95-b52f-4e13-bc1f-df55ab339164
Brody
Brody12mo ago
does your frontend also require a build command?
Mark
MarkOP12mo ago
the build command for my front end I use is "nx b mtg-nx-project"
Brody
Brody12mo ago
is this an isolated monorepo or a shared monorepo
Mark
MarkOP12mo ago
I have an isolated monorepo
Brody
Brody12mo ago
then you will want to set the appropriate root directory in the service settings along with the correct build and start commands also in the service settings
Mark
MarkOP12mo ago
I assume I cant use my nx s data-api to start my service. Or what is the correct way to go about starting my service?
Brody
Brody12mo ago
oh my bad you're using nx, threw me off when you said isolated lave the root directory at the root, and just set your start and build commands in the service settings
Mark
MarkOP12mo ago
can I use nx serve data-api as my start command?
Brody
Brody12mo ago
have you tried it?
Mark
MarkOP12mo ago
No but I once read that it is not the best way to serve my application since it will start a development server
Brody
Brody12mo ago
for not running a development server, if you want something easy use the npm package serve for something production grade use the web server caddy
Mark
MarkOP12mo ago
I applied your solution. But in the logs I seem to get an error when trying to serve my application: NX Running target serve for project mtg-nx-project failed Failed tasks: - avans-nx-project:serve:development
Brody
Brody12mo ago
not too much information there, could you try to find out why the task failed?
Mark
MarkOP12mo ago
I will try to run it with --verbose to find out more about the error I seem to be getting an erro about the Nx Cloud: [Nx Cloud] Did not identify a VCS platform
Brody
Brody12mo ago
still not much information for me to go off of maybe check out both the nx and serve docs?
Want results from more Discord servers?
Add your server