88
Infrastructure Coders - Melbourne - November 2013 Kevin O’Neill - CTO PlayUp - @kevinoneill Kevin O’Neill CTO PlayUp Deploying the Graph @kevinoneill November 2013

Deploying the Graph

Embed Size (px)

DESCRIPTION

A talk given in November 2013 to the infrastructure coders group in Melbourne on how PlayUp deploys the backend for it's latest generation of applications, using packer and amazon web services.

Citation preview

Page 1: Deploying the Graph

Infrastructure Coders - Melbourne - November 2013Kevin O’Neill - CTO PlayUp - @kevinoneill

Kevin O’Neill CTO PlayUp

Deploying the Graph

@kevinoneill

November 2013

Page 2: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Page 3: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Page 4: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Page 5: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Page 6: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

A little History

Page 7: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Engage & Entertain Around Live Sport

Page 8: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Mobile Games

Page 9: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

SMS Based

Page 10: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Number of Runs

Page 11: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Complex

Page 12: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Carrier Integration

Page 13: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Smart Phone Revolution

Page 14: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Move from a Content Creator to a Content

Enabler

Page 15: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Top 10 in Engagement

Page 16: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Over 3 Million Likes

Page 17: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

30% - 40% Active

Page 18: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Manually Curated

Page 19: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

We Know there's an Opportunity

Page 20: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

The Graph

Page 21: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Scala

Page 22: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Scala

• A Scalable language

• Object-Oriented

• Functional

• Seamless Java Interoperability

• Functions are Objects

Page 23: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

AKKA

Page 24: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

AKKA

• Actors

• Fault Tolerance

• Location Transparency

• Transactors

Page 25: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Neo4j

Page 26: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Neo4j

• Graph Database

• Vertices and Edges

• Properties

• Full Text Index

Page 27: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

WhiteboardOutlining the bits

Page 28: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Runtime

Page 29: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

AWS

Page 30: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

AWS

• us-west

• m2.2xlarge

• ubuntu 13.04

• jre 7

Page 31: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

JVM

Page 32: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

JVM

• Graph - 8G of Heap

• Others 128M - 1G

• Parallel GC

Page 33: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

The remaining memory is reserved for file system cache and

memory mapped buffers

Page 34: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Building the Components

Page 35: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

SBT

Page 36: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Builds the jars

Page 37: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Debian Packages

Page 38: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Debian Packages

• Places binaries in opt

• Adds an upstart file for the

• Permissions on data and log directories

Page 39: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

graph-server.upstart

setuid  ubuntu  setgid  ubuntu  !console  log  !chdir  /var/lib/playup/spot/graph-­‐server  !exec  java  -­‐server  -­‐Xms4096M  -­‐Xmx8192M  -­‐Xss1M  \      -­‐XX:MaxPermSize=256M  -­‐XX:+UseParallelGC  \      -­‐jar  /opt/playup/spot/graph-­‐server/run.jar  \      com.playup.spot.graph.service.NeoKernel

Page 40: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Base configuration is for production

Page 41: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Baking

Page 42: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Packer

Page 43: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Create machine images for multiple platforms from a single config

Page 44: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Images have lots of benefits

Page 45: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Fast Deployment

Page 46: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Stability

Page 47: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Testability

Page 48: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Packer makes creating images a breeze

Page 49: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Example

Page 50: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Builders

"builders":  [          {              "type":  "amazon-­‐ebs",              "instance_type":  "t1.micro",              "region":  "ap-­‐southeast-­‐2",              "ami_name":  "spot-­‐graph-­‐{{user  `version`}}-­‐{{timestamp}}",              "source_ami":  "ami-­‐4bf26f71",              "ssh_username":  "ubuntu",              "tags":  {                  "Name":  "spot-­‐graph-­‐{{user  `version`}}  ({{isotime}})",                  "OS":  "Ubuntu",                  "Version":  "{{user  `version`}}-­‐{{timestamp}}"              },              "ami_regions":["us-­‐west-­‐2"]          }  …

Page 51: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Builders

"builders":  [          {              "type":  "amazon-­‐ebs",              "instance_type":  "t1.micro",              "region":  "ap-­‐southeast-­‐2",              "ami_name":  "spot-­‐graph-­‐{{user  `version`}}-­‐{{timestamp}}",              "source_ami":  "ami-­‐4bf26f71",              "ssh_username":  "ubuntu",              "tags":  {                  "Name":  "spot-­‐graph-­‐{{user  `version`}}  ({{isotime}})",                  "OS":  "Ubuntu",                  "Version":  "{{user  `version`}}-­‐{{timestamp}}"              },              "ami_regions":["us-­‐west-­‐2"]          }  …

Page 52: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Builders

"builders":  [          {              "type":  "amazon-­‐ebs",              "instance_type":  "t1.micro",              "region":  "ap-­‐southeast-­‐2",              "ami_name":  "spot-­‐graph-­‐{{user  `version`}}-­‐{{timestamp}}",              "source_ami":  "ami-­‐4bf26f71",              "ssh_username":  "ubuntu",              "tags":  {                  "Name":  "spot-­‐graph-­‐{{user  `version`}}  ({{isotime}})",                  "OS":  "Ubuntu",                  "Version":  "{{user  `version`}}-­‐{{timestamp}}"              },              "ami_regions":["us-­‐west-­‐2"]          }  …

Page 53: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Builders

"builders":  [          {              "type":  "amazon-­‐ebs",              "instance_type":  "t1.micro",              "region":  "ap-­‐southeast-­‐2",              "ami_name":  "spot-­‐graph-­‐{{user  `version`}}-­‐{{timestamp}}",              "source_ami":  "ami-­‐4bf26f71",              "ssh_username":  "ubuntu",              "tags":  {                  "Name":  "spot-­‐graph-­‐{{user  `version`}}  ({{isotime}})",                  "OS":  "Ubuntu",                  "Version":  "{{user  `version`}}-­‐{{timestamp}}"              },              "ami_regions":["us-­‐west-­‐2"]          }  …

Page 54: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Builders

"builders":  [          {              "type":  "amazon-­‐ebs",              "instance_type":  "t1.micro",              "region":  "ap-­‐southeast-­‐2",              "ami_name":  "spot-­‐graph-­‐{{user  `version`}}-­‐{{timestamp}}",              "source_ami":  "ami-­‐4bf26f71",              "ssh_username":  "ubuntu",              "tags":  {                  "Name":  "spot-­‐graph-­‐{{user  `version`}}  ({{isotime}})",                  "OS":  "Ubuntu",                  "Version":  "{{user  `version`}}-­‐{{timestamp}}"              },              "ami_regions":["us-­‐west-­‐2"]          }  …

Page 55: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Variables

   "variables":  {          "version":  "development"      }  

Page 56: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Provisioners    "provisioners":  [        {              "script":  "scripts/update-­‐packages.sh",              "type":  "shell"          },          {              "script":  "scripts/install-­‐puppet.sh",              "type":  "shell"          },          {              "type":  "file",              "source":  "packages",              "destination":  "/tmp"          },          {              "script":  "scripts/install-­‐spot-­‐packages.sh",              "type":  "shell"          },          {              "type":  "puppet-­‐masterless",              "manifest_file":  "puppet/spot-­‐graph.pp",              "module_paths":  ["puppet/local",  "puppet/common"]          },          {              "script":  "scripts/build-­‐date.sh",              "type":  "shell"          }    

Page 57: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Provisioners    "provisioners":  [        {              "script":  "scripts/update-­‐packages.sh",              "type":  "shell"          },          {              "script":  "scripts/install-­‐puppet.sh",              "type":  "shell"          },          {              "type":  "file",              "source":  "packages",              "destination":  "/tmp"          },          {              "script":  "scripts/install-­‐spot-­‐packages.sh",              "type":  "shell"          },          {              "type":  "puppet-­‐masterless",              "manifest_file":  "puppet/spot-­‐graph.pp",              "module_paths":  ["puppet/local",  "puppet/common"]          },          {              "script":  "scripts/build-­‐date.sh",              "type":  "shell"          }    

Page 58: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Provisioners    "provisioners":  [        {              "script":  "scripts/update-­‐packages.sh",              "type":  "shell"          },          {              "script":  "scripts/install-­‐puppet.sh",              "type":  "shell"          },          {              "type":  "file",              "source":  "packages",              "destination":  "/tmp"          },          {              "script":  "scripts/install-­‐spot-­‐packages.sh",              "type":  "shell"          },          {              "type":  "puppet-­‐masterless",              "manifest_file":  "puppet/spot-­‐graph.pp",              "module_paths":  ["puppet/local",  "puppet/common"]          },          {              "script":  "scripts/build-­‐date.sh",              "type":  "shell"          }    

Page 59: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Provisioners    "provisioners":  [        {              "script":  "scripts/update-­‐packages.sh",              "type":  "shell"          },          {              "script":  "scripts/install-­‐puppet.sh",              "type":  "shell"          },          {              "type":  "file",              "source":  "packages",              "destination":  "/tmp"          },          {              "script":  "scripts/install-­‐spot-­‐packages.sh",              "type":  "shell"          },          {              "type":  "puppet-­‐masterless",              "manifest_file":  "puppet/spot-­‐graph.pp",              "module_paths":  ["puppet/local",  "puppet/common"]          },          {              "script":  "scripts/build-­‐date.sh",              "type":  "shell"          }    

Page 60: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Builder Provisioners

   "provisioners":  [  !   …  !        {              "type":  "shell",              "script":  "scripts/vagrant.sh",              "only":  ["virtualbox"]          },          {              "type":  "shell",              "script":  "scripts/guest-­‐additions.sh",              "only":  ["virtualbox"]          },  !   …

Page 61: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Build

$  packer  build  -­‐-­‐only  "amazon-­‐ebs"  template.json  

Page 62: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

In a few minutes you have a shiny new image

Page 63: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

CI

Page 64: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

CI

• Variables

• source ami

• region

• default build is for local development

Page 65: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Starting an instance

Page 66: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Remember

Page 67: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Backed config is for Production*

Page 68: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

We have staging plus multiple developer environments

Page 69: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

CloudInit

Page 70: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Configure values in /etc/playup/…

Page 71: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Configure the puppet master*

Page 72: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Cloud Formation

Page 73: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Which images

Page 74: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

What CloudInit values

Page 75: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Challenges

Page 76: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Too many to list …

Page 77: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Persistant Data

Page 78: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Service Registration

Page 79: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Cluster Membership

Page 80: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Investigating

Page 81: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Docker

Page 82: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Apache Mesos

Page 83: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Come Join Us

Page 84: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Disrupting

Page 85: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Hiring Selectively

Page 86: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Talk to Me or Andrea

Page 87: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

You miss 100 percent of the the shots you don't take

– Wayne Gretzky

Page 88: Deploying the Graph

Kevin O’Neill - CTO PlayUp - @kevinoneill Infrastructure Coders - Melbourne - November 2013

Kevin O’NeillCTO - PlayUp

[email protected]@kevinoneill

Questions?