Имеется такая ситуация. Nginx + NodeJS + Monit
настроил вроде всё по уму.
nginx
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name localhost;
location / {
proxy_read_timeout 120s;
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
/etc/init/cloacker.conf
#cloacker.conf
description "node app"
author "username"
start on startup
stop on shutdown
script
export HOME="/root"
echo $$ > /var/run/cloacker.pid
exec /usr/bin/node /var/www/cloacker/app >> /var/log/cloacker.sys.log 2>&1
end script
pre-start script
# Date format same as (new Date()).toISOString() for consistency
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/cloacker.sys.log
end script
pre-stop script
rm /var/run/cloacker.pid
echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/cloacker.sys.log
end script
/etc/monit/conf.d/cloacker.conf
check process cloacker with pidfile /var/run/cloacker.pid
start program = "/sbin/start cloacker"
stop program = "/sbin/stop cloacker"
if failed host localhost port 3000 then restart
вроде должно работать, НО!
если запускаем просто
# start cloacker
всё работает, нода обрабатывает запросы и ничего не падает, но стоит запустить так
# monit start cloacker
в лог валятся сообщения
tail -n 100 -f /var/log/cloacker.sys.log
at Function.process_params (/var/www/cloacker/node_modules/express/lib/router/index.js:330:12)
[2015-12-21T17:02:43.173Z] (sys) Stopping
[2015-12-21T17:02:43.228Z] (sys) Starting
Example app listening at http://:::3000
TypeError: Cannot read property 'split' of undefined
at IpDecoder.set6 (/var/www/cloacker/node_modules/mmdb-reader/src/IpDecoder.js:39:16)
at IpDecoder.set (/var/www/cloacker/node_modules/mmdb-reader/src/IpDecoder.js:21:10)
at Reader.lookup (/var/www/cloacker/node_modules/mmdb-reader/src/Reader.js:636:11)
at /var/www/cloacker/app.js:15:25
at Layer.handle [as handle_request] (/var/www/cloacker/node_modules/express/lib/router/layer.js:95:5)
at next (/var/www/cloacker/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/var/www/cloacker/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/var/www/cloacker/node_modules/express/lib/router/layer.js:95:5)
at /var/www/cloacker/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/var/www/cloacker/node_modules/express/lib/router/index.js:330:12)
[2015-12-21T17:02:44.311Z] (sys) Stopping
[2015-12-21T17:02:44.367Z] (sys) Starting
Example app listening at http://:::3000
TypeError: Cannot read property 'split' of undefined
at IpDecoder.set6 (/var/www/cloacker/node_modules/mmdb-reader/src/IpDecoder.js:39:16)
at IpDecoder.set (/var/www/cloacker/node_modules/mmdb-reader/src/IpDecoder.js:21:10)
at Reader.lookup (/var/www/cloacker/node_modules/mmdb-reader/src/Reader.js:636:11)
at /var/www/cloacker/app.js:15:25
at Layer.handle [as handle_request] (/var/www/cloacker/node_modules/express/lib/router/layer.js:95:5)
at next (/var/www/cloacker/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/var/www/cloacker/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/var/www/cloacker/node_modules/express/lib/router/layer.js:95:5)
at /var/www/cloacker/node_modules/express/lib/router/index.js:277:22
at Function.process_params (/var/www/cloacker/node_modules/express/lib/router/index.js:330:12)
[2015-12-21T17:02:45.458Z] (sys) Stopping
[2015-12-21T17:02:45.512Z] (sys) Starting
ну и естественно в браузере периодически попадаю на неотвечающую страничку
где я что-то сделал не так ума не приложу, но хочется всётаки момент падения приложухи отслеживать и фиксить