2. self slide
➡ Consultant at ThoughtWorks Australia
➡ Programming languages enthusiast
➡ Developed the Queensland heroku powered
app for the Floods of 2010/2011
➡ Used by thousands
➡ Generated over $38 million in donations
www.leonardoborges.com @leonardo_borges
11. Kensa
Oops.
$ kensa test provision
Testing POST /heroku/resources
Check response [FAIL]
! expected 200, got 404
done.
12. Add-on provisioning
Allocate resources for the app
post '/heroku/resources' do
api_key = Digest::SHA1.hexdigest(Time.now.to_s + rand(12341234).to_s)
user = User.create(api_key: api_key, created_at: Time.now)
result = { :id => user.api_key,
:config => { "LETMEIN_URL" => url("/#{api_key}") }
}
result.to_json
end
13. Kensa
What’s next?
$ kensa test provision
Testing POST /heroku/resources
Check response [PASS]
Check valid JSON [PASS]
Check authentication [FAIL]
! expected 401, got 200
done.
Point is, Kensa will tell you what to do!
14. The consumer app
and the minimalist letmein plugin
def authenticate!
redirect "#{ENV["LETMEIN_URL"]}/authenticate?return_to=#{url('/callback')}"
end
before '/protected/*' do
authenticate! unless session[:user]
end
15. Local end to end test
and little demo!
$ kensa run ruby ../letmein-consumer/app.rb
Testing POST /heroku/resources
Check response [PASS]
Check valid JSON [PASS]
Check authentication [PASS]
...
Testing DELETE /heroku/resources/5f3feb3dfb2bc20f29d14c49f4567599dbb0345f
Check response [PASS]
Check authentication [PASS]
done.
16. All set?
Become an add-on provider
https://addons.heroku.com/provider/signup
17. Then what?
This is how your users will install the add-on
$ heroku addons:add letmein
-----> Adding letmein to letmein-consumer... done, v3 (free)
$ heroku config
LETMEIN_URL => https://letmein.herokuapp.com/e223a873c2e794e93fafaea9016327f1e668be3f
...
...and it’s time for another little demo!