Build a Cloud in Thirteen Years
Infrastructure Control Planes in Ruby, 2011 to 2024
Hello
Daniel Farina, a founder of Ubicloud
- A new IaaS, compare AWS, Azure, GCP
- An Open Source Ruby Program
- Focused on core products
- A better value: a 10-30% the price
What is it?
Practice Makes Perfect...ish
Acknowledgements Will Leinweber and Craig Kerstiens of {Heroku,Citus,Crunchy} without whom this would have been impossible.
...and to Peter van Hardenberg, who stands at the beginning.
The Talk
- Roda HTTP Routing
- Why Ruby?
Roda
"Routing Tree" Framework
The "tree" takes the form of nested blocks.
Elegant "before" filters
Matchers accept literal values and simple data types.
class App < Roda
route do |r|
# Matches "/items/<whatever>"
r.on "items" do
# Matches /items/[0-9]+$
r.is Integer do |item_id|
@item = Item[item_id]
# e.g. GET /items/123
r.get { "Rendering item: #{@item}" }
# e.g. DELETE /items/123
r.delete { @item.destroy }
end
end
# Matches /foo, /foo/bar, /pear/apple/peach
r.on String do |a_prefix|
r.get { "You asked for #{a_prefix}" }
end
end
end
class CloverWeb < Roda
# [...Lots of plugin setup...]
route do |r|
r.public
r.assets
r.on "webhook" do
r.hash_branches(:webhook_prefix)
end
check_csrf!
@current_user = Account[rodauth.session_value]
r.rodauth
rodauth.load_memory
rodauth.check_active_session
r.root do
r.redirect rodauth.login_route
end
rodauth.require_authentication
r.hash_branches("")
end
endUbicloud "Web" Top Level
class CloverWeb
hash_branch("project") do |r|
@serializer = Serializers::Web::Project
r.get true do
@projects = serialize(@current_user.projects.filter(&:visible))
view "project/index"
end
r.post true do
project = @current_user.create_project_with_default_policy(r.params["name"], provider: r.params["provider"])
r.redirect project.path
end"Leaf" Level
- still "
CloverWeb" (one class, many files) -
hash_branchjumps to the matching block - runs more familiar Roda code
./clover_web.rb:class CloverWeb < Roda
./routes/web/project.rb:class CloverWeb
./routes/web/github.rb:class CloverWeb
./routes/web/project/github.rb:class CloverWeb
./routes/web/project/user.rb:class CloverWeb
./routes/web/project/vm.rb:class CloverWeb
./routes/web/project/billing.rb:class CloverWeb
./routes/web/project/policy.rb:class CloverWeb
./routes/web/project/private_subnet.rb:class CloverWeb
./routes/web/project/location/vm.rb:class CloverWeb
./routes/web/project/location/private_subnet.rb:class CloverWeb
./routes/web/project/location/postgres.rb:class CloverWeb
./routes/web/project/postgres.rb:class CloverWeb
./routes/web/project/location.rb:class CloverWeb
./routes/web/account.rb:class CloverWeb
./routes/web/webhook/github.rb:class CloverWeb
How many reopenings?
Lots is okay

Why do things that way?
- Performance
- Reload/Development Performance
- It's actually totally fine?

Why Ruby?
2011
Ruby 🔥
Sequel 💧
Sinatra 💧
Postgres 💧
2024
Ruby 💧
Sequel 💧
Postgres 🔥
Roda ❄️
Rodauth ❄️
Perspective outside Rails
Legend: "normalness" in descending order 🔥💧❄️
Reinterpreting Ruby
Common Interpretations
inspired, artistic, beautiful
"productive"
"developer happiness"
slow
wild or unprincipled
hard to maintain
good for prototyping, but
Reinterpretation
Stable
Rigorous
Prudent
Restrained
Economical
...slowish
Language Stability and Restraint
- 2011: Start writing Ruby: Sequel, Sinatra
- 2013: Ruby 2.0 adds keyword arguments
- 2016: Ruby 3x3 initiative begins
- 2021: YJIT in Ruby
Stability in Key Libraries
2007: Sequel
2014: Roda
2015: Rodauth
Jeremy Evans
Maintains all of:

Not only an acknowledgement.
The three programs are cohesive.
Roda: request routing
Rodauth: authentication
Sequel: database access
Jeremy's Humility
Blink and you'll miss something important in his talks.
...it gives me a sense of accomplishment to be able to fix bugs in Ruby that have been known but unfixed for many years. That's a situation that doesn't happen in my other open source projects.
—From one tiny corner of an interview
Fact Check: TRUE

Monthly(?!) Releases



Plugins

Check out
roda-sequel-stack
Rigorous Testing
100% branch coverage: totally reasonable
can be done with rspec or minitest.
Are tests a crutch for lack of
static typing?
no...
if you seek the highest standards of a rigorous program
Is static typing interesting?
Probably, for cross referencing
VSCode & LSP are prime movers here
Improve economy of elimination of simple defects
Rigor & Economy
in Operations
REPL is Key

Ad hoc Reporting in REPL

Ruby is much better at this than similar languages.
Why?
Blocks.
The End/Conclusion
Build a Cloud in Thirteen Years
By fdrfdr
Build a Cloud in Thirteen Years
- 139