Hey there ! You must have heared about a term called qaops. Its becoming a common term now a days in between software professionals. So in this blog lets discuss what is chatops ? where ,why and how should you use this in your environment.

If you are more into movies and all then remember Jarvis from IRONMAN movie, that was too cool watching when Tony stark gives instructions to its Artificial intelligence program and how smoothly JARVIS executed all those instructions. Imagine something like that in your infrastructure. What you just have to do give instruction and some mechanism or program execute those instructions for you. How cool is that right. Let me tell you you can do that using chatOps. How ? Let see.

ChatsOps

ChatsOps is nothing a conversation-driven development. In which a team type commands which are executed by chatbot server using custom scripts and plugins. It helps team to collaborate, communicate better, visibility and automation of manual tasks. Best part you can use it from anywhere from your mobile devices as well.

ChatOps is a model where people, tools, process and automation are connected in a transparent flow. It also helps collaborate and control pipelines in one window.

Main Components

Lets break chatOps in 3 main components:

Collaboration Team

Collaboration team is a set of people who basically part of the project or you can say people who owns the system and who are involved in developing that system or product. eg. stake holders, product owner, Dev team, ops Team or you can say DevOps team etc.

Collaboration tool

Collaboration tool are chat clients on which your collaboration teams and systems are connected to each other which makes the visibility between your team. e.g. Slack , Flowdock ,Messenger etc.

Bot

Bot is the main component of chatOps. Its the main service or programming which runs in the background who listen for all queries and execute the commands or scripts on the basis of request on collaboration tools by collaboration team.

There are various bots in market for implementing chatOps. You can use any of them from the following:

How

Lets see an example by integrating Hubot with Slack to create an efficient Chatbot.

Pre-requisite
Git
Slack Account
NodeJS

npm install -g yo generator-hubot

Now you can create you own hubot by following command and provide information like name, description , adapter etc and you are good to go

mkdir my-awesome-hubot && cd my-awesome-hubot
yo hubot --adapter=slack

Getting a Slack Token

Next, you’ll need a token from Slack to authenticate your Hubot. Use one of the following choices:

Run the command below, pasting your own Slack token after the =

HUBOT_SLACK_TOKEN=xoxb-YOUR-TOKEN-HERE ./bin/hubot --adapter slack

Create a channel and invite your bot to that channel
/invite bot-username

Configure your custom script

Although there are already open-source community working on exists here , if you want your own custom scripts to run systems then you can code it as a your requirement in nodejs. In my case i just added a simple code snippet to read and run bash script from which i can run most of the things but if you want something else then you can do so,
also You can run your hubot service either by daemonizing it or containerising it.

References

https://hubot.github.com/docs/
https://chatbotsmagazine.com/how-chatops-can-help-you-devops-better-5-minutes-read-507438c156bf

ChatOps : Make your life easy

Reading Time: 4 minutes

Hey there ! You must have heared about a term called qaops. Its becoming a common term now a days in between software professionals. So in this blog lets discuss what is chatops ? where ,why and how should you use this in your environment.

If you are more into movies and all then remember Jarvis from IRONMAN movie, that was too cool watching when Tony stark gives instructions to its Artificial intelligence program and how smoothly JARVIS executed all those instructions. Imagine something like that in your infrastructure. What you just have to do give instruction and some mechanism or program execute those instructions for you. How cool is that right. Let me tell you you can do that using chatOps. How ? Let see.

ChatsOps

ChatsOps is nothing a conversation-driven development. In which a team type commands which are executed by chatbot server using custom scripts and plugins. It helps team to collaborate, communicate better, visibility and automation of manual tasks. Best part you can use it from anywhere from your mobile devices as well.

ChatOps is a model where people, tools, process and automation are connected in a transparent flow. It also helps collaborate and control pipelines in one window.

Main Components

Lets break chatOps in 3 main components:

  • Collaboration team
  • Collaboration tool
  • Bot
  • System

Collaboration Team

Collaboration team is a set of people who basically part of the project or you can say people who owns the system and who are involved in developing that system or product. eg. stake holders, product owner, Dev team, ops Team or you can say DevOps team etc.

Collaboration tool

Collaboration tool are chat clients on which your collaboration teams and systems are connected to each other which makes the visibility between your team. e.g. Slack , Flowdock ,Messenger etc.

Bot

Bot is the main component of chatOps. Its the main service or programming which runs in the background who listen for all queries and execute the commands or scripts on the basis of request on collaboration tools by collaboration team.

There are various bots in market for implementing chatOps. You can use any of them from the following:

  • Hubot  GitHub’s bot written in CoffeeScript and Node.js (docs)
  • Lita: Written in Ruby
  • Err: Written in Python
  • Cog:Written in elixir

How

Lets see an example by integrating Hubot with Slack to create an efficient Chatbot.

Pre-requisite
Git
Slack Account
NodeJS

npm install -g yo generator-hubot

Now you can create you own hubot by following command and provide information like name, description , adapter etc and you are good to go

mkdir my-awesome-hubot && cd my-awesome-hubot
yo hubot --adapter=slack

Getting a Slack Token

Next, you’ll need a token from Slack to authenticate your Hubot. Use one of the following choices:

  • Create a Slack App with a Bot User (recommended): Slack apps are a container for many capabilities in the Slack platform, and let you access those capabilities in a single place. This is the recommended choice because it allows room for your Hubot to grow. To begin, you just need a Bot User.
    1. Create a new app at the app management page. Pick a clever name and choose the workspace you want Hubot installed in.
    2. Navigate to the Bot User page and add a bot user. The display name is the name your team will use to mention your Hubot in Slack.
    3. Navigate to the Install App page and install the app into the workspace. Once you’ve authorized the installation, you’ll be taken back to the Install App page, but this time you’ll have a Bot OAuth Access Token. Copy that value, it will be your Slack token.

Run the command below, pasting your own Slack token after the =

HUBOT_SLACK_TOKEN=xoxb-YOUR-TOKEN-HERE ./bin/hubot --adapter slack

Create a channel and invite your bot to that channel
/invite bot-username

Configure your custom script

Although there are already open-source community working on exists here , if you want your own custom scripts to run systems then you can code it as a your requirement in nodejs. In my case i just added a simple code snippet to read and run bash script from which i can run most of the things but if you want something else then you can do so,
also You can run your hubot service either by daemonizing it or containerising it.

References

https://hubot.github.com/docs/
https://chatbotsmagazine.com/how-chatops-can-help-you-devops-better-5-minutes-read-507438c156bf

Written by 

Abhishek is a Software Consultant having experience of 2 years. He is familiar with Java, Scala, Android Development, HTML, CSS, JS, MySQL, Apache Spark, and Unity Development. He is always passionate, techie and eager to learn new technologies & apply them in respective projects. On a personal front, Being a joystick junky he enjoys playing games on PC, PSP and other consoles as well as developing them.

Discover more from Knoldus Blogs

Subscribe now to keep reading and get access to the full archive.

Continue reading