pm2 start app not working

October 19, 2016 1k views
Applications

I installed hubot rocket chat adapter. it works well. I want to use pm2 to start it forever. so i created a pm2.json file under my hubot directory myhubot as the following:

{
  "apps": [{
        "name": "myhubot",
        "max_memory_restart": "1024M",
        "log_date_format": "YYYY-MM-DD HH:mm:ss SSS",
        "script": "bin/hubot", 
        "exec_interpreter": "bash",
        "args": "--name myhubot --adapter rocketchat",
        "watch": ["package.json", "external-scripts.json", "scripts/", "hubot-scripts.json", "HUBOT_GITHUB_EVENT_NOTIFIER_TYPES=issues,pull_request,push bin/hubot"],
        "out_file": "/var/log/hubot/app.log",
        "error_file": "/var/log/hubot/err.log",
        "port": "8079",
        "env": {
            "ROCKETCHAT_URL": "my website domain",
            "ROCKETCHAT_USER": "bot",
            "ROCKETCHAT_ROOM": "",
            "ROCKETCHAT_PASSWORD": "bot",
            "PORT": "8079",
            "HUBOT_GITHUB_EVENT_NOTIFIER_TYPES": "issues,pull_request,push"
        }
    }]
}

I installed pm2 and pm2 works well. then i did sudo pm2 start pm2.json. pm2 does started an app named myhubot based on command line. But when i went to rocket.chat, hubot is not logged in. Is there anything wrong? Is port 8079 right? can the port be any number from 3001-8080?

3 comments
  • What is the status of hubot app?
    Basically you can check status of all pm2 apps by running

    • pm2 list
    Sample Output
    ┌──────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────────────┬──────────┐
    │ App name │ id │ mode │ pid  │ status │ restart │ uptime │ memory      │ watching │
    ├──────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────────────┼──────────┤
    │ hello    │ 0  │ fork │ 3524 │ online │ 0       │ 0s     │ 21.566 MB   │ disabled │
    └──────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────────────┴──────────┘
    

    You should see table like this. Make sure you hubot is online.
    Also you should check /var/log/hubot/app.log and /var/log/hubot/err.log. If there is error it could be logged here.
    As far as I see file is OK, but I'm on mobile and can't test it myself

  • when you say the hubot needs to be online, what do you mean, like hubot has to log in the chat already?

  • interestingly, i don't see /var/log/hubot/app.log and /var/log/hubot/err.log.
    I searched the directory where the hubot is and the directory where pm2 is at, i didn't see those two files, which is weird, because i seem to recall pm2 generated those files for during installation. Any ideas why this is happening? or i was looking at the wrong directory?

Be the first one to answer this question.