Sidehistorik
Hubot runs under nodejs, for linux do install: (http://how-to.linuxcareer.com/how-to-install-and-use-hubot-robot-on-ubuntu-machine)
Kodeblok |
---|
sudo apt-get update sudo apt-get install build-essential sudo apt-get install libssl-dev redis-server libexpat1-dev sudo apt-get install nodejs sudo apt-get install npm sudo apt-get install git-core |
Tip | ||
---|---|---|
On older OS'es (on Ubuntu 10.04 LTS, newest version is v0.6.x - so compile nodejs Youself:
|
Create the Hubot Dir
Kodeblok |
---|
mkdir /opt/hubot cd /opt/hubot |
...
Add the nodejs stuff
Kodeblok |
---|
npm config set registry http://registry.npmjs.org/
npm install -g coffee-script
npm install --save hubot-hipchat |
...
Configure the Hubot
Kodeblok |
---|
cd /packopt/hubot/bin/ vi hubot |
The Config - PORT is optional
Kodeblok | ||
---|---|---|
| ||
# #!/bin/sh npm install export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH" # HIPCHAT export PORT=8070 export HUBOT_HIPCHAT_TOKEN="**********************" export HUBOT_HIPCHAT_JID="*****_***@chat.hipchat.com" export HUBOT_HIPCHAT_NAME="Hal 9000" export HUBOT_HIPCHAT_PASSWORD="********" export HUBOT_HIPCHAT_ROOMS="@All" export HUBOT_HIPCHAT_HOSTBLACKLIST="chat.hipchat.com" export HUBOT_LOG_LEVEL="debug" export HUBOT_HIPCHAT_RECONNECT="true" # JIRA export HUBOT_JIRA_URL="https://jira.myserver.dkHOST="chat.hipchat.com" export HUBOT_JIRALOG_USERLEVEL="hal9000debug" export HUBOT_JIRA_PASSWORD="*******" # Optional environment variables: export HUBOT_JIRA_USE_V2="true" export HUBOT_JIRA_MAXLIST="1000" # HUBOT_JIRA_ISSUEDELAY # HUBOT_JIRA_IGNOREUSERS # Confluence export HUBOT_CONFLUENCE_URL="https://confluence.myserver.dk" export HUBOT_CONFLUENCE_USER="hal9000" export HUBOT_CONFLUENCE_PASSWORD="******" export HUBOT_CONFLUENCE_MAX_RESULTS="100" exec node_modules/.bin/hubot --adapter hipchat "$@"HIPCHAT_RECONNECT="true" |
Replace package.json with the content from https://github.com/github/hubot-scripts/blob/master/package.json
(See the Script Catalog at http://hubot-script-catalog.herokuapp.com/)
Tip |
---|
All scripts are here - but dont copy them in, most of then nedd extra modules and/or configurations to work |
Kodeblok |
---|
{ "name": "hubot-scripts", "version": "2.5.16", "author": "hubot", "keywords": [ "hubot", "plugin", "scripts", "campfire", "bot", "robot" ], "description": "Allows you to opt in to a variety of scripts", "licenses": [{ "type": "MIT", "url": "https://github.com/github/hubot-scripts/raw/master/LICENSE" }], "repository" : { "type": "git", "url": "https://github.com/github/hubot-scripts.git" }, "dependencies": { "redis": "0.8.4" } } |
Run the Bot
Kodeblok |
---|
cd /opt/hubot bin/hubot --adapter hipchat |
Updating Hubot
Kodeblok |
---|
cd opt/hal9000 npm install --save hubot-hipchat npm http GET http://registry.npmjs.org/hubot-hipchat npm http 200 http://registry.npmjs.org/hubot-hipchat npm http GET http://registry.npmjs.org/hubot-hipchat/-/hubot-hipchat-2.7.5.tgz npm http 200 http://registry.npmjs.org/hubot-hipchat/-/hubot-hipchat-2.7.5.tgz |
Tip |
---|
Hubot sending HTML - https://github.com/github/hubot-scripts/blob/master/src/scripts/hipchat-api.coffee |
You can get SSL problems "CERT_UNTRUSTED" with old node versions - see https://github.com/coolaj86/node-ssl-root-cas
A "dirty" hack is to place this in the hubot file:
Advarsel |
---|
# SSL Problem |
Links
http://12devsofxmas.co.uk/2014/01/day-11-creating-your-own-franken-butler-with-hubot/
http://stackoverflow.com/questions/24635934/clear-timers-on-hubot-reload-all-scripts
https://github.com/github/hubot/blob/master/docs/scripting.md