Angular front-End
Hi, I try to make angular front end with spring back end. I tried to find on the internet how to deploy angular on railway, but i could not find any help. Could someone tell me how to deploy angular frontend on railway.
59 Replies
Project ID:
N/A
N/A
Add a
nixpacks.toml
with this:ng serve starts a development server, that definitely not what we want
coulkd you tell me where
i am kinda new
In your project root
aleks do you mind if i take this thread over
alright
thank you
why the thumbs down though?
ðŸ˜
not a good solution
oh, spring backend - is the backend in a separate service?
it is also in the same project
but it is working nice
sorry, I know I said you could take this over, but I did write the Spring templates, so I know how to use Spring w/ Railway
this is angular
It's also Spring
i have problem with angular
Alright sorry, I'll pipe down now
my spring project is working
but thanks for goodwill
okay bread, in your angular.json make sure your build outputPath is set to
dist
okay
do you have a build script in your package.json?
is it okay?
yep perfect
https://github.com/brody192/angular-template
copy the nixpacks.toml and Caddyfile from this repo into your angular projects folder
then push the changes to github
okay i copied them
railway should be rebuilding now right?
yeah
oh
it didn't crash
thats a good start lol
is it good?
looks great
does your service have a domain?
oh
it works
awsome
i am sooo 😎
thank you
so much
no problem!
i am so grateful
java is aleks's thing, and single page web apps are my thing
well spring boot was easier to deploy
yeah railway has a provider for java, they dont have one for single page apps like angular though
so thats why we needed the nixpacks.toml file i wrote
thank you once again
no problem, happy to help 🙂
should i close this thread or something like that?
ive already marked as solved, its all good
thank you and have a good day
you too!
Hi, Brody. Could you explain me why this, please?
a development server uses significantly more resources and is also significantly less performant compared to a proper web server
But when you use Caddy you are depending on third party projects while with ng serve no
caddy is marketed as an enterprise grade web server, there's absolutely nothing wrong with depending on it
ng serve can use up to 20 times more memory than caddy, and like mentioned ng serve is significantly slower, it's only meant to be used for development purposes and not for running in a production environment like railway
Only for learning and performance testing purposes can you explain me how to run the project with ng serve? I would like to compare both deployments
configure ng serve to listen on host 0.0.0.0 and the environment variable PORT through some command line flags in your start script
but I promise you, it's not worth it, in fact the original thread creator was getting out of memory errors because ng serve was using more than 512mb of ram
that means ng serve wanted to use even more than 512mb of ram, for context just 500mb of ram for a whole month is 5$ on railway, in contrast caddy uses around 30mb, that's less than 50 cents
I won't do it, I believe you. Without getting away from the focus of the conversation, my last question is how could you know about Caddy and were you able to implement it to Railway only with documentation from both parties?
ive used caddy for a very long time, long before i knew of railway
and i didnt need to really read either railways or caddys docs to implement caddy since i have already read both docs before attempting this integration, only looked at them for quick references
Thanks, bro. You're amazing. No more for my side
if you have any questions on how ive done the integration feel free to ask, but both the nixpacks and caddyfiles i have written are filled with comment lines