Now.sh is actually not supported
Using PM2 with Now.sh
This docs will guide you step by step through the PM2 integration with Now.sh.
Prepare your app
Set your ecosystem file
Generate an ecosystem.config.js
template with:
pm2 init
Modify the ecosystem file to match your needs:
module.exports = {
apps : [{
name: "app",
script: "./app.js",
env: {
NODE_ENV: "development",
},
env_production: {
NODE_ENV: "production",
}
}]
}
Learn more about ecosystem file here.
Add PM2 as a module
Add pm2 as a dependency to your projet.
With npm:
npm install --save pm2
With yarn:
yarn add pm2
Set your package.json
In your package.json
, modify your start
script like the following:
{
"scripts": {
"start": "node ./node_modules/.bin/pm2-runtime start ecosystem.config.js --env production" }
Deploy with Now.sh
You are ready
You can now deploy your application on Now.sh like you would have done for a regular node.js app.
Next Steps
Complete your configuration with the Ecosystem File.
Monitor your app on a dashboard, with PM2 Plus.