LoginSignup
7
7

More than 5 years have passed since last update.

[WIP] centos6.xにhubotを入れて、hipchatでぬるぽするまで

Last updated at Posted at 2014-12-10

基本インストール

node.jsとRedisをepelレポジトリからyumインストール

cmd
$ sudo yum install nodejs --enablerepo=epel -y
$ sudo yum install npm    --enablerepo=epel -y
$ sudo yum install redis  --enablerepo=epel -y

※ 慣れていれば、一緒にインストールして構わないです

Redisの起動 & 自動起動

cmd
$ sudo service   redis restart
$ sudo chkconfig redis on

coffeeScriptとhubotのフレームワークをインストール

cmd
$ sudo npm install -g inherits
$ sudo npm install -g coffee-script
$ sudo npm install -g hubot

※ 慣れていれば、一緒にインストールして構わないです

Hubotを実際に入れていく

hubotのひな形作成

cmd
$ mkdir /deploy/mybot
$ cd /deploy/mybot
$ sudo npm install -g yo generator-hubot

設定

  • 実際にyoコマンドにてインストールする
cmd&log
[vagrant@vagrant mybot]$ yo hubot
                     _____________________________  
                    /                             \ 
   //\              |      Extracting input for    |
  ////\    _____    |   self-replication process   |
 //////\  /_____\   \                             / 
 ======= |[^_/\_]|   /----------------------------  
  |   | _|___@@__|__                                
  +===+/  ///     \_\                               
   | |_\ /// HUBOT/\\                             
   |___/\//      /  \\                            
         \      /   +---+                            
          \____/    |   |                            
           | //|    +===+                            
            \//      |xx|                            

[?] Owner: iganari
[?] Bot name: iganaribot
[?] Description: iganari.com
[?] Bot adapter: campfire  <--- 何も入れずにEnter
   create bin/hubot
   create bin/hubot.cmd
   create Procfile
   create README.md
   create external-scripts.json
   create hubot-scripts.json
   create .gitignore
   create package.json
   create scripts/example.coffee
   create .editorconfig
                     _____________________________  
 _____              /                             \ 
 \    \             |   Self-replication process   |
 |    |    _____    |          complete...         |
 |__\\|   /_____\   \     Good luck with that.    / 
   |//+  |[^_/\_]|   /----------------------------  
  |   | _|___@@__|__                                
  +===+/  ///     \_\                               
   | |_\ /// HUBOT/\\                             
   |___/\//      /  \\                            
         \      /   +---+                            
          \____/    |   |                            
           | //|    +===+                            
            \//      |xx|                            

hubotと対話する 

cmd&log
$ bin/hubot 
iganaribot> iganaribot ping
PONG

※ hubotをインストールする際のbot nameで話しかけないとrespondは返してくれない

example
iganaribot> ping
iganaribot>iganaribot ping
PONG
iganaribot> 

hubotとhipchatを連携させる

hipchatのhubot専用アカウント作成

  • 作成方法は割愛
  • Jabber IDなるものを取得しておく
  • パスワードも必要なので忘れずにメモしておく

必要なプラグインのインストール

hubotとhipchatの連携のためのプラグイン

  • 依存するライブラリをインストール
$ sudo yum install libicu-devel -y 
  • hubot <--> Hipchatで連携させるためのプラグイン
$ npm install hubot-hipchat --save 

Jabber IDの登録

  • hipchat > account settings > XAPP/Jabber info
Jabber ID password
217122_1511022@chat.hipchat.com hogehoge

のときは以下のように入れる

$ cd /deploy/mybot/bin
$ export HUBOT_HIPCHAT_JID="217122_1511022@chat.hipchat.com"
$ export HUBOT_HIPCHAT_PASSWORD="hogehoge"

Hipchatと連携したhubotの起動方法

$ bin/hubot -a hipchat

--> これでhipchatと連携しているはず

hubotとslackを連携させる

hipchat以上に人気の高いslackとの連携

---> 長くなったので別の記事に移動

参考URL

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