your own (little) gem: building an online business with ruby

168
Your own (little) gem building an online business with Ruby Lindsay Holmwood <[email protected]>

Upload: lindsay-holmwood

Post on 06-May-2015

1.891 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Your own (little) gem: building an online business with Ruby

Your own (little) gembuilding an online business with Ruby

Lindsay Holmwood <[email protected]>

Page 2: Your own (little) gem: building an online business with Ruby
Page 3: Your own (little) gem: building an online business with Ruby
Page 4: Your own (little) gem: building an online business with Ruby
Page 5: Your own (little) gem: building an online business with Ruby
Page 6: Your own (little) gem: building an online business with Ruby
Page 7: Your own (little) gem: building an online business with Ruby

(.com)

Page 8: Your own (little) gem: building an online business with Ruby

business

development

operations

Page 9: Your own (little) gem: building an online business with Ruby

have an idea

Page 10: Your own (little) gem: building an online business with Ruby

check that it’s profitable

Page 11: Your own (little) gem: building an online business with Ruby

are both fruit

apples oranges

Page 12: Your own (little) gem: building an online business with Ruby

web store book shop

are both businesses

Page 13: Your own (little) gem: building an online business with Ruby

financials

Page 14: Your own (little) gem: building an online business with Ruby

are important.

Page 15: Your own (little) gem: building an online business with Ruby

do them!

Page 16: Your own (little) gem: building an online business with Ruby

(conservative estimates are best)

Page 17: Your own (little) gem: building an online business with Ruby

check your tech

Page 18: Your own (little) gem: building an online business with Ruby

time is an expense

Page 19: Your own (little) gem: building an online business with Ruby

halve your deliverables

Page 20: Your own (little) gem: building an online business with Ruby

then halve them again

Page 21: Your own (little) gem: building an online business with Ruby

1-2 core features

Page 22: Your own (little) gem: building an online business with Ruby

write ideas down

Page 23: Your own (little) gem: building an online business with Ruby
Page 24: Your own (little) gem: building an online business with Ruby

development

Page 25: Your own (little) gem: building an online business with Ruby

development

Merb (merbivore.com)

Page 26: Your own (little) gem: building an online business with Ruby

development

Merb (merbivore.com)

DataMapper (datamapper.org)

Page 27: Your own (little) gem: building an online business with Ruby

development

Merb (merbivore.com)

DataMapper (datamapper.org)

MooTools (mootools.net)

Page 28: Your own (little) gem: building an online business with Ruby

development

Page 29: Your own (little) gem: building an online business with Ruby

bootstrap

Page 30: Your own (little) gem: building an online business with Ruby

bootstrap

$ sudo gem install merb-core merb-more

Page 31: Your own (little) gem: building an online business with Ruby

bootstrap

$ sudo gem install merb-core merb-more

$ sudo gem install dm-core dm-more do_sqlite3

Page 32: Your own (little) gem: building an online business with Ruby

bootstrap

$ sudo gem install merb-core merb-more

$ merb-gen app schoonerwatch.com

$ sudo gem install dm-core dm-more do_sqlite3

Page 33: Your own (little) gem: building an online business with Ruby

bootstrap

$ sudo gem install merb-core merb-more

$ merb-gen app schoonerwatch.com

$ cd schoonerwatch.com

$ sudo gem install dm-core dm-more do_sqlite3

Page 34: Your own (little) gem: building an online business with Ruby

bootstrap

$ sudo gem install merb-core merb-more

$ merb-gen app schoonerwatch.com

$ cd schoonerwatch.com

$ bzr init ; bzr add

$ bzr commit -m "initial commit"

$ sudo gem install dm-core dm-more do_sqlite3

Page 35: Your own (little) gem: building an online business with Ruby

bootstrap

$ sudo gem install merb-core merb-more

$ merb-gen app schoonerwatch.com

$ cd schoonerwatch.com

$ bzr init ; bzr add

$ bzr commit -m "initial commit"

$ sudo gem install dm-core dm-more do_sqlite3

s/bzr/git/g

Page 36: Your own (little) gem: building an online business with Ruby

merb-gen

Page 37: Your own (little) gem: building an online business with Ruby

merb-gen

$ merb &

Page 38: Your own (little) gem: building an online business with Ruby

merb-gen

$ merb &

$ merb-gen resource pub

Page 39: Your own (little) gem: building an online business with Ruby

merb-gen

$ merb &

$ merb-gen resource pub

$ bzr commit -m "added merb-gen'd pub resource"

Page 40: Your own (little) gem: building an online business with Ruby

merb-gen

$ merb &

$ merb-gen resource pub

$ bzr commit -m "added merb-gen'd pub resource"

$ vim spec/spec.opts spec/spec_helper.rb

Page 41: Your own (little) gem: building an online business with Ruby

spec/spec.opts

--colour--formatprofile

Page 42: Your own (little) gem: building an online business with Ruby

spec/spec_helper.rb

...

Spec::Runner.configure do |config| config.include(Merb::Test::ViewHelper) config.include(Merb::Test::RouteHelper) config.include(Merb::Test::ControllerHelper) end

DataMapper.auto_migrate!

Page 43: Your own (little) gem: building an online business with Ruby

run specs

Page 44: Your own (little) gem: building an online business with Ruby

run specs

$ rake spec:request

Page 45: Your own (little) gem: building an online business with Ruby

run specs

$ rake spec:request

.**......

Pending:resource(:pubs) GET contains a list of pubs (TODO) Called from ./spec/requests/pubs_spec.rb:21resource(:pubs) GET has a list of pubs (TODO) Called from ./spec/requests/pubs_spec.rb:33

Finished in 0.322787 seconds

9 examples, 0 failures, 2 pending

Page 46: Your own (little) gem: building an online business with Ruby

request specs

Page 47: Your own (little) gem: building an online business with Ruby

request specs

$ vim spec/requests/pubs_spec.rb

Page 48: Your own (little) gem: building an online business with Ruby

request specs

$ vim spec/requests/pubs_spec.rb

...

it "contains a sorted list of pubs" do @response.should have_xpath("//h3[contains(.,'Cheapest')]") @response.should have_xpath("//h3[contains(.,'Nearest')]")

end

Page 49: Your own (little) gem: building an online business with Ruby

run specs

Page 50: Your own (little) gem: building an online business with Ruby

$ rake spec:request

run specs

Page 51: Your own (little) gem: building an online business with Ruby

$ rake spec:request

Pending:resource(:pubs) GET has a list of pubs (TODO) Called from ./spec/requests/pubs_spec.rb:33

1)'resource(:pubs) GET contains a sorted list of pubs' FAILEDexpected following text to match xpath //h3[contains(.,'Cheapest')]’./spec/requests/pubs_spec.rb:21:

Finished in 0.411139 seconds

9 examples, 1 failure, 1 pending

run specs

Page 52: Your own (little) gem: building an online business with Ruby

haml

Page 53: Your own (little) gem: building an online business with Ruby

haml

$ vim config/dependencies.rb

Page 54: Your own (little) gem: building an online business with Ruby

haml

$ vim config/dependencies.rb

...

dependency "merb-haml", merb_gems_version

Page 55: Your own (little) gem: building an online business with Ruby

haml

$ vim config/dependencies.rb

...

dependency "merb-haml", merb_gems_version

$ vim config/init.rb

Page 56: Your own (little) gem: building an online business with Ruby

haml

$ vim config/dependencies.rb

...

dependency "merb-haml", merb_gems_version

$ vim config/init.rb

...

use_template_engine :haml

Page 57: Your own (little) gem: building an online business with Ruby

hamlise view

Page 58: Your own (little) gem: building an online business with Ruby

hamlise view

$ bzr mv app/views/pubs/index.html.erb \ app/views/pubs/index.html.haml

Page 59: Your own (little) gem: building an online business with Ruby

hamlise view

$ bzr mv app/views/pubs/index.html.erb \ app/views/pubs/index.html.haml

$ vim app/views/pubs/index.html.haml

Page 60: Your own (little) gem: building an online business with Ruby

hamlise view

$ bzr mv app/views/pubs/index.html.erb \ app/views/pubs/index.html.haml

$ vim app/views/pubs/index.html.haml

%h3 Nearest%h3 Cheapest

Page 61: Your own (little) gem: building an online business with Ruby

hamlise view

$ bzr mv app/views/pubs/index.html.erb \ app/views/pubs/index.html.haml

$ vim app/views/pubs/index.html.haml

%h3 Nearest%h3 Cheapest

$ rake spec:request

Pending:resource(:pubs) GET has a list of pubs (TODO) Called from ./spec/requests/pubs_spec.rb:33

Finished in 0.389194 seconds

9 examples, 0 failures, 1 pending

tests pass!

Page 62: Your own (little) gem: building an online business with Ruby

model specs

Page 63: Your own (little) gem: building an online business with Ruby

model specs

$ vim spec/models/pubs_spec.rb

Page 64: Your own (little) gem: building an online business with Ruby

model specs

$ vim spec/models/pubs_spec.rb

1.

Page 65: Your own (little) gem: building an online business with Ruby

model specs

$ vim spec/models/pubs_spec.rb

it "should have name, address, price" do @pubs.each do |pub| pub.name.should_not be_nil pub.address.should_not be_nil pub.price.should_not be_nil end end

1.

Page 66: Your own (little) gem: building an online business with Ruby

model specs

$ vim spec/models/pubs_spec.rb

it "should handle different url formats" do @pubs.each do |pub| pub.url = 'mygreatpub.com.au' pub.save.should be_true pub.url = 'http://mygreatpub.com.au/' pub.save.should be_true endend

2.

Page 67: Your own (little) gem: building an online business with Ruby

model specs

$ vim spec/models/pubs_spec.rb

it "should consistently format + store urls" do @pubs.each do |pub| adjective = %w[great swanky awesome stylish][rand(4)] pub.url = "#{adjective}pub.com.au" pub.save.should be_true pub.url.should =~ /^http:\/\/.+\/$/ endend

3.

Page 68: Your own (little) gem: building an online business with Ruby

model specs

Page 69: Your own (little) gem: building an online business with Ruby

model specs

$ vim spec/models/pubs_spec.rb

before(:each) do @pubs = 10.of { Pub.generate } end

Page 70: Your own (little) gem: building an online business with Ruby

model specs

$ vim spec/models/pubs_spec.rb

before(:each) do @pubs = 10.of { Pub.generate } end

require 'dm-sweatshop' Pub.fixture do { :name => ( name = %w[John Jane Jerry Justin][rand(4)] + "'s Pub"), :price => (1..30).to_a[rand(30)], :address => "#{(40..166).to_a[rand(126)]} Spring " + %w[Street Road Avenue][rand(3)], :url => "http://#{name.gsub(/\W/, '').downcase}.com/" } end

$ vim spec/spec_fixtures.rb

Page 71: Your own (little) gem: building an online business with Ruby

run specs

Page 72: Your own (little) gem: building an online business with Ruby

$ rake spec:models

run specs

Page 73: Your own (little) gem: building an online business with Ruby

$ rake spec:models

1)NameError in 'Pub should have name, address, price'address= is not a public property

2)NameError in 'Pub should handle different url formats'address= is not a public property

3) NameError in 'Pub should consistently format + store urls'address= is not a public property

Finished in 0.252169 seconds 3 examples, 3 failures

run specs

Page 74: Your own (little) gem: building an online business with Ruby

define properties

Page 75: Your own (little) gem: building an online business with Ruby

define properties

$ vim app/models/pub.rb

Page 76: Your own (little) gem: building an online business with Ruby

define properties

$ vim app/models/pub.rb

class Pub include DataMapper::Resource property :id, Serial property :name, String, :nullable => false property :address, String, :nullable => false property :price, BigDecimal, :nullable => false property :url, String

Page 77: Your own (little) gem: building an online business with Ruby

custom setter

$ vim app/models/pub.rb

...

def url=(string) string = "http://#{string}" unless string =~ /^http:\/\/.+\// string += '/' unless string =~ /\/$/ @url = string end

end

Page 78: Your own (little) gem: building an online business with Ruby

run specs

Page 79: Your own (little) gem: building an online business with Ruby

$ rake spec:models

run specs

Page 80: Your own (little) gem: building an online business with Ruby

$ rake spec:models

run specs

Finished in 0.488351 seconds

3 examples, 0 failures

win!

Page 81: Your own (little) gem: building an online business with Ruby

request specs

Page 82: Your own (little) gem: building an online business with Ruby

request specs

$ vim spec/requests/pubs_spec.rb

Page 83: Your own (little) gem: building an online business with Ruby

request specs

$ vim spec/requests/pubs_spec.rb

...

it "contains a list of cheapest pubs" do @response.should have_xpath("//div[@id=’cheapest’]")@response.should have_xpath("//div[@id=’cheapest’]//table//tr//td[@class='name']")@response.should have_xpath("//div[@id=’cheapest’]//table//tr//td[@class='address']")@response.should have_xpath("//div[@id=’cheapest’]//table//tr//td[contains(@class,'price')]")

end

Page 84: Your own (little) gem: building an online business with Ruby

run specs

Page 85: Your own (little) gem: building an online business with Ruby

$ rake spec:request

run specs

Page 86: Your own (little) gem: building an online business with Ruby

$ rake spec:request

Pending:resource(:pubs) GET has a list of pubs (TODO) Called from ./spec/requests/pubs_spec.rb:37

1)'resource(:pubs) GET contains a list cheapest pubs' FAILEDexpected following text to match xpath //div[@id='cheapest']./spec/requests/pubs_spec.rb:26:

Finished in 0.411139 seconds

10 examples, 1 failure, 1 pending

run specs

Page 87: Your own (little) gem: building an online business with Ruby

build partial

Page 88: Your own (little) gem: building an online business with Ruby

build partial

$ vim app/views/pubs/index.html.haml

Page 89: Your own (little) gem: building an online business with Ruby

build partial

$ vim app/views/pubs/index.html.haml

%h3 Nearest%h3 Cheapest%div#cheapest= partial "cheapest"

Page 90: Your own (little) gem: building an online business with Ruby

build partial

$ vim app/views/pubs/index.html.haml

%h3 Nearest%h3 Cheapest%div#cheapest= partial "cheapest"

$ vim app/views/pubs/_cheapest.html.haml

Page 91: Your own (little) gem: building an online business with Ruby

build partial

$ vim app/views/pubs/index.html.haml

%h3 Nearest%h3 Cheapest%div#cheapest= partial "cheapest"

$ vim app/views/pubs/_cheapest.html.haml

%table - @pubs.each_with_index do |pub, index| %tr %td.name= link_to pub.name, pub.url %td.address= pub.address %td{:class => "price cheapest-#{index}"} = '$' + sprintf("%.2f", pub.price)

Page 92: Your own (little) gem: building an online business with Ruby

run specs

Page 93: Your own (little) gem: building an online business with Ruby

$ rake spec:request

run specs

Page 94: Your own (little) gem: building an online business with Ruby

$ rake spec:request

Pending:resource(:pubs) GET has a list of pubs (TODO) Called from ./spec/requests/pubs_spec.rb:37

Finished in 0.854704 seconds

10 examples, 0 failures, 1 pending

run specs

Page 95: Your own (little) gem: building an online business with Ruby

nearest

Page 96: Your own (little) gem: building an online business with Ruby

nearest

$ vim app/views/pubs/index.html.haml

Page 97: Your own (little) gem: building an online business with Ruby

nearest

$ vim app/views/pubs/index.html.haml

%h3 Nearest%div#nearest= partial "nearest"

%h3 Cheapest%div#cheapest= partial "cheapest"

Page 98: Your own (little) gem: building an online business with Ruby

nearest

$ vim app/views/pubs/index.html.haml

%h3 Nearest%div#nearest= partial "nearest"

%h3 Cheapest%div#cheapest= partial "cheapest"

$ vim app/views/pubs/_nearest.html.haml

Page 99: Your own (little) gem: building an online business with Ruby

nearest

$ vim app/views/pubs/index.html.haml

%h3 Nearest%div#nearest= partial "nearest"

%h3 Cheapest%div#cheapest= partial "cheapest"

$ vim app/views/pubs/_nearest.html.haml

%div#map{:style => "width: 800px; height: 600px; margin: auto;"}

Page 100: Your own (little) gem: building an online business with Ruby

global layout

Page 101: Your own (little) gem: building an online business with Ruby

global layout

$ vim app/views/layout/application.html.erb

Page 102: Your own (little) gem: building an online business with Ruby

global layout

$ vim app/views/layout/application.html.erb

<%= js_include_tag 'mootools' %><%= js_include_tag 'SimpleTabs' %><%= js_include_tag 'application' %><script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=

<%= Merb.config.gmaps_api_key %>" type="text/javascript"></script>

Page 103: Your own (little) gem: building an online business with Ruby

api key

$ vim app/views/layout/application.html.erb

<%= js_include_tag 'mootools' %><%= js_include_tag 'SimpleTabs' %><%= js_include_tag 'application' %><script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=

<%= Merb.config.gmaps_api_key %>" type="text/javascript"></script>

$ vim config/environments/development.rb

c[:gmaps_api_key] = "foo"

Page 104: Your own (little) gem: building an online business with Ruby

production api key

$ vim app/views/layout/application.html.erb

<%= js_include_tag 'mootools' %><%= js_include_tag 'SimpleTabs' %><%= js_include_tag 'application' %><script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=

<%= Merb.config.gmaps_api_key %>" type="text/javascript"></script>

$ vim config/environments/production.rb

c[:gmaps_api_key] = "bar"

Page 105: Your own (little) gem: building an online business with Ruby

nearest

$ vim public/javascripts/application.js

window.addEvent('domready', function() {

});

Page 106: Your own (little) gem: building an online business with Ruby

dash o’ javascript

$ vim public/javascripts/application.js

window.addEvent('domready', function() {

if (GBrowserIsCompatible()) {var map = new GMap2($("map"));map.enableScrollWheelZoom();map.setCenter(new GLatLng(-33.86336, 151.207151), 12);var geocoder = new GClientGeocoder();

/* geocode top-ten addresses */$$('div#cheapest tr').each( function(element) {

showAddress(map, geocoder, element);});

}

});

Page 107: Your own (little) gem: building an online business with Ruby

custom geocoder

$ vim public/javascripts/application.js

function showAddress(map, geocoder, element) { var name = element.getElements('td.name a').get('html'); var address = element.getChildren('td.address').get('html'); var price = element.getElements('td.price').get('html'); var link = element.getElements('td.name a').get('href'); geocoder.getLatLng(address, function(point) {

if (point) { var marker = new GMarker(point);

marker.bindInfoWindowHtml("<h4>" + name + "</h4>" + ... ); map.addOverlay(marker); } }); }

Page 108: Your own (little) gem: building an online business with Ruby

some stylesheet foo

Page 109: Your own (little) gem: building an online business with Ruby
Page 110: Your own (little) gem: building an online business with Ruby
Page 111: Your own (little) gem: building an online business with Ruby

slices

freezing

param-protection

action-args

Page 112: Your own (little) gem: building an online business with Ruby

operations

Page 113: Your own (little) gem: building an online business with Ruby

monitoring

Page 114: Your own (little) gem: building an online business with Ruby

collectd

Page 115: Your own (little) gem: building an online business with Ruby

lightweight

statistics

collection

daemon

Page 116: Your own (little) gem: building an online business with Ruby

lightweight

statistics

collection

daemon

Page 117: Your own (little) gem: building an online business with Ruby
Page 118: Your own (little) gem: building an online business with Ruby
Page 119: Your own (little) gem: building an online business with Ruby
Page 120: Your own (little) gem: building an online business with Ruby
Page 121: Your own (little) gem: building an online business with Ruby
Page 122: Your own (little) gem: building an online business with Ruby

LoadPlugin cpuLoadPlugin dfLoadPlugin diskLoadPlugin interfaceLoadPlugin loadLoadPlugin memoryLoadPlugin networkLoadPlugin processesLoadPlugin rrdtoolLoadPlugin socketLoadPlugin swapLoadPlugin users

...

Page 123: Your own (little) gem: building an online business with Ruby

<Plugin df> MountPoint "/"</Plugin>

<Plugin interface> Interface "eth0" Interface "eth1"</Plugin>

...

Page 124: Your own (little) gem: building an online business with Ruby

<Plugin rrdtool> DataDir "/var/lib/collectd/rrd" CacheTimeout 180 CacheFlush 7200</Plugin>

<Plugin network> Server "my.monitoring.server.net"# Port 25826</Plugin>

...

Page 125: Your own (little) gem: building an online business with Ruby

<Plugin processes> Process "ruby"# Process "mysqld"</Plugin>

...

Page 126: Your own (little) gem: building an online business with Ruby
Page 127: Your own (little) gem: building an online business with Ruby
Page 128: Your own (little) gem: building an online business with Ruby
Page 129: Your own (little) gem: building an online business with Ruby

eek!

Page 130: Your own (little) gem: building an online business with Ruby

collectd-nagios

Page 131: Your own (little) gem: building an online business with Ruby

$ /usr/bin/collectd-nagios \ -s /var/run/collectd/socket \ -n cpu-0/cpu-idle \ -H my.server.com \ -w 40: -c 10:

0 critical, 1 warning, 0 okay | value=34.000000;;;;

$ /usr/bin/collectd-nagios \ -s /var/run/collectd/socket \ -n df/df-root -H my.server.com \ -d free -c 314572800: -w 524288000:

0 critical, 0 warning, 1 okay |free=924288000.0;;;;

Page 132: Your own (little) gem: building an online business with Ruby

0 good1 bad2 ugly

Page 133: Your own (little) gem: building an online business with Ruby

$ ls /var/lib/collectd/rrd/my.server.comcpu-0 cpu-1 df disk-sda disk-sda1 interface load memory swap users

Page 134: Your own (little) gem: building an online business with Ruby

apache apcups apple sensors

ascent battery cpu

cpufreq csv df

disk dns email

entropy exec filecount

hddtemp interface iptables

ipmi ipvs irqs

libvirt load logfile

mbmon memcached memory

multimeter mysql netlink

network nfs nginx

notify_desktop notify_email ntpd

nut onewire perl

ping postgresql powerdns

processes rrdtool sensors

serial snmp swap

syslog tail tape

tcpconns teamspeak2 thermal

unixsock users uuid

vmem vserver wireless

Page 135: Your own (little) gem: building an online business with Ruby

apache apcups apple sensors

ascent battery cpu

cpufreq csv df

disk dns email

entropy exec filecount

hddtemp interface iptables

ipmi ipvs irqs

libvirt load logfile

mbmon memcached memory

multimeter mysql netlink

network nfs nginx

notify_desktop notify_email ntpd

nut onewire perl

ping postgresql powerdns

processes rrdtool sensors

serial snmp swap

syslog tail tape

tcpconns teamspeak2 thermal

unixsock users uuid

vmem vserver wireless

Page 136: Your own (little) gem: building an online business with Ruby
Page 137: Your own (little) gem: building an online business with Ruby

configuration managementconfiguration management

Page 138: Your own (little) gem: building an online business with Ruby
Page 139: Your own (little) gem: building an online business with Ruby
Page 140: Your own (little) gem: building an online business with Ruby

language => client/server => library

Puppet

Page 141: Your own (little) gem: building an online business with Ruby

manifeststypes classes nodes

Page 142: Your own (little) gem: building an online business with Ruby

manifests => describetypes classes nodes

Page 143: Your own (little) gem: building an online business with Ruby

manifeststypes => manageclasses nodes

Page 144: Your own (little) gem: building an online business with Ruby

package { apache2: ensure => present}

Page 145: Your own (little) gem: building an online business with Ruby

package { apache2: ensure => present}

file { "/etc/apache2/apache2.conf",content => template("/etc/puppet/config/classes/httpd_server/httpd.conf.erb"),mode => 644

}

Page 146: Your own (little) gem: building an online business with Ruby

package { apache2: ensure => present}

file { "/etc/apache2/apache2.conf",content => template("/etc/puppet/config/classes/httpd_server/httpd.conf.erb"),mode => 644

}

service { apache2:ensure => running,subscribe => File["/etc/apache2/apache2.conf"]

}

Page 147: Your own (little) gem: building an online business with Ruby

manifeststypes => manageclasses nodes

Page 148: Your own (little) gem: building an online business with Ruby

manifeststypesclasses => groupnodes

Page 149: Your own (little) gem: building an online business with Ruby

package { apache2: ensure => present }

# ...

Page 150: Your own (little) gem: building an online business with Ruby

class apache2 {

package { apache2: ensure => present }

# ...

}

Page 151: Your own (little) gem: building an online business with Ruby

class passenger inherits apache2 {

package { libapache2-mod-passenger: ensure => present }

# ...

}

Page 152: Your own (little) gem: building an online business with Ruby

define apache2 ($port) {

package { apache2: ensure => present }

# ...

}

Page 153: Your own (little) gem: building an online business with Ruby

manifeststypesclasses => groupnodes

Page 154: Your own (little) gem: building an online business with Ruby

manifeststypes classes nodes => apply

Page 155: Your own (little) gem: building an online business with Ruby

node "srv01.skippy.com" { include passenger}

Page 156: Your own (little) gem: building an online business with Ruby
Page 157: Your own (little) gem: building an online business with Ruby
Page 158: Your own (little) gem: building an online business with Ruby

node "srv01.skippy.com" { include passenger}

Page 159: Your own (little) gem: building an online business with Ruby

node "srv01.skippy.com" { include passenger}

node "server02.skippy.com" { include passenger}

node "server03.skippy.com" { include passenger}

Page 160: Your own (little) gem: building an online business with Ruby

node "merbnode" { include passenger}

node "server01.skippy.com" inherits passenger {}

node "server02.skippy.com" inherits passenger {}

node "server03.skippy.com" { include customisation}

Page 161: Your own (little) gem: building an online business with Ruby

versionable infrastructure

Page 162: Your own (little) gem: building an online business with Ruby

versionable infrastructure

(for free)

Page 163: Your own (little) gem: building an online business with Ruby

$ cd skippy.puppet.lindsay

$ git init

# puppet magic happens

$ git push

Page 164: Your own (little) gem: building an online business with Ruby

# puppetd --test --debug

Page 165: Your own (little) gem: building an online business with Ruby
Page 166: Your own (little) gem: building an online business with Ruby

resources

Page 167: Your own (little) gem: building an online business with Ruby

getting real

seth godin

wiki.merbivore.com

Page 168: Your own (little) gem: building an online business with Ruby

Thank you!(and questions)