rails on aws - rubyfools copenhagen 2008 by jonathan weiss

Post on 15-Jan-2015

4.163 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

Ruby on Rails utilizing Amazon Web Services. A presentation by Jonathan Weiss at RubyFools Copenhagen 2008.

TRANSCRIPT

Rails on AWS

Jonathan Weiss, Peritor Wissensmanagement GmbH

RubyFools Copenhagen, 2008

2

Starting Point

One machine:

• Apache

• Ruby / Rails

• MySQL

3

Worst Case Populariy

4

A Difficult Path

5

Problem: Backup

• High availability

• Redundancy

• Very big data sets

6

Problem: File System

• Important files have to be accessed by many servers

• NFS / Samba not practical

7

Problem: Spontaneous Traffic

8

Problem: Load Fluctuation

9

Don‘t reinvent the wheel!

10

Amazon Web Services

Simple Storage Service - S3

Redundant Data Store

$0,15 per GB data per month

$0,10 - $0,20 per GB traffic

Virtual server per hour

$0,10 per CPU hour

$0,10 - $0,20 per GB traffic

Elastic Compute Cloud - EC2

…….

E-Commerce S..

11

S3 - Simple Storage Service

• Redundant storage - as much as you like

• max. 5 GB per object

• Organized in „Buckets“

• Web Service API for uploads

• Downloads via

• Web Service

• HTTP / HTTPS

• BitTorrent

12

S3 - Buckets

• Unique over all S3

• Contains many key-value-metadata tupel

• Cannot contain other buckets!

• Key can contain „/“

MyBucket_name

S3

foto_5.jpg

backups/januar.zip

fotos/2007/001.png

www.peritor.com

site/screen.css

site/script.js

FreeBSD-6.2.iso

13

S3 with AWS::S3

Upload

Download

14

EC2 - Elastic Compute Cloud

•  Based on XEN virtualization

•  On demand virtual servers - controlled with Web Service API

•  Use your favorite Linux distro (Linux 2.6.16), Amazon Machine Images (AMI) are stored on S3

•  ACLs for hosts/ports access control

15

EC2 Tools

List availabe images

Start a new instance

Login with SSH

Shutdown instance

16

amazon-ec2 gem Setup

Usage

17

And now?

How does this solve my problems?

18

S3 - Backup

• s3sync.rb

• Brackup

• Jungle Disk

• S3 FUSE

• s3DAV

• Duplicity

• S3Browser

• Firefox S3 Organizer extension

• …

19

s3sync.rb

Backup

Restore

20

S3 Asset Host

21

S3 Asset Host

Setup DNS

Rails configuration

22

S3 Asset Host

welcome.rhtml template

Output

23

S3 - Authenticated User Data

24

attachment_fu Rails plugin

Setup

25

attachment_fu Rails plugin

Upload

Download

26

On-Demand Computing with EC2

Time based, e.g. with cron

27

On-Demand Computing with EC2

Load based, e.g. with Monit

28

On-Demand Computing with EC2

29

Availability Zones

30

Elastic IPs

31

EC2 for extra capacity

32

Load Balancer / Proxy

Example mod_proxy_blancer:

• Talks to multiple backend servers (Mongrel)

• Central Proxy/Load-Balancer configuration that has knowledge about nodes

• Typically proxy restart on config change

33

Swiftiply

Swiftiply Proxy:

• Multiple backend clients have a persistent connection to the backend port

• Proxy listens on cluster port for requests and forwards them

No re-configuration

34

Swiftiply Proxy

Configuration

Start

Installation

35

Swiftiplied Mongrel

• Gem plugin that patches Mongrel

• Transforms Mongrel in Swiftiply client

• Experimental

Start

or

36

EC2 on Demand before Swiftiply

37

EC2 on Demand with Swiftiply

38

EC2 on Demand with Swiftiply

39

Ressources

•  Amazon Web Services http://aws.amazon.com

•  Swiftiply

http://swiftiply.swiftcore.org

•  Attachment_fu http://svn.techno-weenie.net/projects/plugins/attachment_fu/

•  Elastic Rails http://www.elasticrails.com

•  Capazon http://capazon.rubyforge.org

•  Rubber http://rubber.rubyforge.org

•  RightScale

http://www.rightscale.com

40

Peritor Wissensmanagement GmbH

Lenbachstraße 2 12157 Berlin

Internet: www.peritor.com Email: info@peritor.com

© Peritor Wissensmanagement GmbH - All Rights Reserved

Telefon: +49 (0)30 69 40 11 94 Telefax: +49 (0)30 69 40 11 95

top related