以下のjsonを作って
/etc/pm/process.json
{
"apps":[
{
"name" : "hubot",
"cwd" : "/home/hubot",
"args" : ["-n", "hubot", "-a", "slack"],
"script" : "bin/hubot",
"node_args" : [],
"log_date_format" : "YYYY-MM-DDTHH:mm:ssZ",
"error_file" : "/var/log/pm/hubot.err.log",
"out_file" : "/var/log/pm/hubot.log",
"pid_file" : "/var/run/hubot.pid",
"exec_mode" : "fork",
"instances" : 1,
"min_uptime" : "200s",
"max_restarts" : 0,
"max_memory_restart" : "150M",
"watch" : true,
"ignore_watch" : ["[\\/\\\\]\\./", "node_modules"],
"merge_logs" : true,
"exec_interpreter" : "bash",
"autorestart" : true,
"vizion" : false,
"env": {
"NODE_ENV" : "production",
"HUBOT_SLACK_TOKEN" : "YOUR SLACK TOKEN",
"PORT" : "8080"
}
}
]
}
envに設定を色々追加していく。
ignore watchはまだ適当。
$ pm2 start /etc/pm/process.json