
" A backshop or back-shop[citation needed] is a specialized store or workshop found in service industries, such as locomotive and aircraft repair. Most repairs are carried out in small workshops, except where an industrial service is needed. "
Nilton & Sérgio
Thank you !
Mr. Backshop is awesome
Github tdantas / Twitter @thiagochapa
$git tag -ln
V1.0 before rack
V1.1 before rack with handler abstractions
V2.0 rack in action
V2.1 rack with callable 'Method' example
V2.2 DIY sample descriptions
V2.3 sample 1 test RED
V2.4 sample1 test GREEN
V2.5 sample 2 test RED
V2.6 sample 2 test GREEN
V3.0 lets rack like a boss [ rackup]
V3.10 rackup file read by Rack::Builder DSL
V3.2 rackup default options
V3.3 rackup routing
V3.4 rackup reloader without middleware DSL
V3.5 rackup reloader with middleware DSL
V3.6 rackup show exception middleware
V3.7 rack request for better code
V3.8 rack response for better code
V3.9 bieber framework \BAM/
V4.0 middleware response time
V5.0 mimicking sinatra
V5.1 sinatra 'get' done
git clone https://github.com/tdantas/backshop-rack.git
Christian Neukirchen
"Dabbling in my own web framework experiments, I noticed that there is a lot of code duplication among frameworks since they essentially all do the same things. And still, every Ruby web framework developer is writing his own handlers for every webserver he wants to use. Hopefully, the framework users are satisfied with that choice. However, in essence, dealing with HTTP is rather easy. In the end, you get a request and return a response."
Checkout V1.0
'The Pain'
git checkout -b V1.0 tags/V1.0
V1.1 ' The Pain with some abstraction ( Handlers )'
decoupling your app from web server
git checkout -b V1.1 tags/V1.1
Interface for web applications servers to talk with web applications
[Thin, WEBRick, Passenger, Mongrel ] < RACK > [ YOUR APP ]
[WEB SERVER] < RACK > [ RAILS SINATRA PADRINO ]
[WEB SERVER] < RACK > [ APP THAT IMPLEMENTS RACK INTERFACE ]
V2.0 'RACK FOR RESCUE (CLI)'
Using IRB
git checkout -b V2.0 tags/V2.0
V2.1 'RACK FOR RESCUE (CLI)'
Callable bounded methods
git checkout -b V2.1 tags/V2.1
Really thin and super fast
lets benchmark super dummy app
ab -C 50 -n 1000 http://localhost:3000
#=> ~ 2300 req/s
Postrank labs
In practice, Goliath was designed with a "as close to the metal" API for a reason: we run endpoints which need to handle continuous load for one specific service. Hence, a process is responsible for a single route, and more often than not, we would have multiple goliaths load-balanced behind haproxy for redundancy and failover. We implemented the "routing" at haproxy level, which also allowed us to easily manage and scale out the clusters.
"From experience, when you're running larger services ... you *want* the process isolation where each cluster serves a single purpose . As such, we never had a need for an internal router. "
Rack Contract / Interface
Show me your code
From RED to GREEN
git checkout -b V2.3 tags/V2.3
$ tree
.
├── cli-commands.rb
└── samples
├── sample_1.rb
├── sample_2.rb
└── test
├── sample1_test.rb <-- It's your Duty
└── test_helper.rb
Show me your code
From RED to GREEN
git checkout -b V2.5 tags/V2.5
$ tree
.
├── cli-commands.rb
└── samples
├── sample_1.rb
├── sample_2.rb
└── test
├── sample1_test.rb
├── sample2_test.rb <-- It's your Duty
└── test_helper.rb
https://github.com/rack/rack
├── COPYING
├── KNOWN-ISSUES
├── README.rdoc
├── Rakefile
├── SPEC
├── bin
│ └── rackup <-- will build/pipeline your RACK App
...
Coordinating your Rack App
DSL to build your Rack app easily
Agnostic Server
git checkout -b V3.0 tags/V3.0
Route Map
git checkout -b V3.3 tags/V3.3
Reloading your code
git checkout -b V3.4 tags/V3.4
REQ('/ruby') -> WS('mongrel') -> RACK -> RELOADER -> APP
|-----------------------|
app_ruby
git checkout -b V3.5 tags/3.5
git checkout -b V3.7 tags/V3.7
git checkout -b V3.8 tags/V3.8
git checkout -b V3.9 tags/V3.9
#irresponsibleruby
git checkout -b V3.10 tags/V3.10
Disclaimer: Just one abstraction over rack to your code.
git checkout -b V4.0 tags/V4.0
Duty: create your own middleware
Next backshop we will talk about sinatra.
Let's try mimicking sinatra's syntax ( only GET )
Your duty is create all HTTP Verbs syntax
git checkout -b V5.1 tags/V5.1
Thank you