Name: puppet-hubot
Owner: Inuits
Description: A puppet module which maintains a hubot service
Created: 2016-11-04 09:32:44.0
Updated: 2016-11-04 09:32:46.0
Pushed: 2016-11-04 12:57:16.0
Homepage: http://hubot.github.com/
Size: 26
Language: Puppet
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A puppet-module which configures the hubot chat bot
I created an rpm package using hubot version 2.13-2 compiled with hubot-xmpp 0.1.5 and hubot-irc 0.2.7.
You could use for my packagecloud.io repository which you can install on CentOS by:
rl https://packagecloud.io/install/repositories/visibilityspots/packages/script.rpm | sudo bash
======= I created an rpm package using hubot version 2.17-2 compiled with hubot-xmpp 0.1.8. The detailed process how to compile it and create .rpm package is at the end of this README.md
To implement using the defaults or with hiera support:
de 'hubot' {
include ::hubot
For an implementation with custom values without hiera support (init.d):
de 'hubot' {
class {
'hubot':
$configuration = {
HUBOT_LOG_LEVEL => 'ERROR'
HUBOT_AUTH_ADMIN => 'kayn'
HUBOT_XMPP_USERNAME => 'hubot@example.com'
HUBOT_XMPP_PASSWORD => 'password'
HUBOT_XMPP_ROOMS => 'technical@conference.example.com,dailyops@conference.example.com'
HUBOT_XMPP_HOST => '127.0.0.1'
}
}
For an implementation with custom values without hiera support (systemd):
de 'hubot' {
class {
'hubot':
$configuration = {
HUBOT_LOG_LEVEL => 'ERROR'
HUBOT_AUTH_ADMIN => 'kayn'
HUBOT_XMPP_USERNAME => 'hubot@example.com'
HUBOT_XMPP_PASSWORD => 'password'
HUBOT_XMPP_ROOMS => 'technical@conference.example.com,dailyops@conference.example.com'
HUBOT_XMPP_HOST => '127.0.0.1'
}
}
=======
######################
NECESSARY PACKAGES ###
######################
stall the newest 0.10.x version of nodejs and nodejs-devel (it is needed only for compilation!!)
el contains version '0.10.36' but we need '0.10.40' for compilation (hubot can run then with 0.10.36)
install https://rpm.nodesource.com/pub_0.10/el/7/x86_64/nodejs-0.10.40-1nodesource.el7.centos.x86_64.rpm
install https://rpm.nodesource.com/pub_0.10/el/7/x86_64/nodejs-devel-0.10.40-1nodesource.el7.centos.x86_64.rpm
stall the rest of needed packages
install npm libicu-devel expat-devel git
#######
NPM ###
#######
r hubot;cd hubot;
install yo generator-hubot
r hubot;cd hubot
ode_modules/.bin/yo hubot
w, fill in following configuration (important is xmpp adapter!!!):
===
ner hubot@inuits.eu
t name hubot
scription A simple helpful robot for your Company
t adapter (campfire) xmppgot back false
t adapter xmpp
w let's install necessary packages
-i '/hubot-heroku-keepalive/d' external-scripts.json
m is not installed because it's needed on the machine where hubot will be installed
-i 's/npm install/# npm install/' bin/hubot
uninstall hubot-heroku-keepalive --save
install jsdom@4.0.0 --save
instal gitio --save
install
############################################
SYSTEMD SERVICE FILE + BEFORE_INSTALL.SH ###
############################################
w you hubot install in current directory....let's package it to .rpm
back
.
u should see following direcories if you run `ls`
t node_modules
w you need to create 3 necessary files with following content:
<< EOF > before-install.sh
in/sh
id -u "hubot" >/dev/null 2>&1; then
eradd hubot
F
t << EOF > hubot.conf
It is supposed that you will place here environment variables.
You can find couple of examples below:
ervice]
# Common parameters
Environment=HUBOT_LOG_LEVEL=ERROR
Environment=HUBOT_AUTH_ADMIN=admin
# XMPP adapter parameters
Environment=HUBOT_XMPP_USERNAME=hubot@example.com
Environment=HUBOT_XMPP_PASSWORD=ultra_safe_password
Environment=HUBOT_XMPP_ROOMS=technical@conference.example.com,dailyops@conference.example.com
Environment=HUBOT_XMPP_HOST=localhost
Environment=HUBOT_XMPP_PORT=5222
Environment=HUBOT_XMPP_LEGACYSSL=0 # do not use until it's necessary, I had some issue with that parameter
Environment=HUBOT_GRAFANA_HOST=https://grafana.example.com/
Environment=HUBOT_GRAFANA_API_KEY=place_api_key_here
# Redime parameters
Environment=HUBOT_REDMINE_BASE_URL=http://redmine.example.com
Environment=HUBOT_REDMINE_TOKEN=place_redmine_token_here
Environment=HUBOT_REDMINE_SSL=1
Environment=HUBOT_MEMEGEN_USERNAME=UNDEFINED
Environment=HUBOT_MEMEGEN_PASSWORD=UNDEFINED
Environment=HUBOT_MEMEGEN_DIMENSIONS=UNDEFINED
F
t << EOF > hubot.service
Hubot systemd service unit file
Place in e.g. `/etc/systemd/system/hubot.service`, then `systemctl daemon-reload` and `service hubot start`.
nit]
scription=Hubot
quires=network.target
ter=network.target
ervice]
pe=simple
rkingDirectory=/opt/hubot
er=hubot
start=always
startSec=10
Configure Hubot environment variables, make sure to use quotes around whitespace as shown below.
Environment=HUBOT_aaa=xxx "HUBOT_bbb='yyy yyy'"
NOTE: environment variables are defined by puppet in /etc/systemd/system/hubot.service.d/hubot.conf
ecStart=/opt/hubot/bin/hubot --adapter xmpp
nstall]
ntedBy=multi-user.target
F
#############
FPM MAGIC ###
#############
needed files created, now we can build rpm with following fpm command:
m -s dir -t rpm -d nodejs -v 2.17 --iteration 2 --epoch 2 --description "Hubot chatbot with preloaded xmpp 0.1.8 adapter" -n hubot --before-install before-install.sh hubot=/opt hubot.service=/etc/systemd/system/hubot.service hubot.conf=/etc/systemd/system/hubot.service.d/hubot.conf