Anyone deploying this package along with pm2 or forever? If so, could you share any config/startup details?
I've used pm2 in the past however using it on this project is a bit more involved.
I figured a way to successfully launch it without pm2 like:
node /srv/www/react-redux-universal-hot-example/node_modules/better-npm-run/index.js start
I've tried without success:
NODE_PATH=./src NODE_ENV=production PORT=3015 pm2 start node /srv/www/react-redux-universal-hot-example/node_modules/better-npm-run/index.js start
and
pm2 start node /srv/www/react-redux-universal-hot-example/node_modules/better-npm-run/index.js start
Tried run per pm2 docs: pm2 start apps.js
App name โ id โ mode โ pid โ status โ restart โ uptime โ memory โ watching โ
apps โ 0 โ fork โ 7044 โ online โ 0 โ 0s โ 5.426 MB
Using the following apps.js:
{
"apps" : [{
"name" : "redux.xchg.com",
"script" : "index.js",
"args" : ["start"],
"cwd" : "/srv/www/react-redux-universal-hot-example/node_modules/better-npm-run",
"env": {
"NODE_ENV": "production",
"NODE_PATH": "./src",
"PORT": 3015
}
}]
}
However in either case, no app when I hit the url.
Edited question to include request for suggestions for using forever on a production server as well.
Finally got it working with the following:
PORT=xxxx NODE_ENV=production NODE_PATH=./src pm2 start ./bin/server.js --name xxxxx
Be sure to run npm run build first. :)
Thanks!
Here is my config file: ecosystem.json
{
"apps" : [
{
"name": "tubitv",
"script": "./bin/server.js",
"instances" : 0,
"exec_mode" : "cluster_mode",
"env": {
"NODE_ENV": "production",
"PORT": 5225,
"APIPORT": 3030,
"NODE_PATH": "./src"
}
},
{
"name": "tubitv_api",
"script": "./bin/api.js",
"instances" : 0,
"exec_mode" : "cluster_mode",
"env": {
"NODE_ENV": "production",
"APIPORT": 3030,
"NODE_PATH": "./api"
}
}
]
}
# start the server
pm2 start ecosystem.json
Thank's to @zhiyelee
But, I found miss config.
"exec_mode" : "fork",
Because cluster is need to different port for each other instance.
Most helpful comment
Thanks!
Here is my config file:
ecosystem.json