LoginSignup
10
10

More than 5 years have passed since last update.

Hubotをpm2でデーモン化@slack

Last updated at Posted at 2015-05-27

以下の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

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10