• Stars
    star
    1,460
  • Rank 32,218 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Monzo's real-time incident response and reporting tool ⚡️

PyPI PyPI - Python Version PyPI - Django Version Travis (.org) GitHub

Response ⚡

Dealing with incidents can be stressful. On top of dealing with the issue at hand, responders are often responsible for handling comms, coordinating the efforts of other engineers, and reporting what happened after the fact. Monzo built Response to help reduce the pressure and cognitive burden on engineers during an incident, and to make it easy to create information rich reports for others to learn from.


The headline post when an incident is declared

If you're interested in how we use this tool at Monzo, there's an overview in this video.


Try it out

Response is a Django app which you can include in your project. If you're just looking to give it a try, follow the instuctions for the demo app!


Adding Response to your own project

Start a new Django project, if you don't have one already:

$ django-admin startproject myincidentresponse

Install response:

$ pip install django-incident-response

In settings.py, add these lines to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "after_response",
    "rest_framework",
    "bootstrap4",
    "response.apps.ResponseConfig",
]

Add the following to settings.py:

USE_TZ = False # if this exists elsewhere in your settings.py, just update the value

STATIC_ROOT = "static"

# Django Rest Framework
REST_FRAMEWORK = {
    "PAGE_SIZE": 100,
    "DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
    "DEFAULT_PERMISSION_CLASSES": [
        "rest_framework.permissions.IsAuthenticated",
    ],
}
#

# Markdown Filter
MARKDOWN_FILTER_WHITELIST_TAGS = [
    "a", "p", "code", "h1", "h2", "ul", "li", "strong", "em", "img",
]

MARKDOWN_FILTER_WHITELIST_ATTRIBUTES = ["src", "style"]

MARKDOWN_FILTER_WHITELIST_STYLES = [
    "width", "height", "border-color", "background-color", "white-space",
    "vertical-align", "text-align", "border-style", "border-width", "float",
    "margin", "margin-bottom", "margin-left", "margin-right", "margin-top",
]

RESPONSE_LOGIN_REQUIRED = True

In urls.py, add the following to urlpatterns (you may also need to import include):

urlpatterns = [
    ...
    path('slack/', include('response.slack.urls')),
    path('core/', include('response.core.urls')),
    path('', include('response.ui.urls')),
]

Completing the setup and config with Slack

1. Create a Slack App

Follow these instructions to create a new Slack App.

2. Update your settings.py

Environment Variable Descriptions
SLACK_TOKEN Response needs an OAuth access token to use the Slack API.

Copy the Bot Token that starts xoxb-... from the OAuth & Permissions section of your Slack App and use it to set the SLACK_TOKEN variable.
SITE_URL Response needs to know where it is running in order to create links to the UI in Slack. Whilst running locally, you might want this set to something like http://localhost:8000.
SLACK_SIGNING_SECRET Response uses the Slack signing secret to restrict access to public endpoints.

Copy the Signing secret from the Basic Information page and use it to set the SIGNING SECRET variable.
INCIDENT_CHANNEL_ID When an incident is declared, a 'headline' post is sent to a central channel.

See the demo app settings for an example of how to get the incident channel ID from the Slack API.
INCIDENT_BOT_ID We want to invite the Bot to all Incident Channels, so need to know its ID.

See the demo app settings for an example of how to get the bot ID from the Slack API.
SLACK_CLIENT Response needs a shared global instance of a Slack Client to talk to the Slack API. Typically this does not require any additional configuration.
from response.slack.client import SlackClient
SLACK_CLIENT = SlackClient(SLACK_TOKEN)

3. Running the server

Before you can complete the Slack app setup, you need to have the app running somewhere that's accesible to to the internet. That means either deploying your Django project somewhere (see here or running it locally and exposing with something like ngrok.

For simplicity, we'll assume you're developing using ngrok.

First make sure your DB is fully migrated and up-to-date:

python3 manage.py migrate

Next, run the Django development server:

python3 manage.py runserver 0.0.0.0:8000

Finally, run ngrok:

ngrok http 8000

Make note of the ngrok url as you'll need it in the following section as the public-url.

4. Complete the Slack App Setup

Head back to the Slack web UI and complete the configuration of your app, as described here.

5. Test it's working!

In Slack, start an incident with /incident Something's happened. You should see a post in your incidents channel!

  • Visit the incident doc by clicking the Doc link.
  • Create a comms channel by clicking the button.
  • In the comms channel check out the @incident commands. You can find the ones available by entering @incident help.

More Repositories

1

typhon

A wrapper around Go's net/http to provide safety and convenience. At Monzo, Typhon forms the basis of most clients and servers in our microservices platform.
Go
713
star
2

phosphor

Distributed System Tracing in Go
Go
375
star
3

progression-framework

The Monzo Progression Framework site, built with Gatsby.
JavaScript
291
star
4

egress-operator

A Kubernetes operator to produce egress gateway Envoy pods and control access to them with network policies
Go
233
star
5

envoy-preflight

A wrapper for applications to help with running envoy as a sidecar
Go
134
star
6

docs

Public API documentation
SCSS
101
star
7

calico-accountant

A Prometheus exporter for Calico policy packet counts
Go
87
star
8

terrors

Go
71
star
9

ddbt

Dom's Data Build Tool
Go
70
star
10

file-cleaner

JavaScript
64
star
11

etcd3-terraform

A Terraform recipe for a robust etcd cluster, based on how Monzo runs its clusters. 💪
HCL
46
star
12

slog

Structured logging
Go
46
star
13

mondo-ruby

Ruby Client
Ruby
45
star
14

reference-receipts-app

A simple Monzo third party API client for demonstrating the new Receipts API.
Python
19
star
15

web-exercise

Take-home exercise for web engineer hiring 🚀
11
star
16

kotlin-synthetics-migrator

An Intellij Plugin for migrating an Android app from Kotlin Synthetics to findById
Kotlin
10
star
17

kontrast

Go
10
star
18

phosphord

Trace Forwarding Daemon
Go
9
star
19

phosphor-go

Go client for Phosphor
Go
7
star
20

vault-plugin-database-k8s-controller

A fork of Vault's database credential plugin allowing the use of annotations on service accounts as parameters in statements
Go
7
star
21

etcd3-bootstrap

Bootstraps an etcd3 cluster node
Go
6
star
22

drbd9_exporter

Exports status and metrics of DRBD 9.0 volumes
Go
6
star
23

code-of-conduct

The Monzo Community Code of Conduct
5
star
24

verifiedsms

A go library for interacting with Google Verified SMS
Go
3
star
25

file-score

JavaScript
3
star
26

web-code-test-server

Server for the frontend web dev code test in our interview process
JavaScript
2
star
27

gosquared

A golang gosquared client
Go
2
star
28

Judo-Swift

Judo Swift SDK for Swift 2.0/Xcode 7
Swift
2
star
29

guepacket

GUE (Generic UDP Encapsulation) layer for gopacket 📦
Go
2
star
30

CHCSVParser

Objective-C
1
star
31

libPhoneNumber-iOS

Objective-C
1
star