Ruby Deployment

50
Ruby Deployment Ezra Zygmuntowicz http://engineyard.com

description

 

Transcript of Ruby Deployment

Page 1: Ruby Deployment

Ruby DeploymentEzra Zygmuntowicz

http://engineyard.com

Page 2: Ruby Deployment

Brief History

Page 3: Ruby Deployment

Webrick

Page 4: Ruby Deployment

Apache + FastCGI

Page 5: Ruby Deployment

Lighttpd + FastCGI

Page 6: Ruby Deployment

Lighttpd + SCGI

Page 7: Ruby Deployment

Apache + FCGID

Page 8: Ruby Deployment

Mongrel + Apache

Page 9: Ruby Deployment

Mongrel + Lighttpd

Page 10: Ruby Deployment

Lightspeed

Page 11: Ruby Deployment

Mongrel + Nginx

WIN!

Page 12: Ruby Deployment

Thin or Ebb + Nginx

WIN!(sometimes)

Page 13: Ruby Deployment

Passenger(with caveats)

Page 14: Ruby Deployment

State of the art now:

Passenger for shared hosting/small VPS

Nginx + Mongrel or Thin for high volume

production deployments

Page 15: Ruby Deployment

Woah! That is 10 different options!

Page 16: Ruby Deployment

Woah! That is 10 different options!

And I rewrote my deployment book almost that many

times :(

Page 17: Ruby Deployment

And it was already out of date when it

shipped ;)

Page 18: Ruby Deployment

Rack: the great equalizer

Page 19: Ruby Deployment

Now with that out of the way...

Page 20: Ruby Deployment

Nanite: A world of services

Page 21: Ruby Deployment

Nanite is a new way of building scalable

backends for web apps

Page 22: Ruby Deployment

Built around RabbitMQ

• Written in erlang, clusterable, highly scalable, fast as hell.

• AMQP protocol provides many nice features

• Transient, Persistent and Transactional semantics

Page 23: Ruby Deployment

Nanite agentsconsist of multiple Actors

Page 24: Ruby Deployment

Nanite agents advertisetheir services and status

Feeds#crawladvertises:/feeds/crawl

Load average is advertised as default status

Page 25: Ruby Deployment

Nanite Mappers

Track nanites and their advertised services and status

Can do dispatch based on a number of factors

Run inside your Merb or Rails app

State of all nanites is replicated across all mappers

Page 26: Ruby Deployment

Multiple Dispatch Styles

Page 27: Ruby Deployment

Least loaded dispatch and the fitness function

Page 28: Ruby Deployment

Agents ping the mapper exchange every @ping_time seconds.

Mappers track the state of all nanites and remove them from

mapping if they haven’t reported in within a timeout

Page 29: Ruby Deployment

Nanite gives us:

• Presence, we know when nanites are ready for requests or not.

• Self assembly, nanites can come and go and can run anywhere with zero configuration in the mappers.

• Dispatch based on load or any fitness function that suits your app

• Easily take advantage of cloud

Page 30: Ruby Deployment

File Streaming

Page 31: Ruby Deployment

Rack over Nanite

Page 32: Ruby Deployment

Nanite makes it easy to scale web app backends

Git it on GitHub:http://github.com/ezmobius/nanite

Page 33: Ruby Deployment

Engine Yard abstracted from

Engine Yard

EYAASEngine Yard As A

Service

Page 34: Ruby Deployment

EYAASEngine Yard As A

Service

Clouds are too low level for

average humans

Page 35: Ruby Deployment

EYAASEngine Yard As A

Service

First Target:AWS

Page 36: Ruby Deployment

EYAASEngine Yard As A

Service

Next Target:Your own Servers in your own DC, any

new cloud computing platforms that pop up.

Page 37: Ruby Deployment

Demo

Page 38: Ruby Deployment

A Different Way of Thinking

Page 39: Ruby Deployment

It’s all about the Automation

Page 40: Ruby Deployment

1. State Based Configuration Management

Repeatable

Idempotent

Page 41: Ruby Deployment

1. State Based Configuration Management

Treat an instance like a referentially transparent function

f(config) -> Fully Configured Instance

Calling f(config) will *always* create the same instance whenever config == config

Page 42: Ruby Deployment

1. State Based Configuration Management

Treat instances as throw away

Prefer rebuilding from scratch

Only persist what truly needs to be persistent

Page 43: Ruby Deployment

Custom Gentoo or Ubuntu LinuxState based config management

Ad hoc ChangeExtensive Monitoring

24/7 supportHigh Level Cloud

EYAAS

Page 44: Ruby Deployment

Bridge multiple providersHighly tuned databases on EY

Elastic app servers on ec2Will support any compelling new

cloud platforms

EYAAS

Page 45: Ruby Deployment
Page 46: Ruby Deployment
Page 47: Ruby Deployment

JSON “DNA” describes your deployments. Servers can be built from bare metal to spec in a few minutes.

Page 48: Ruby Deployment
Page 49: Ruby Deployment
Page 50: Ruby Deployment

Questions?