Glados


What is Glados(hubot)


Hubot is a chatbot program written by Github. 

Hubot dramatically improves and reduces employee efficiency. 

While the program might be called "Hubot" I've named ours GLaDOS.

Who is Glados?


GLaDOS stands for 
                          Genetic 
                          Lifeform 
                          and  
                          Disk 
                          Operating 
                          System

What can we do with Glados?


We can make GLaDOS troll Adam anytime anyone says the word "van" or says a word that contains "van" 

GLaDOS can be programmed to listen for commands, execute them and respond appropriately. 

Builds

GLaDOS is currently configured to build the SE Platform. 

Build Script

Deploys


GLaDOS is also configured to deploy the SE platform

Deploy Script

Command the Robot


This post pretty much says everything you need to know


BUT I'll cover the details

Coffee

Hubot scripts are written in Coffee, pretty simple.

Every script will start with this line:


 module.exports = (robot) ->

This line is how a plugin "starts" 

Interaction 


The next line describes what the robot should do:

respond - robot will respond when mentioned
 robot.respond /(imitate\scojo)/i, (msg) ->

hear - robot will respond when I word is found
 robot.hear /van/i, (msg) ->


Make the robot talk


The next line of your script is what the program actually does when the right word or incantation is spoken. 

To make the robot respond, use msg.reply

 msg.reply 'OMG GLITTER (allthethings)'

Connect to the internet


Hubot has a built in "request" library on the msg object 


 msg.http('https://apiv2-ngrid.preprod.simpleenergy.com/v2/version/')    .get() (err, res, body) ->        try            json = JSON.parse(body)            msg.send "Ngrid Preprod has the follow packages"            msg.send "se-platform: #{ json.version }"        catch error            msg.send "I couldn't find the version for you. So I burned the house down with lemons"

Fabric


Using Fabric we can make GLaDOS execute extremely complex tasks across multiple servers. 

Using spawn and exec we can execute sub-processes. 


Use spawn for long running tasks (ie a deploy) and use exec  for short tasks 

Spawn


When using spawn there will be events emitted and we can listen to and react to those events

Spawn example

Deploy Glados


GLaDOS is extremely easy to deploy
  1. ssh TS01
  2. cd /home/sedeploy/hipchatbot
  3. git pull (enter your github username and password)
  4. sudo supervisorctl restart glados-hipchatbot


https://github.com/simpleenergy/hipchatbot
Made with Slides.com