Slide 1

Slide 1 text

Twitter @lgleasain Github lgleasain www.lancegleason.com www.polyglotprogrammincinc.com [email protected] 1 Friday, February 8, 13

Slide 2

Slide 2 text

Introductions 2 Friday, February 8, 13

Slide 3

Slide 3 text

3 Friday, February 8, 13

Slide 4

Slide 4 text

4 Friday, February 8, 13

Slide 5

Slide 5 text

5 Friday, February 8, 13

Slide 6

Slide 6 text

? 6 Friday, February 8, 13

Slide 7

Slide 7 text

7 Friday, February 8, 13

Slide 8

Slide 8 text

7 Friday, February 8, 13

Slide 9

Slide 9 text

7 Friday, February 8, 13

Slide 10

Slide 10 text

7 Friday, February 8, 13

Slide 11

Slide 11 text

7 Friday, February 8, 13

Slide 12

Slide 12 text

7 Friday, February 8, 13

Slide 13

Slide 13 text

8 Friday, February 8, 13

Slide 14

Slide 14 text

9 Friday, February 8, 13

Slide 15

Slide 15 text

10 Friday, February 8, 13

Slide 16

Slide 16 text

11 Friday, February 8, 13

Slide 17

Slide 17 text

12 Friday, February 8, 13

Slide 18

Slide 18 text

Why?? 13 Friday, February 8, 13

Slide 19

Slide 19 text

Heroku 14 Friday, February 8, 13

Slide 20

Slide 20 text

www.honeybadger.com www.jackel.com www.bees.com 15 Friday, February 8, 13

Slide 21

Slide 21 text

www.honeybadger.com => /badgers www.jackel.com => /jaeckels www.bees.com => /bees 16 Friday, February 8, 13

Slide 22

Slide 22 text

17 Friday, February 8, 13

Slide 23

Slide 23 text

18 Friday, February 8, 13

Slide 24

Slide 24 text

• Need to be able to quickly add new domains. 18 Friday, February 8, 13

Slide 25

Slide 25 text

• Need to be able to quickly add new domains. • Need to be able to specify domains dynamically 18 Friday, February 8, 13

Slide 26

Slide 26 text

• Need to be able to quickly add new domains. • Need to be able to specify domains dynamically • Need to be able to have arbitrary nesting 18 Friday, February 8, 13

Slide 27

Slide 27 text

• Need to be able to quickly add new domains. • Need to be able to specify domains dynamically • Need to be able to have arbitrary nesting • Need to use different middlewares 18 Friday, February 8, 13

Slide 28

Slide 28 text

• Need to be able to quickly add new domains. • Need to be able to specify domains dynamically • Need to be able to have arbitrary nesting • Need to use different middlewares • We don’t have budget for devops. 18 Friday, February 8, 13

Slide 29

Slide 29 text

19 Friday, February 8, 13

Slide 30

Slide 30 text

The beast at Tanagra 20 Friday, February 8, 13

Slide 31

Slide 31 text

Rails 21 Friday, February 8, 13

Slide 32

Slide 32 text

22 Friday, February 8, 13

Slide 33

Slide 33 text

• match '/*', to: 'site#proxy' 22 Friday, February 8, 13

Slide 34

Slide 34 text

• match '/*', to: 'site#proxy' • Ugly DB lookup 22 Friday, February 8, 13

Slide 35

Slide 35 text

• match '/*', to: 'site#proxy' • Ugly DB lookup • Rails only. 22 Friday, February 8, 13

Slide 36

Slide 36 text

• match '/*', to: 'site#proxy' • Ugly DB lookup • Rails only. • Will need to have multiple instances. 22 Friday, February 8, 13

Slide 37

Slide 37 text

Rack 23 Friday, February 8, 13

Slide 38

Slide 38 text

24 Friday, February 8, 13

Slide 39

Slide 39 text

• Write Rack Middleware 24 Friday, February 8, 13

Slide 40

Slide 40 text

• Write Rack Middleware • Implement DB Lookup 24 Friday, February 8, 13

Slide 41

Slide 41 text

• Write Rack Middleware • Implement DB Lookup • Re-invent the wheel. 24 Friday, February 8, 13

Slide 42

Slide 42 text

• Write Rack Middleware • Implement DB Lookup • Re-invent the wheel. • Will need multiple instances to use different middleware. 24 Friday, February 8, 13

Slide 43

Slide 43 text

25 Friday, February 8, 13

Slide 44

Slide 44 text

Rack Middlware 26 Friday, February 8, 13

Slide 45

Slide 45 text

class  MyRackMiddleware    def  initialize(appl)        @appl  =  appl    end    def  call(env)        [404,  {},  “Kiteo,    his  eyes  closed”]    end     end 27 Friday, February 8, 13

Slide 46

Slide 46 text

Warning...shameless pet project promotion ahead 28 Friday, February 8, 13

Slide 47

Slide 47 text

Redir https://github.com/springbot/redir 29 Friday, February 8, 13

Slide 48

Slide 48 text

Passbook-IOS https://github.com/frozon/passbook 30 Friday, February 8, 13

Slide 49

Slide 49 text

31 Friday, February 8, 13

Slide 50

Slide 50 text

Circuit 32 Friday, February 8, 13

Slide 51

Slide 51 text

Circuit • Initially filled a need for a custom CMS • Preloads configuration • As fast as * routes • Doesn’t require Rails 33 Friday, February 8, 13

Slide 52

Slide 52 text

34 Friday, February 8, 13

Slide 53

Slide 53 text

#  app/behaviors/render_ok.cru require  './my_middleware' run  proc  {|env|  [200,  {'Content-­‐Type'  =>  'text/plain'},   ['OK']]  } 34 Friday, February 8, 13

Slide 54

Slide 54 text

#  app/behaviors/render_ok.cru require  './my_middleware' run  proc  {|env|  [200,  {'Content-­‐Type'  =>  'text/plain'},   ['OK']]  } #  app/models/site.rb class  Site    include  Circuit::Storage::Sites::MongoidStore::Site    has_one  :root,  :class_name  =>  "Node" end 34 Friday, February 8, 13

Slide 55

Slide 55 text

#  app/behaviors/render_ok.cru require  './my_middleware' run  proc  {|env|  [200,  {'Content-­‐Type'  =>  'text/plain'},   ['OK']]  } #  app/models/site.rb class  Site    include  Circuit::Storage::Sites::MongoidStore::Site    has_one  :root,  :class_name  =>  "Node" end #  app/models/node.rb class  Node    include  Circuit::Storage::Nodes::MongoidStore::Node    belongs_to  :site,  :inverse_of  =>  :root end 34 Friday, February 8, 13

Slide 56

Slide 56 text

35 Friday, February 8, 13

Slide 57

Slide 57 text

$  >  @site  =  Site.new(host:  "example.com",  aliases:   ["www.example.com"]) $  >  @site.save $  =>  true 35 Friday, February 8, 13

Slide 58

Slide 58 text

$  >  @site  =  Site.new(host:  "example.com",  aliases:   ["www.example.com"]) $  >  @site.save $  =>  true $  >  @node  =  Node.new(site:  @site,  slug:  nil,  behavior_klass:   "RenderOk") $  >  @node.save $  =>  true $  >  @node.root?  #  the  nil  slug  and  defined  site  indicates  the   root $  =>  true $  >  @node.behavior $  =>  RenderOk $  >  @node.behavior.class $  =>  Module $  >  @node.behavior.included_modules $  =>  [Circuit::Behavior] 35 Friday, February 8, 13

Slide 59

Slide 59 text

#  app/behaviors/page.cru use  Circuit::Middleware::Rewriter  do  |request|            content_id  =  request.route.last.content.id            ["",  "/contents/#{content_id}"]        end #  config/routes.rb Rails.application.routes.draw  do    resources  :contents end 36 Friday, February 8, 13

Slide 60

Slide 60 text

37 Friday, February 8, 13

Slide 61

Slide 61 text

Circuit Needs you for 38 Friday, February 8, 13

Slide 62

Slide 62 text

Circuit Needs you for • Redis support 38 Friday, February 8, 13

Slide 63

Slide 63 text

Circuit Needs you for • Redis support • Active Record 38 Friday, February 8, 13

Slide 64

Slide 64 text

Circuit Needs you for • Redis support • Active Record • Riak 38 Friday, February 8, 13

Slide 65

Slide 65 text

Circuit Needs you for • Redis support • Active Record • Riak • Goliath 38 Friday, February 8, 13

Slide 66

Slide 66 text

Circuit Needs you for • Redis support • Active Record • Riak • Goliath • Feedback 38 Friday, February 8, 13

Slide 67

Slide 67 text

Twitter @lgleasain Github lgleasain www.lancegleason.com www.polyglotprogrammincinc.com [email protected] 39 Friday, February 8, 13