Migrating from Monolithic Rails
by Danielius Visockas
Twitter: @DVisockas
v1
Let’s look at Rails
Desktop only
Extractions of patterns
History of Rails
Let’s fast forward 10 years
Why Rails is nice:
● Routing
● Models (!)
● Persistence (migrations, schema)
● Sessions, cookies management
● Mailers
● Other stuff (rake tasks, assets pipeline, etc)
Story actually starts here
We had 2 apps
Main Rails app and Sinatra for the API
In the main app we used plain Rails
views and jQuery for the magic
Frontend magic
548 view files 84 javascript files
some files that would make sense
Late extraction costs more than early abstraction
Especially in frontend
&&
Your friends
Next thing: build an API
That’s where Ruby is the best tool
Ruby API building tools
An opinionated micro-framework for creating REST-like APIs in Ruby.http://intridea.github.io/grape
● Specifically for building API’s
● Minimal
● Fast (Grape: 2227 req/sec vs RailsAPI: 1111.42 req/sec) on 1.9.3
Other cool features of moving to
Grape
● Support from the community
● You already have models
● Documentation
● Easy integration into Rails
From evolution to revolution
● Small steps
● Reduced server load
● Easier to add other (micro-)services
● Easier scaling
● You can concentrate on one side of the app
Try it after 2 days
Thank you!
Please ask questions
Vilnius Ruby community
Speakers
THANK YOU
Our stage is OPEN & everyone is welcomed to share
Next meetup: April 9th
March 21stKonstitucijos pr. 20AFree!*
www.rubyconf.lt
*- registration required
Ruby +
Sponsors
Afterparty!
Šnekutis, Šv. Mikalojaus g.15