Building Ruby on Rails apps on Windows Azure (MIX 2010 at Last Vegas))

Preview:

DESCRIPTION

 

Citation preview

Ruby on Rails&

Windows Azure

@sriramksriramkrishnan.com

July 25th, 1965

Newport, Rhode

Island

http://www.flickr.com/photos/joegratz/83461579

Windows Azure and

the Microsoft cloud

Scalable

Computation

Cloud Storage

Utility

billing

Automated

manageme

nt

+

?!

We love Ruby on Rails

And other

languages/framewor

ks you secretly

love ;)

puts 'Hello world'

UsefulNOT!

THE RAILS“STACK”

load balancers

LOAD BALANCERS

Pound, Varnish, Pen, hardware solutions, etc…

LOAD BALANCERS

• Part of the platform• Any available TCP port• Can pull VMs in/out of rotation

REVERSE PROXIES

mod_proxy, Perlbal, nginx, …

REVERSE PROXIES Works the same way

app/web servers

APP& WEB SERVERS

Many, many combinations possible

Most work great

APP& WEB SERVERS

Worker Role (Windows Azure VM)

Ruby installatio

n

script/server

.NET

Wrapper code

Run() Process.Start()

Port 80

Worker Role (Windows Azure VM)

.NET

Wrapper code

Run() Process.Start()

Port 80

WEBRick/Mongrel

Apache

mod_proxy_balance

r

GEMS

• Package with app

• At runtime, use Gem::GemRunner or “gem install”

•Caveat – Not all gems build/work on 64-bit Windows

data

MYSQL Runs great on Windows Azure

MYSQLSolution Acceleratorhttp://bit.ly/99Bx9H

Master/slave, scale up and down slaves, periodic backups

WINDOWS AZURE CLOUD STORAGE SERVICES

SQL Azure

Blobs TablesQueue

s

SQL Azure

• Cloud-based relational database service

• Scalable, available, fault-tolerant

• Works with T-SQL based libraries/tools

SQL AzureUseactiverecord-sqlserver-adapter

Patch usinghttp://gist.github.com/318780

Storage Services • Public REST APIs

• waz-storage gem good starting point

Blobs

• Simple interface for storing named files with metadata

• Very large objects (upto 1TB in size per blob)

• Available through a CDN frontend

require 'waz-blobs‘

WAZ::Storage::Base.establish_connection!( :account_name => account_name,                                          :access_key => access_key)

container = WAZ::Blobs::Container.create('my-container‘)

blob = container.store('my_blob.txt’,'some content’,'plain/text‘)

blob = container['my_blob.txt']

Queues

• Reliable delivery of messages

• Drop-in replacement for beanstalkd, starling, worker systems

WAZ::Storage::Base.establish_connection!( :account_name => account_name,                                 :access_key => access_key)

queue = WAZ::Queues::Queue.create('my-queue')

queue.enqueue!("some message")

Tables

• Structured data at scale

• Efficiently insert, query and retrieve millions of entities

entity = { :first_name => ‘William',               :last_name => ‘Adama',                }

service.insert_entity('customer_table', entity)       

service.query('customer_table',     {:expression => "(last_name eq ‘Adama‘)",     :top => 2} )

caching

memcached

http://code.msdn.microsoft.com/winazurememcached

day to day

Deployment

Comes with the platform.

DeploymentUse service management API to automate

E.g : Deploy packages as a part of your Rakefile

Management

Comes with the platform.

Management • Use service management API to configure, upgrade, scale up/down

•Use monitoring/diagnostics API to replace nagios/ganglia

Debugging

• debug, to_yaml helpers work OOB

• Standard logger works great, logs to RAILS_ROOT/logs. Use diagnostics API to retrieve

THINGS TO REMEMBER

Open platfor

m

Works well with

Ruby world

Jump in!

“louder”

The end.

@sriramksriramkrishnan.com