Clever / flarebot

A bot for controlling Flares
5 stars 2 forks source link

FlareBot

Slack bot that assists in the creation of FLARE support documents.

Issues & Feature Requests

Flarebot issues and feature requests should be added to this Github project's issues list.

Configuration

Flarebot is an OAuth client into Slack, into Google Docs, and an HTTP-auth client into JIRA. It needs a lot of configuration.

Slack

Flarebot needs to be a full user (not a bot), which means you need to have an OAuth app set up to at least get a token. The following environment variables are expected.

Google

If you set up Flarebot as a normal Google account, the best you can get is an OAuth token that expires after a year. To get a forever-token, to match best-practices, and to not have to do an OAuth dance, you should set up Flarebot as a Google Service Account.

When you generate such an account, Google gives you a JSON-formatted set of service account configuration parameters. You'll need this JSON blob as a configuration parameter to Flarebot.

The following environment variables are expected:

JIRA

JIRA is accessed using HTTP Basic Auth, which means you need a JIRA user and you really should run JIRA over SSL. The following environment variables are expected:

You can test the jira library in isolation by setting the above environment variables and then running:

make build
./bin/jira-cli --help

Documentation

Flarebot provides links to documentation when a Flare is fired. This link is configured as

Status Page

Flarebot provides a link to Clever's status page management when a Flare is fired. This link is configured as

Usage

Help

@flarebot: help

Lists all commands

Fire a Flare

@flarebot: fire a flare p2 District 9 users cannot log in
@channel: OK, go chat in #flare-4242

In #flare-4242, @flarebot will:

Declaring Incident Lead

Within the Flare-specific channel:

@flarebot: I am incident lead
OK, @ben is incident lead

Declaring not a Flare or Flare mitigated

Within the Flare-specific channel:

@flarebot: not a flare
@flarebot: flare is mitigated

Future Features (Maybe)

In the specific channel:

@flarebot: I am comms lead
OK, got that

@flarebot: at 10:45am, we see an increase in error rates in oauth service
OK, logged that to the Facts Doc

@flarebot: right now, we see a decrease in error rates
OK, logged that at 10:48am to the Facts Doc

Trickiness

Initially we thought we would use a new "slash" command in Slack, e.g. /fire_flare, but those integrations are enabled in all rooms, which doesn't make sense, and they require webhooks, which makes development quite a bit harder, so this isn't worthwhile for now.

Both Google and Slack APIs require full users, not just a Slack bot user for example, to do the things we want to do.

Tech Design

Ideally, the Flarebot process is stateless, looking up state in JIRA and Slack. This is relatively easy for interactions in the main Flare channel, which is stable and can be referenced by a config parameter. It gets a little bit harder for:

For the first problem, the approach we'll take is:

Deployment

On Heroku

If flarebot is down see the flarebot runbook.