Go-ing a long way with Rails
@shwetakale13
whoami
@shwetakale13
@joshsoftware
What to expect from this talk!
● Hybrid Application
What to expect from this talk!
● Hybrid Application
● Seamless Integration with any language
What to expect from this talk!
● Hybrid Application
● Seamless Integration with any language
● Progressively Upgrade Code Base
Demo
Gru App
Bootstrap 2 and Rails
4
Minion
App
React, Bootstrap 4
and GoLang
Application Tech stack
● Legacy Codebase
Why not to upgrade?
Why not to upgrade?
● Legacy Codebase
● New features in pipeline
Why not to upgrade?
● Legacy Codebase
● New features in pipeline
● Team’s Proficiency
Why not to upgrade?
● Legacy Codebase
● New features in pipeline
● Team’s Proficiency
● Client’s budget
Rails Application GoLang Application
Approaches
1
Routing at Nginx
1
DRYReuse
Code
Problems with Routing at Nginx
1
Customization in
request
Problems with Routing at Nginx
2
Restclient
2
User
Rails appUser
Minion Details
Restclient
Rails app
2
User
Rails appUser
Minion Details
Minion Details
Restclient
Rails app
GoLang app
GoLang app
2
User
Rails appUser
Minion Details
Minion Details
Sends data
Restclient
Rails app
GoLang app
GoLang app
2
User
Rails appUser
Minion Details
Minion Details
Sends data
Sends data
Restclient
Rails app
GoLang app
GoLang app
Latency
2
Problems with Restclient
Scalability
2
Problems with Restclient
● Foreign Function Interface
● Allows to call functions from binary
3
FFI
Binary on same server
3
Problems with FFI
3
Deployment
Problems with FFI
Scalability
2
Problems with FFI
Load Balance
3
Problems with FFI
4
Web
Server
Rack Rails Application
HTTP Request
HTTP Response
Rack
4
4
4
4
Rack
4
Rack
4
Rack
4
Rack
4
Rack
4
Rack
4
User Request
Rails app
Rack GoLang
app
Rack
4
User Request
Rails app
Rack GoLang
app
Rack
4
User Request
Rails app
Rack GoLang
app
Rewrite
Rack
4
User Request
Rails app
Rack GoLang
app
Rewrite
Response
Rack
Approaches
● Routing based on NGINX
Approaches
● Routing based on NGINX
● RestClient
Approaches
● Routing based on NGINX
● RestClient
● FFI
Approaches
● Routing based on NGINX
● RestClient
● FFI
● RackProxy
Approaches
Problems in other approaches
Problems in other approaches
● Reuse existing authentication mechanism
Problems in other approaches
● Reuse existing authentication mechanism
● Latency
Problems in other approaches
● Reuse existing authentication mechanism
● Latency
● Scalability
Problems in other approaches
● Reuse existing authentication mechanism
● Latency
● Scalability
● Deployment
Problems in other approaches
● Reuse existing authentication mechanism
● Latency
● Scalability
● Deployment
● Load balancing
Problems in other approaches
● Reuse existing authentication mechanism
● Latency
● Scalability
● Deployment
● Load balancing
Approaches
● Routing based on NGINX
● RestClient
● FFI
● RackProxy
react-rails gem
Where Rails stores session?
● Hybrid Application
Applications
● Hybrid Application
● Seamless Integration with any language
Applications
● Hybrid Application
● Seamless Integration with any language
● Progressively Upgrade Code Base
Applications
Applications on Production?
● https://github.com/joshsoftware/intranet
● https://github.com/joshsoftware/function_junction
● https://github.com/joshsoftware/function_junction_ui
Github Link
I Ruby
Resources
● https://github.com/ncr/rack-proxy
● https://blog.joshsoftware.com/2019/03/28/golang-with-rails/
● Rack Proxy: https://github.com/joshsoftware/intranet
● Blog: https://github.com/joshsoftware/function_junction
● https://github.com/joshsoftware/function_junction_ui
Thank You!
@shwetakale13
@joshsoftware

Ruby conf