@simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our...

66
@simonvc

Transcript of @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our...

Page 1: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

@simonvc

Page 2: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

We're a team of 60 people.

Page 3: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Based in the Old St area of London

Page 4: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

We're building a bank from scratch, currently operating a pre-paid mastercard while we develop a full current account. 60k customers already. People love it!

Page 5: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

What do these numbers mean?

1690

1865

1765

1771

Barclays

HSBC

Lloyds

RBS (W&G bank)

Banking is one of the oldest industries.

Page 6: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

flic.kr/p/7mPNgk

Banking products haven't changed much since the 1800s

Page 7: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Bank IT hasn't changed much since the 70s and 80s.

Page 8: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Legacy Bank Systems.

• Fixed width and EBCDIC files • Mainframes • Batch processes • Layers of caching around mainframe monoliths • Cobol • FTP files

How do you build a modern bank on top of legacy technology.. hint: you can't.

Page 9: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

• Can’t Search your transactions? • 18 UPPER CHARACTERS ONL • Can’t download old data • Or its only PDF renderings • No Api • No Unicode characters allowed 😂

Product features that are just missing, due to the difficulty of building them on legacy tech.

Page 10: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Banking should look like this. Mobile, convenient, simple.

Page 11: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

We've built a modern backend, with native Android and IOS applications.

Page 12: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Features like APIs, Spending targets, realtime notification, travel reports and more.

Page 13: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

GET /balance?account_id=acc_280842

Our API is open to all customers. https://developers.monzo.com for the API playground.https://monzo.com/docs for the api docs.

Page 14: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

{ "balance": 101878, "currency": "GBP", "spend_today": -429, "local_currency": "", "local_exchange_rate": 0, "local_spend": [ { "spend_today": -429, "currency": "GBP" } ] }

Restful. JSON

Page 15: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

<?xml version=“1.0” encoding=“UTF-8”?> <Document xmlns=“urn:iso:std:iso: 20022:tech:xsd:PAIN.001.001.03” xmlns:xsi=“http://www.w3.org/ 2001/XMLSchema-instance” <pcn:iso8583> <pcn:iso8583 record=304308240> <record-type>account</record-type> </pcn:cruft>

No XML :-)

Page 16: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

DevOps

@

Page 17: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

• 2014: ☁🚫 • 2015: 🤔☁ • 2016: ☁✅

The regulators in the UK are very forward looking and progressive. They have given the nod to us using the cloud.

Page 18: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Questions

We selected Amazon WebServices as our provider, after discussing with the regulators.

Page 19: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

🏦

🏦

🏦

🤔

We still have some hardware, primarily to connect physical fibre lines from partner banks and schemes.

Page 20: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

microservices

Page 21: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

We chose to build a golang microservices platform from the outset, because unlike a lot of startups, banks generally only get one chance to prove they are a trustworthy custodian of peoples money.

Page 22: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Our stack

• Golang • Linkerd (for RPC) • Docker/Kubernetes • NSQ for async messaging • Cassandra

We use a lot of modern technology.

Page 23: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Marathon

We started building on top of Mesos and Marathon.

Page 24: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Marathon a few months later

As we scaled, we decided there were things in Mesos and Marathon we didn't link, and Kubernetes seemed to be developing in the right direction, faster.

Page 25: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

slide about moving to kubernetes

So we switched to k8s.*name spaces*isolation*allows us to run heterogenous services*understands docker better*better community

Page 26: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

one api for all

Monzo, IS an API. Everything, from the phone app, to the customer care tools, to the internal devops tooling all uses the same API.

Page 27: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

the cli

Page 28: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

We built a Command Line Interface for our API, and use it for everything from operating the bank, to configuring the platform and building our software.

Page 29: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

internal tooling

Page 30: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Our internal dashboards and tools also use the same API.

Page 31: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

structured logging aka slog

Microservices can make it hard to find the correct logs for an issue, since in many processes on many machines are involved in every request.

Page 32: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

So we built a system that uses single trace id's to track requests across the entire cluster. We call it Slog (structured logging..)

Page 33: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

builds

Page 34: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

We use our production kubernetes cluster to build our software.

Securely building and storing our software *is* production, in terms of our important it is to us. We use a separate kubernetes namespace, and CPU/Memory limits to ensure that build workloads don't impact the running bank.

The build system is available through the API.

Page 35: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

terraform

We *love* terraform. We try to do all our changes through terraform.

Page 36: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Things that are good

Plan. Targets. Config can live in Git.

The ability to Plan your changes and see what the effect will be is much nicer than what you get from Cloudformation..

The ability to use Targets to make changes one part at a time is really useful.

Config can live in Git. Infrastructure as code.

Page 37: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Things that are not so good

No not_if or other way to suppress blocks.

TFSTATE that lives in git.

Terraform is improving rapidly, but there are a few things that are still annoyances.

tfstate.

no not_if or "when" blocks to allow for topological changes between prod and non prod environments.

Page 38: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

“terraforming” (or wait for tf 0.8)

Import existing infrastructure. * Import existing infra * TF creates config for it * Check it plans cleanly * Variables where appropriate

import existing infrastructure and create config for it.

"terraforming" a ruby gem lets you do this already.

Page 39: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

k8s (kubernetes)

namespacesisolationhigher utilisation

Page 40: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Kubernetes has allowed us to save quite a bit of money, by running our build and production workloads on the same hardware.

Page 41: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

kubectl

cliability to edit running deployments

Page 42: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

exec, run pass through to docker.

kubectl run -i --tty busybox --image=busybox --restart=Never

Kubectl has a couple of very powerful commands that allow you to use docker like functionality to run debugging/inspection jobs in the cluster.

Page 43: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

“kubectl edit” vs keep yml files in git

It's important not to be lazy and use "kubectl edit" and to keep your kubernetes yml files version controlled in git.

Page 44: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

k8s things missing - scheduling - encrypted overlay networks - persistent storage - live updating dashboards

cron in a container

current overlay solutions are based on iptables rules

pet sets coming, can we run our databases in k8s?

Page 45: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

heterogeneous containers

not just golang

cron/bashpython, Rlinkerd/java

Page 46: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

things that don't fit into containers (yet)

cassandra, jenkins

for these we use:ubuntu, puppet

Page 47: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

security 🔐

Page 48: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

use multiple AWS accounts

Page 49: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

The data and the backups of the data live in separate accounts

Page 50: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Hardware tokens for the root accounts, that live in a safe are the ultimate guarantee that our infrastructure will remain safe.

Page 51: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

aws-profile

go get github.com/mlrobinson/aws-profile

aws cli tools understand instance-profiles, but terraform and golang tools don't.

This utility solves that problem.

Page 52: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

terraform aws keys

dangerzone

Keys that can create infrastructure can destroy it as well.. Protect them well.

Page 53: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

use pass* + gpg + yubikeys

* https://www.passwordstore.org/

A scriptable, CLI password manager.

Page 54: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

monitoring

Page 55: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

ELK stack

Elastic searchLogstashKibana

now we only use it for logs

Page 56: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

"TICK" stack

Telegraf (statsd)Influx DBChronograf (we use graphana instead)Kapacitor

Page 57: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

pretty graphs

Page 58: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang
Page 59: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang
Page 60: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

influxdb

We have found InfluxDB to be immature Scaling and clustering is still not implemented, and it's possible to crash the database with a single query.

:-(

Page 61: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

how do you test for a negative?

How do you tell when you've stopped receiving metrics? is it just quiet? or is something broken?

Kapacitor has deadmans switch

Page 62: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Kapacitor has a deadmans switch. This allows you to create alerts based on the absence of events.

But what about if you're just not getting any transactions?

Page 63: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Simulate transactions! (this isn't us..)

This would be a really expensive inefficient way of testing transactions.

Page 64: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

if (last_txn_ > 1 minute ago): charge_a_card()

if (last_txn > 2 minutes ago): wake_someone_up()

What we really want is this..

Page 65: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Summing up.

• Built from scratch in Golang • Run on Kubernetes and Docker • Fully integrated build/deploy/manage

via API • Well covered by monitoring

Page 66: @simonvc · 2016-11-23 · • 2015: ☁ • 2016: ☁ ... We selected Amazon WebServices as our provider, after discussing with the regulators. & & & ... We chose to build a golang

Q&A