Skip to content

PM2 deployment docs uses hardcoded node version #78

@Orel-A

Description

@Orel-A

I suggest to change the hardcoded node version to dynamic path by loading nvm.
https://www.cloudpanel.io/docs/v2/nodejs/deployment/pm2/

Here is how to run pm2 resurrect using crontab without hardcoding the node version:
In crontab -e just add:

SHELL=/bin/bash
@reboot source ~/.nvm/nvm.sh && pm2 resurrect > /dev/null

Another thing I would like to mention is that the node.js deployments by default don't try to use NGINX to serve static content.
This is a better approach to take off the overhead of static content from node.js event loop.

Example:

location / {
  try_files $uri @backend;
}

location @backend {
  proxy_pass http://127.0.0.1:{{app_port}};
  ...
}

The last trailing slash on proxy_pass is important to remove. And Root Directory is updated accordingly to the public directory (static content folder)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions