LoginSignup
1
1

More than 5 years have passed since last update.

hubot をデーモン化するとhubotが反応しなくなったときの対処

Posted at

環境

OS:CentOS Linux release 7.4.1708 (Core)

npm : 3.10.10

coffee script : 1.12.7

hubot : 2.19.0

連携先 : mattermost

概要

hubot - mattermost連携が完了後、いつまでもhubotをコマンドラインから

起動するのはめんどくさかったので、デーモン化することにしました。

インストールはこの辺を参考にしました。

デーモン化の前準備

以下の環境変数を、hubotを起動するユーザーの~/.bashrcであったり、/etc/profileであったりに記載しておきます。

PATH=[hubotのインストールディレクトリ]/node_modules/.bin:[hubotのインストールディレクトリ]/node_modules/hubot/node_modules/.bin:[hubotのインストールディレクトリ]/node_modules/coffee-script/bin:$PATH

bin/hubotに記載されているものに加えてcoffee-scriptのパスを通しています。

もし、以下の環境変数をbin/hubotの中に書いている人がいれば、それも、hubotを起動するユーザーの~/.bashrcであったり、/etc/profileであったりに記載しておおきましょう。

PORT
MATTERMOST_ENDPOINT
MATTERMOST_TOKEN
MATTERMOST_INCOME_URL
MATTERMOST_HUBOT_USERNAME

forever のインストール

sudo npm install -g forever

hubotのデーモン化

forever start -x -c coffee node_modules/.bin/hubot --name [hubotが反応するトリガー名] --adapter mattermost

いろんなサイトを見ていたのですが、--nameオプションを付けずに起動していました。

--nameオプションを付けずに起動すると、mattermostの場合、呼びかけても無反応なはず・・・です。
もし同じような悩みであれば、参考にどうぞ。
それに、bin/hubotの最終行でオプションを付けて、hubotが起動されているので、
もし他にもオプションを付けて起動されている場合は、それも一緒に付与させてから、
hubotをforeverでデーモン起動させてください。

1
1
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
1
1