Slide 1

Slide 1 text

Embracing ChatOps exAspArk Evgeny Li

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

• Dedicated servers • Cloud servers • Cloud storage • Free global private network in Amsterdam, Dallas, Luxembourg, Moscow, Singapore, Washington, Hong Kong Servers.com

Slide 4

Slide 4 text

Products we use

Slide 5

Slide 5 text

Why not to use Slack, GitHub, NewRelic, etc.? We avoid using SAAS

Slide 6

Slide 6 text

We take security seriously!

Slide 7

Slide 7 text

So what is ChatOps? https://github.com/exAspArk/awesome-chatops Managing technical and business operations through a chat

Slide 8

Slide 8 text

Who uses ChatOps

Slide 9

Slide 9 text

Why use ChatOps • Automate manual tasks • Increase speed of actions • Increase visibility and transparency • Collaborate, share knowledge and learn • Use the same instrument – just your chat • Automate logging of conversations and commands • Use from mobiles

Slide 10

Slide 10 text

How to start https://github.com/exAspArk/awesome-chatops • Choose a framework to build a bot. The most popular ones are: • Hubot (CoffeeScript) • Lita (Ruby) • Errbot (Python) • Find adapters for your messenger. E.g. Slack, HipChat • Install useful Hubot scripts, Lita plugins, Errbot plugins • Write custom message handlers

Slide 11

Slide 11 text

How we use ChatOps Self-hosted HipChat + Lita bot

Slide 12

Slide 12 text

Lita bot sample # Gemfile source 'http://rubygems.org' gem "lita" gem "lita-hipchat" # lita_config.rb require 'lita-hipchat' require 'handlers/exchange' Lita.register_handler(Handlers::Exchange) Lita.configure do |c| c.robot.name = 'bot' if ENV['CONSOLE'] c.robot.adapter = :shell else c.robot.adapter = :hipchat c.adapters.hipchat.jid = ENV['HIPCHAT_JID'] ... end end # handlers/exchange.rb module Handlers class Exchange < Lita::Handler route /exchange\s+(\w+)\s+to\s+(\w+)/i, :perform, command: true, help: { "exchange USD to EUR" => "Shows exchange rates" } def perform(response) from = response.matches[0][0] to = response.matches[0][1] rate = fetch_rate(from: from, to: to) response.reply("#{from} to #{to}: #{rate}") end end end

Slide 13

Slide 13 text

Lita bot sample $ CONSOLE=true bundle exec lita start bot > bot help help - Lists help information for terms and command the robot will respond to. help COMMAND - Lists help information for terms or commands that begin with COMMAND. info - Replies with the current version of Lita. users find SEARCH_TERM - Find a Lita user by ID, name, or mention name. exchange USD to EUR - Shows exchange rates bot > bot exchange USD to EUR USD to EUR: 0.94144

Slide 14

Slide 14 text

Example: gitflow hotfix start

Slide 15

Slide 15 text

Example: gitflow release start

Slide 16

Slide 16 text

Example: branch changelog

Slide 17

Slide 17 text

Example: deploying to staging with lock

Slide 18

Slide 18 text

Example: deploying to staging with lock

Slide 19

Slide 19 text

Example: list stagings

Slide 20

Slide 20 text

Example: rerunning build on CI

Slide 21

Slide 21 text

Example: finding a scapegoat for troubleshooting :)

Slide 22

Slide 22 text

Example: error handling

Slide 23

Slide 23 text

Example: deploying any app / service to production

Slide 24

Slide 24 text

Major concerns There are some issues you have to pay attention to before starting to use ChatOps!

Slide 25

Slide 25 text

Security • We use self-hosted messenger • Bot is not reachable from the Internet • Added authorization checks for commands

Slide 26

Slide 26 text

Old habits die hard • Some people don’t know how to use bots • Create useful “help” commands with descriptions • Invite and show them how to use it by example • Some people don’t trust robots and prefer to do everything manually • Let them learn from their mistakes. Bots are more reliable in performing repetitive tasks • Colleagues will like transparency of using bots

Slide 27

Slide 27 text

Avoid information overload • Split channels in your messenger. For example: staging deploys, production deploys, working with repositories, builds, troubleshooting, monitoring, etc. • Mute or leave some unimportant channels. Fight your fear of missing out

Slide 28

Slide 28 text

Prepare to write a lot of code • Start small, iterate quickly, think big • Make it easy to run your bot. E.g. “make run” • Allow everyone to contribute, do code reviews • Write documentation, style guides, tests, useful utils • Prepare infrastructure: access, database, deployment, logs, monitoring, error handling, CI / CD, etc.

Slide 29

Slide 29 text

Always have a plan B • Be ready when your messenger / bot is unavailable • Describe how to perform the most important actions manually

Slide 30

Slide 30 text

Thank you! Protect the children because they – and robots – are the future Adam Carolla