Question
How to deploy Angular SSR app?
I have some questions regarding deployment. Sorry if some of it is very common knowledge, but I haven’t been able to find a good guide or explanation for this.
I want to deploy my Angular SSR (Angular Universal) app to DigitalOcean.
I would like to use the App Platform (if possible) and deploy from Github where I have a repository with my code.
But I am in doubt about what to do and what options to choose…
First thing: The configuration says: “Node.js detected”.
- Web Service
- Static Site
- Worker
Which type should I select?
Can I select a free static site? Or should I have a paying plan to my Angular app? I already have a Node.js backend running as a Web Service on a paying plan.
I tried choosing a Web Service because I figured that it would be the right choice for a Server Side Rendered app.
But then the next dilemmas arise:
- HTTP Routes
- Build Command
- Run Command
- HTTP Port
What is the right things to enter for these?
My package.json file have these scrips:
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:prod": "ng build --prod && mv dist/APP-NAME _static",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"dev:ssr": "ng run APP-NAME:serve-ssr",
"serve:ssr": "node dist/APP-NAME/server/main.js",
"build:ssr": "ng build --prod && ng run APP-NAME:server:production",
"prerender": "ng run APP-NAME:prerender"
}
I guess it is “npm run build:ssr” for the build command. But I am not sure about the run command. Is it “npm run serve:ssr”?
And should HTTP Routes just be default “/” and HTTP Port be “8080”?
Can anyone please help me with this?