27
Migrating from Monolithic Rails by Danielius Visockas Twitter: @DVisockas v1

Migrating from monolithic rails

Embed Size (px)

Citation preview

Page 1: Migrating from monolithic rails

Migrating from Monolithic Rails

by Danielius Visockas

Twitter: @DVisockas

v1

Page 2: Migrating from monolithic rails

Let’s look at Rails

Page 3: Migrating from monolithic rails
Page 4: Migrating from monolithic rails

Desktop only

Extractions of patterns

History of Rails

Page 5: Migrating from monolithic rails

Let’s fast forward 10 years

Page 6: Migrating from monolithic rails

Why Rails is nice:

● Routing

● Models (!)

● Persistence (migrations, schema)

● Sessions, cookies management

● Mailers

● Other stuff (rake tasks, assets pipeline, etc)

Page 7: Migrating from monolithic rails
Page 8: Migrating from monolithic rails

Story actually starts here

Page 9: Migrating from monolithic rails

We had 2 apps

Main Rails app and Sinatra for the API

Page 10: Migrating from monolithic rails

In the main app we used plain Rails

views and jQuery for the magic

Page 11: Migrating from monolithic rails

Frontend magic

548 view files 84 javascript files

some files that would make sense

Page 12: Migrating from monolithic rails

Late extraction costs more than early abstraction

Especially in frontend

Page 13: Migrating from monolithic rails

&&

Your friends

Page 14: Migrating from monolithic rails

Next thing: build an API

That’s where Ruby is the best tool

Page 15: Migrating from monolithic rails

Ruby API building tools

Page 16: Migrating from monolithic rails
Page 17: Migrating from monolithic rails

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

Page 18: Migrating from monolithic rails

Other cool features of moving to

Grape

● Support from the community

● You already have models

● Documentation

● Easy integration into Rails

Page 19: Migrating from monolithic 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

Page 20: Migrating from monolithic rails

Try it after 2 days

Page 21: Migrating from monolithic rails

Thank you!

Please ask questions

Page 22: Migrating from monolithic rails

Vilnius Ruby community

Page 23: Migrating from monolithic rails

Speakers

THANK YOU

Our stage is OPEN & everyone is welcomed to share

Next meetup: April 9th

Page 24: Migrating from monolithic rails

March 21stKonstitucijos pr. 20AFree!*

www.rubyconf.lt

*- registration required

Page 25: Migrating from monolithic rails

Ruby +

Page 26: Migrating from monolithic rails

Sponsors

Page 27: Migrating from monolithic rails

Afterparty!

Šnekutis, Šv. Mikalojaus g.15