LoginSignup
12
14

More than 5 years have passed since last update.

無料のdockerホスティングサービスArukas上にhubotを立てる

Last updated at Posted at 2016-09-21

adapterはslackを想定しています。

webhookみたいなのを作ったときにアクセス制限などがなく、晒状態になるので、制限をかけないと実運用状は危険かと思いますので、ご了承ください。

環境

  • MacOSX 10.11.6
  • homebrew
  • node v4.2.1
  • npm 2.14.7

手順

諸々インストール

$ brew install node # node環境のインストール
$ npm install -g yo # yeomanのインストール
$ npm install -g generator-hubot # hubotジェネレーターのインストール
$ npm install -g hubot hubot-slack coffee-script # その他使うもの

hubotの作成

$ mkdir arukas-hubot && cd arukas-hubot
$ yo hubot

Bot adapterslackを指定。

dockerコンテナのビルド

Dockerfilearukas-hubot/Dockerfileからコピーして、同じものを作り以下のコマンドを叩きます。

$ docker build -t arukas-hubot .

ビルドが成功したら、コンテナ上でhubotを対話モードで立ち上げて動作確認をする。

$ docker run -v $(pwd):/hubot -it -p 9999:9999 arukas-hubot bin/hubot 

...

arukas-hubot> arukas-hubot ping # pingで動作確認
arukas-hubot> pong

docker-hubへプッシュ

動作確認が出来たらgithubにプッシュします。今回は以下のリポジトリを使います。
https://github.com/ushios/arukas-hubot

docker-hubにもリポジトリを作成
https://hub.docker.com/r/ushios/arukas-hubot/

スクリーンショット 2016-09-21 13.57.54.png
ビルドが成功しているのを確認。

Arukasにアプリケーションを追加する

入力項目

以下のようにアプリを作成し、起動させる

name value
App Name 任意
Image ushios/arukas-hubot
Instances 1
Memory 512MB
Endpoint 任意
Port 9999/tcp
Env 主に使用する環境変数を参照
CMD

主に使用する環境変数

env 用途
HUBOT_SLACK_TOKEN slackが発行するトークン
HUBOT_SLACK_TEAM slackチーム名
HUBOT_SLACK_BOTNAME slack上で使用されるbotの名前
PORT 9999

HUBOT_SLACK_TOKENの取得方法はこちら

mozaiku.png

起動確認

あとはbotに対してpingとテキストでうってあげるとお返事をしてくれるはずです。

スクリーンショット 2016-09-21 16.22.18.png

参考

12
14
2

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