SlideShare a Scribd company logo
1 of 34
Download to read offline
microservic’ing with sinatra
@linkedcare
Joaquim Adráz
and
mrbessa
joaquimadraz & croudcare
joaquim.adraz@linkedcare.com@
prolinkedcare & mylinkedcare
medic & patient
prolinkedcare app
• Electronic Prescription
• Video Consultation
• Electronic Health
Record
• Schedule
mylinkedcare app
• Physical Activity
Tracking
• Vital and Biometric Data
• Medication Alarms
• Appointment
Scheduling
Medic & Patient Link
• Shared Electronic Heath Record
• Automatic Medication Alarms on prescriptions
• Video Appointments between apps
Pro My
Schedule
Bio &
Vital
Sensors
Medication
Prescription
Report
Analytics
Reference
Data
UID
Linkedcare Services
Service Oriented Design
Behind linkedcare’s micro services
!
“The goal of SOD is to split up the parts of an
application into components that can be iterated
on, improved and fixed…”
Service Oriented Design with ROR Book by Paul Dix
Topologies
Service Oriented Design
Behind linkedcare’s micro services
Service Oriented Design
Behind linkedcare’s micro services
Client
Schedule
Bio &
Vital
SensorsUID
Pro
• Current topology;
• Micro services control well
defined and secure;
• Best for monolithic to
service oriented design;
• Single point of failure;
• Latency.
Service Oriented Design
Behind linkedcare’s micro services
!
!
Schedule
Bio &
Vital
SensorsUID
Client
• Future topology;
Pro
• Client controls micro
services;
• “There’s no more” a single
point of failure;
• Latency;
• Exposed micro services.
Service Oriented Design
Behind linkedcare’s micro services
!
3 rules to build a micro service @linkedcare
Service Oriented Design
Behind linkedcare’s micro services
!
• Small services with small tasks;
• Well defined boundaries;
• Business logic for who needs it;
Service Oriented Design
Behind linkedcare’s micro services
!
• Use well known standards and conventions;
• RESTful APIs:
• Standard HTTP methods;
• One does not simply use POST /v1/events/1 to delete an event;
• Use HTTP Status Codes, and everything will be 200.
Service Oriented Design
Behind linkedcare’s micro services
!
• Use only the necessary tools for the job.
• We want MICRO Services;
• Lightweight and flexible systems;
• Sinatra is one of them..
Service Oriented Design
Behind linkedcare’s micro services
!
• Isolation;
The goods
• Surviving lost of functionality;
• Scalability.
• …
Ruby doesn’t scale, but services do!
Service Oriented Design
Behind linkedcare’s micro services
!
• Distributed system complexity;
The “not so” goods
• Dev Ops overhead;
• Synchronization;
• …
!
!
Sinatra rb
"Sinatra is a DSL for quickly creating web
applications in Ruby with minimal effort"
The right tool(s) for the job*
Behind linkedcare’s micro services
1. gem install ‘sinatra’
Sinatra rb
Behind linkedcare’s micro services
3. ruby app.rb
require ‘sinatra’
!
get ‘/’ do
“Hello!”
end
2.
Sinatra rb
Behind linkedcare’s micro services
[2014-05-15 21:00:00] INFO WEBrick 1.3.1
[2014-05-15 21:00:00] INFO ruby 1.9.3 (2013-06-27) [x86_64-darwin12.5.0]
== Sinatra/1.4.4 has taken the stage on 4567 for development with backup from WEBrick
[2014-05-15 21:00:00] INFO WEBrick::HTTPServer#start: pid=5343 port=4567
Sinatra rb
Behind linkedcare’s micro services
• Sinatra is written over 2000 lines of code, it’s 1%
of Rails;
• Fast, flexible and light… like our micro services
should be;
• Active Record, Rake tasks, Rspec, Bundler…
it’s all available.
The goods
Sinatra rb
Behind linkedcare’s micro services
• It’s pure Ruby, all Rails magic its gone;
• Structuring an app can bring some pain;
• There are some gems that only work well with
Rails.
The “not so” goods
For Rails only devs
Inside a Sinatra App
Behind linkedcare’s micro services
erb :index # renders ./views/index.erb
erb :"home/index" # renders ./views/home/index.erb
VIEWS
Inside a Sinatra App
Behind linkedcare’s micro services
ROUTING
get '/hello/:name' do
# matches "GET /hello/foo" and "GET /hello/bar"
# params[:name] is 'foo' or 'bar'
"Hello #{params[:name]}!"!
end
post '/say/*/to/*' do
# matches post /say/hello/to/world
params[:splat] # => ["hello", "world"]
end
Inside a Sinatra App
Behind linkedcare’s micro services
ROUTING
delete '/event/:id' do
# matches "DELETE /event/1"
end
put '/event/:id' do
# matches "PUT /event/1"
end
Inside a Sinatra App
Behind linkedcare’s micro services
HELPERS
require 'sinatra'
!
get '/:color' do
"<b>#{color_world(params[:color])} world!</b>"
end
!
helpers do
def color_world(red)
red == "red" ? "red" : "yellow"
end
end
Inside a Sinatra App
Behind linkedcare’s micro services
APP STRUCTURE
Classic Style vs Modular Style
Inside a Sinatra App
Behind linkedcare’s micro services
CLASSIC | APP STRUCTURE
• require ‘sinatra’
• Uses the TOP Level DSL included when
required;
!
Inside a Sinatra App
Behind linkedcare’s micro services
MODULAR | APP STRUCTURE
• require ‘sinatra/base’
• DSL it’s not included in Object.
• class MyApp < Sinatra::Base
• DSL available inside MyApp object.
!
Sinatra rb
Behind linkedcare’s micro services
DEMO?
Microservic’ing and Sinatra
@linkedcare
The nice conclusion
Right now, it’s the best solution for our project!
Microservic’ing and Sinatra
@linkedcare
Some tips
LinkedBus => Ruby RabbitMQ Subscriber
https://github.com/tdantas/linkedbus
SmoothOperator => Lightweight and flexible alternative to ActiveResource,
https://github.com/goncalvesjoao/smooth_operator
UseCasing => Responsability Centric Design with use cases
https://github.com/tdantas/usecasing
Backshops linkedcare
JOBS linkedcare
http://linkedcare.com/jobs.html
microservic’ing with sinatra
@linkedcare
Joaquim Adráz
mrbessa
joaquimadraz & croudcare
joaquim.adraz@linkedcare.com@
and

More Related Content

Viewers also liked

Swing when you're winning - an introduction to Ruby and Sinatra
Swing when you're winning - an introduction to Ruby and SinatraSwing when you're winning - an introduction to Ruby and Sinatra
Swing when you're winning - an introduction to Ruby and SinatraMatt Gifford
 
Simple Web Services With Sinatra and Heroku
Simple Web Services With Sinatra and HerokuSimple Web Services With Sinatra and Heroku
Simple Web Services With Sinatra and HerokuOisin Hurley
 
10mentalbarrierstoletgoof 12861929353381 Phpapp01
10mentalbarrierstoletgoof 12861929353381 Phpapp0110mentalbarrierstoletgoof 12861929353381 Phpapp01
10mentalbarrierstoletgoof 12861929353381 Phpapp01ana_ls
 
Ruby and Sinatra's Shotgun Wedding
Ruby and Sinatra's Shotgun WeddingRuby and Sinatra's Shotgun Wedding
Ruby and Sinatra's Shotgun WeddingJamin Guy
 
モジュール開発におけるぼくの試行錯誤
モジュール開発におけるぼくの試行錯誤モジュール開発におけるぼくの試行錯誤
モジュール開発におけるぼくの試行錯誤karupanerura
 
Message Queues in Ruby - An Overview
Message Queues in Ruby - An OverviewMessage Queues in Ruby - An Overview
Message Queues in Ruby - An OverviewPradeep Elankumaran
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientAdam Wiggins
 

Viewers also liked (7)

Swing when you're winning - an introduction to Ruby and Sinatra
Swing when you're winning - an introduction to Ruby and SinatraSwing when you're winning - an introduction to Ruby and Sinatra
Swing when you're winning - an introduction to Ruby and Sinatra
 
Simple Web Services With Sinatra and Heroku
Simple Web Services With Sinatra and HerokuSimple Web Services With Sinatra and Heroku
Simple Web Services With Sinatra and Heroku
 
10mentalbarrierstoletgoof 12861929353381 Phpapp01
10mentalbarrierstoletgoof 12861929353381 Phpapp0110mentalbarrierstoletgoof 12861929353381 Phpapp01
10mentalbarrierstoletgoof 12861929353381 Phpapp01
 
Ruby and Sinatra's Shotgun Wedding
Ruby and Sinatra's Shotgun WeddingRuby and Sinatra's Shotgun Wedding
Ruby and Sinatra's Shotgun Wedding
 
モジュール開発におけるぼくの試行錯誤
モジュール開発におけるぼくの試行錯誤モジュール開発におけるぼくの試行錯誤
モジュール開発におけるぼくの試行錯誤
 
Message Queues in Ruby - An Overview
Message Queues in Ruby - An OverviewMessage Queues in Ruby - An Overview
Message Queues in Ruby - An Overview
 
Lightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClientLightweight Webservices with Sinatra and RestClient
Lightweight Webservices with Sinatra and RestClient
 

Similar to Coimbra rb | microservic'ing and sinatra

Monoliths, Myths, and Microservices - CfgMgmtCamp
Monoliths, Myths, and Microservices - CfgMgmtCampMonoliths, Myths, and Microservices - CfgMgmtCamp
Monoliths, Myths, and Microservices - CfgMgmtCampMichael Ducy
 
AngularJSTO presentation
AngularJSTO presentationAngularJSTO presentation
AngularJSTO presentationAlan Hietala
 
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3Lari Hotari
 
What serverless means for enterprise apps
What serverless means for enterprise appsWhat serverless means for enterprise apps
What serverless means for enterprise appsSumit Sarkar
 
Making sense of microservices, service mesh, and serverless
Making sense of microservices, service mesh, and serverlessMaking sense of microservices, service mesh, and serverless
Making sense of microservices, service mesh, and serverlessChristian Posta
 
Microservices Without the Hassle
Microservices Without the HassleMicroservices Without the Hassle
Microservices Without the HassleFintan Ryan
 
Microservices Without The Hassle
Microservices Without The HassleMicroservices Without The Hassle
Microservices Without The HassleWeaveworks
 
#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?Tammy Bednar
 
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan VujaklijaInfinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan VujaklijaInfinum
 
From Monoliths to Services: Paying Your Technical Debt
From Monoliths to Services: Paying Your Technical DebtFrom Monoliths to Services: Paying Your Technical Debt
From Monoliths to Services: Paying Your Technical DebtTechWell
 
e-Suap Inista 2014 (International Symposium on INnovation in Intelligent SysT...
e-Suap Inista 2014 (International Symposium on INnovation in Intelligent SysT...e-Suap Inista 2014 (International Symposium on INnovation in Intelligent SysT...
e-Suap Inista 2014 (International Symposium on INnovation in Intelligent SysT...Sabino Labarile
 
Evolution of Microservices - Craft Conference
Evolution of Microservices - Craft ConferenceEvolution of Microservices - Craft Conference
Evolution of Microservices - Craft ConferenceAdrian Cockcroft
 
Design - Start Your API Journey Today
Design - Start Your API Journey TodayDesign - Start Your API Journey Today
Design - Start Your API Journey TodayLaurenWendler
 
Go Digital Faster with Wakanda Mobile & Web App Factory
Go Digital Faster with Wakanda Mobile & Web App FactoryGo Digital Faster with Wakanda Mobile & Web App Factory
Go Digital Faster with Wakanda Mobile & Web App FactoryCyril Reinhard
 
Scaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsScaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsRandy Shoup
 
Evolving your Architecture to MicroServices
Evolving your Architecture to MicroServicesEvolving your Architecture to MicroServices
Evolving your Architecture to MicroServicesHector Tapia
 
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...MongoDB
 

Similar to Coimbra rb | microservic'ing and sinatra (20)

Monoliths, Myths, and Microservices - CfgMgmtCamp
Monoliths, Myths, and Microservices - CfgMgmtCampMonoliths, Myths, and Microservices - CfgMgmtCamp
Monoliths, Myths, and Microservices - CfgMgmtCamp
 
AngularJSTO presentation
AngularJSTO presentationAngularJSTO presentation
AngularJSTO presentation
 
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
GGX 2014 Lari Hotari Modular Monoliths with Spring Boot and Grails 3
 
What serverless means for enterprise apps
What serverless means for enterprise appsWhat serverless means for enterprise apps
What serverless means for enterprise apps
 
Microevent
MicroeventMicroevent
Microevent
 
Making sense of microservices, service mesh, and serverless
Making sense of microservices, service mesh, and serverlessMaking sense of microservices, service mesh, and serverless
Making sense of microservices, service mesh, and serverless
 
Microservices Without the Hassle
Microservices Without the HassleMicroservices Without the Hassle
Microservices Without the Hassle
 
Microservices Without The Hassle
Microservices Without The HassleMicroservices Without The Hassle
Microservices Without The Hassle
 
#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?
 
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan VujaklijaInfinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
Infinum iOS Talks #2 - VIPER for everybody by Damjan Vujaklija
 
From Monoliths to Services: Paying Your Technical Debt
From Monoliths to Services: Paying Your Technical DebtFrom Monoliths to Services: Paying Your Technical Debt
From Monoliths to Services: Paying Your Technical Debt
 
e-Suap Inista 2014 (International Symposium on INnovation in Intelligent SysT...
e-Suap Inista 2014 (International Symposium on INnovation in Intelligent SysT...e-Suap Inista 2014 (International Symposium on INnovation in Intelligent SysT...
e-Suap Inista 2014 (International Symposium on INnovation in Intelligent SysT...
 
E suap - INISTA 2014
E suap - INISTA 2014E suap - INISTA 2014
E suap - INISTA 2014
 
Evolution of Microservices - Craft Conference
Evolution of Microservices - Craft ConferenceEvolution of Microservices - Craft Conference
Evolution of Microservices - Craft Conference
 
Design - Start Your API Journey Today
Design - Start Your API Journey TodayDesign - Start Your API Journey Today
Design - Start Your API Journey Today
 
Go Digital Faster with Wakanda Mobile & Web App Factory
Go Digital Faster with Wakanda Mobile & Web App FactoryGo Digital Faster with Wakanda Mobile & Web App Factory
Go Digital Faster with Wakanda Mobile & Web App Factory
 
Accenture Java meetup
Accenture Java meetupAccenture Java meetup
Accenture Java meetup
 
Scaling Your Architecture with Services and Events
Scaling Your Architecture with Services and EventsScaling Your Architecture with Services and Events
Scaling Your Architecture with Services and Events
 
Evolving your Architecture to MicroServices
Evolving your Architecture to MicroServicesEvolving your Architecture to MicroServices
Evolving your Architecture to MicroServices
 
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
 

Recently uploaded

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 

Recently uploaded (20)

#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 

Coimbra rb | microservic'ing and sinatra

  • 1. microservic’ing with sinatra @linkedcare Joaquim Adráz and mrbessa joaquimadraz & croudcare joaquim.adraz@linkedcare.com@
  • 3. prolinkedcare app • Electronic Prescription • Video Consultation • Electronic Health Record • Schedule
  • 4. mylinkedcare app • Physical Activity Tracking • Vital and Biometric Data • Medication Alarms • Appointment Scheduling
  • 5. Medic & Patient Link • Shared Electronic Heath Record • Automatic Medication Alarms on prescriptions • Video Appointments between apps
  • 7. Service Oriented Design Behind linkedcare’s micro services ! “The goal of SOD is to split up the parts of an application into components that can be iterated on, improved and fixed…” Service Oriented Design with ROR Book by Paul Dix
  • 8. Topologies Service Oriented Design Behind linkedcare’s micro services
  • 9. Service Oriented Design Behind linkedcare’s micro services Client Schedule Bio & Vital SensorsUID Pro • Current topology; • Micro services control well defined and secure; • Best for monolithic to service oriented design; • Single point of failure; • Latency.
  • 10. Service Oriented Design Behind linkedcare’s micro services ! ! Schedule Bio & Vital SensorsUID Client • Future topology; Pro • Client controls micro services; • “There’s no more” a single point of failure; • Latency; • Exposed micro services.
  • 11. Service Oriented Design Behind linkedcare’s micro services ! 3 rules to build a micro service @linkedcare
  • 12. Service Oriented Design Behind linkedcare’s micro services ! • Small services with small tasks; • Well defined boundaries; • Business logic for who needs it;
  • 13. Service Oriented Design Behind linkedcare’s micro services ! • Use well known standards and conventions; • RESTful APIs: • Standard HTTP methods; • One does not simply use POST /v1/events/1 to delete an event; • Use HTTP Status Codes, and everything will be 200.
  • 14. Service Oriented Design Behind linkedcare’s micro services ! • Use only the necessary tools for the job. • We want MICRO Services; • Lightweight and flexible systems; • Sinatra is one of them..
  • 15. Service Oriented Design Behind linkedcare’s micro services ! • Isolation; The goods • Surviving lost of functionality; • Scalability. • … Ruby doesn’t scale, but services do!
  • 16. Service Oriented Design Behind linkedcare’s micro services ! • Distributed system complexity; The “not so” goods • Dev Ops overhead; • Synchronization; • …
  • 17. ! ! Sinatra rb "Sinatra is a DSL for quickly creating web applications in Ruby with minimal effort" The right tool(s) for the job* Behind linkedcare’s micro services
  • 18. 1. gem install ‘sinatra’ Sinatra rb Behind linkedcare’s micro services 3. ruby app.rb require ‘sinatra’ ! get ‘/’ do “Hello!” end 2.
  • 19. Sinatra rb Behind linkedcare’s micro services [2014-05-15 21:00:00] INFO WEBrick 1.3.1 [2014-05-15 21:00:00] INFO ruby 1.9.3 (2013-06-27) [x86_64-darwin12.5.0] == Sinatra/1.4.4 has taken the stage on 4567 for development with backup from WEBrick [2014-05-15 21:00:00] INFO WEBrick::HTTPServer#start: pid=5343 port=4567
  • 20. Sinatra rb Behind linkedcare’s micro services • Sinatra is written over 2000 lines of code, it’s 1% of Rails; • Fast, flexible and light… like our micro services should be; • Active Record, Rake tasks, Rspec, Bundler… it’s all available. The goods
  • 21. Sinatra rb Behind linkedcare’s micro services • It’s pure Ruby, all Rails magic its gone; • Structuring an app can bring some pain; • There are some gems that only work well with Rails. The “not so” goods For Rails only devs
  • 22. Inside a Sinatra App Behind linkedcare’s micro services erb :index # renders ./views/index.erb erb :"home/index" # renders ./views/home/index.erb VIEWS
  • 23. Inside a Sinatra App Behind linkedcare’s micro services ROUTING get '/hello/:name' do # matches "GET /hello/foo" and "GET /hello/bar" # params[:name] is 'foo' or 'bar' "Hello #{params[:name]}!"! end post '/say/*/to/*' do # matches post /say/hello/to/world params[:splat] # => ["hello", "world"] end
  • 24. Inside a Sinatra App Behind linkedcare’s micro services ROUTING delete '/event/:id' do # matches "DELETE /event/1" end put '/event/:id' do # matches "PUT /event/1" end
  • 25. Inside a Sinatra App Behind linkedcare’s micro services HELPERS require 'sinatra' ! get '/:color' do "<b>#{color_world(params[:color])} world!</b>" end ! helpers do def color_world(red) red == "red" ? "red" : "yellow" end end
  • 26. Inside a Sinatra App Behind linkedcare’s micro services APP STRUCTURE Classic Style vs Modular Style
  • 27. Inside a Sinatra App Behind linkedcare’s micro services CLASSIC | APP STRUCTURE • require ‘sinatra’ • Uses the TOP Level DSL included when required; !
  • 28. Inside a Sinatra App Behind linkedcare’s micro services MODULAR | APP STRUCTURE • require ‘sinatra/base’ • DSL it’s not included in Object. • class MyApp < Sinatra::Base • DSL available inside MyApp object. !
  • 29. Sinatra rb Behind linkedcare’s micro services DEMO?
  • 30. Microservic’ing and Sinatra @linkedcare The nice conclusion Right now, it’s the best solution for our project!
  • 31. Microservic’ing and Sinatra @linkedcare Some tips LinkedBus => Ruby RabbitMQ Subscriber https://github.com/tdantas/linkedbus SmoothOperator => Lightweight and flexible alternative to ActiveResource, https://github.com/goncalvesjoao/smooth_operator UseCasing => Responsability Centric Design with use cases https://github.com/tdantas/usecasing
  • 34. microservic’ing with sinatra @linkedcare Joaquim Adráz mrbessa joaquimadraz & croudcare joaquim.adraz@linkedcare.com@ and