Process Managers
Node.js Process Managers
A Node.js process manager controls the application lifecycle, monitors running services, and simplifies common administration tasks that help keep a project operational. The platform provides npm, PM2, and Forever as preconfigured options.

Select a Process Manager
You can choose the process manager during environment creation, while redeploying a Node.js container, or by updating the container variable in an existing environment.
Method 1: Select a Tag
Choose the appropriate process-manager tag during environment creation or container redeployment.

Method 2: Set the Environment Variable
In an existing Node.js container, edit the PROCESS_MANAGER Docker environment variable and assign one of these values:
npmpm2forever

Restart required
Restart the Node.js container after changing the PROCESS_MANAGER variable so the new process manager is applied.
Process Manager (npm)
In addition to package management, npm can start a Node.js application. When npm is selected as the PROCESS_MANAGER value, the platform runs:
npm start
This is an alias for:
npm run start
The command launches the script defined in the start section of the project’s package.json file.
package.json.scripts.start value in package.json.PM2
PM2 provides a broad set of application-management capabilities, including monitoring of running Node.js processes. PM2 commands can be executed directly through SSH.
List Running Processes
pm2 list

After creating a Node.js server, the command displays the default Draw Game application as a running process.
Delete a Process
Remove an existing PM2-managed application before deploying another project:
pm2 delete {process_name_or_id}

PM2 Configuration Files
PM2 supports configuration files that define application startup options. This is useful for microservice-based deployments because several applications can be described in one file.
The default ecosystem.config.js file can be used to launch server.js as the Draw Game application.
PM2 is suitable for complex deployments
Use a PM2 ecosystem file when the project includes several services, requires process monitoring, or needs multiple startup options to be managed together.
Forever
Forever is a simple command-line tool that keeps Node.js processes running continuously. It maintains a child process and automatically restarts it after a failure.
View Forever Help
forever --help

Configure the Application through JSON
Forever can read application options from a JSON configuration file. The default Draw Game example uses /home/jelastic/ROOT/forever.json:
{
"uid": "app1",
"append": true,
"watch": true,
"script": "server.js",
"sourceDir": "/home/jelastic/ROOT"
}
true, new log output is appended. When false, the log is overwritten.VCS deployment consideration
Set watch to false to avoid an unexpected process restart after deployment from a version-control repository, including automatic deployment.
Expected Result
The Node.js container uses the selected npm, PM2, or Forever process manager. The application is started according to the selected manager’s configuration and can be monitored or restarted using the corresponding commands and settings.
Important Notes
- Select the process manager during environment creation, container redeployment, or through
PROCESS_MANAGER. - Restart the container after changing the process-manager variable.
- npm requires a valid
startscript inpackage.json. - PM2 provides broader monitoring and multi-application configuration features.
- Forever is suitable for straightforward continuous process execution and automatic restart.
- Disable Forever file watching when VCS deployment should not trigger an unexpected restart.
Common Issues and Solutions
package.json contains a valid scripts.start command.PROCESS_MANAGER value and restart the Node.js container.pm2 list to identify it and pm2 delete to remove it before starting the new project.watch to false in forever.json.script and sourceDir values in the process-manager configuration.