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
Project ID:
f26f9a95-b52f-4e13-bc1f-df55ab339164
f26f9a95-b52f-4e13-bc1f-df55ab339164
does your frontend also require a build command?
the build command for my front end I use is "nx b mtg-nx-project"
is this an isolated monorepo or a shared monorepo
I have an isolated monorepo
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
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?
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
can I use nx serve data-api as my start command?
have you tried it?
No but I once read that it is not the best way to serve my application since it will start a development server
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
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
not too much information there, could you try to find out why the task failed?
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
still not much information for me to go off of
maybe check out both the nx and serve docs?