You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This tripped me too. I would expected the most popular process manager in node would be supported out of the box. I ended up with this:
* Start the server if this module is the main entry point.
* The server listens on the port defined by the `PORT` environment variable, or defaults to 4000.
*/
-if (isMainModule(import.meta.url)) {+if (isMainModule(import.meta.url) || process.env.pm_id) {
const port = process.env.PORT || 9003;
app.listen(port, error => {
if (error) {
That a good idea, please feel free to open a feature request. Using cluster mode directly would certainly make it easier for developers to leverage multi-core CPUs for Angular SSR and would be a valuable feature request. However, it's crucial to understand that scaling isn't just a Node.js issue; it requires proper deployment infrastructure. Even with cluster support, running public traffic directly to the Node.js layer is not recommended.
For robust scaling, one must use a Reverse Proxy/Load Balancer (like Nginx or a Cloud Load Balancer) in front of multiple Node.js SSR instances. This proxy is vital as it not only distributes the load but also offloads critical work serving static assets and handling SSL and allows you to implement aggressive caching at the edge/CDN layer.
Activity
alan-agius4 commentedon Sep 1, 2025
Feel free to modify the provided
server.tsfile to suit your specific server configuration, as it's just a basic starting point.feat(@schematics/angular): Out of the box support for PM2
fix(@schematics/angular): Out of the box support for PM2
PowerKiKi commentedon Sep 29, 2025
This tripped me too. I would expected the most popular process manager in node would be supported out of the box. I ended up with this:
fix(@schematics/angular): Out of the box support for PM2
fix(@schematics/angular): Out of the box support for PM2
hheexx commentedon Oct 3, 2025
@alan-agius4 thanks!
Any chance for cluster mode support?
Currently it's not that easy to scale the app.
alan-agius4 commentedon Oct 3, 2025
That a good idea, please feel free to open a feature request. Using cluster mode directly would certainly make it easier for developers to leverage multi-core CPUs for Angular SSR and would be a valuable feature request. However, it's crucial to understand that scaling isn't just a Node.js issue; it requires proper deployment infrastructure. Even with cluster support, running public traffic directly to the Node.js layer is not recommended.
For robust scaling, one must use a Reverse Proxy/Load Balancer (like Nginx or a Cloud Load Balancer) in front of multiple Node.js SSR instances. This proxy is vital as it not only distributes the load but also offloads critical work serving static assets and handling SSL and allows you to implement aggressive caching at the edge/CDN layer.
hheexx commentedon Oct 4, 2025
@alan-agius4 Ok, here it is #31387
Yea we use nginx anyway but cluster support would make configuration easier on nginx and pm2 sides.
angular-automatic-lock-bot commentedon Nov 4, 2025
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.