Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Complex Made Simple                       Sleep Better With TorqueBox                                       Lance Ball    ...
Complex Made Simple                       Sleep Better With TorqueBox                                       Lance Ball    ...
Who am I?                  Lance Ball                  ๏    Senior Software Engineer @ Red Hat                  ๏    Torqu...
Scenario                  Youve got a Ruby                  application to                  deploy, for                  p...
Ruby App                         Sinatra      Rails                               Rack                         Passenger/T...
But...                  The app you deploy                  today will grow in the                  future, if you’re     ...
Eventual ComplexityFriday, April 27, 12
Ruby App                                    Sinatra      Rails                                          Rack              ...
Ruby App                                    Sinatra      Rails                                          Rack              ...
Ruby App                                    Sinatra      Rails                                          Rack              ...
Deploy ContinuumFriday, April 27, 12
Deploy ContinuumFriday, April 27, 12
Deploy ContinuumFriday, April 27, 12
What is TorqueBox?                  TorqueBox is a                  Ruby Application Server.                  Based on JRu...
TorqueBox AS            Sinatra           Rails                       Rack            Tasks   Procs            Jobs       ...
Roll your own                  ๏ Install OS                  ๏ Install packages                  ๏ Configure everything   ...
Roll your own                  ๏                       Apache httpd                  ๏                       Load balancer...
Or outsource                          some...Friday, April 27, 12
Roll your own >>                  ๏                       Apache httpd                  ๏                       Load balan...
Use a Paas                  Outsource                  everything but                  your app.Friday, April 27, 12
Heroku                  ๏                       Apache httpd Heroku                  ๏                       Load balancer...
TorqueBox                  ๏                       Apache httpd                  ๏                       Load balancer JBo...
Case Study!Friday, April 27, 12
Appalachian Sustainable                   Agriculture Project (ASAP)Friday, April 27, 12
Application Needs                  ๏ Rails 2.x web app                  ๏ Caching                  ๏ Background tasks     ...
As deployed on HerokuFriday, April 27, 12
Migration Motivation                  In this particular case, client feels                  it could save money, and have...
Install           $ rvm install jruby-1.6.7           $ rvm use jruby-1.6.7           $ gem install torquebox-serverFriday...
Templatize           $ torquebox rails myappFriday, April 27, 12
torquebox.rb template                  ๏    torquebox-* and activerecord-jdbc-                       adapter gems         ...
“Porting” the                        applicationFriday, April 27, 12
Background                          JobsFriday, April 27, 12
Delayed::Job                  App uses                  Delayed::Job                        Replace with                  ...
Delayed Job                   controller.rb         def create           @export = ExcelExport.create(...)           job =...
Delayed Job                   controller.rb         def create           @export = ExcelExport.create(...)           job =...
Delayed Job                   excel_export_job.rb         class ExcelExportJob < Struct.new(:excel_export_id)           de...
Delayed Job                   excel_export.rb         class ExcelExport < ActiveRecord::Base           def generate_report...
Delayed Job                  Mayhap you need to                  run a worker, also...Friday, April 27, 12
Delayed::Job                       Exporter < AR::Base   Database                       ExportJob < Struct     WorkerFrida...
Thats pretty explicit                  TorqueBox allows you                  to very easily run                  methods  ...
Backgroundable                   excel_export.rb         class ExcelExport < ActiveRecord::Base           always_backgroun...
Backgroundable                   excel_export.rb         class ExcelExport < ActiveRecord::Base           always_backgroun...
Backgroundable                   export_controller.rb         def create           @export = ExcelExport.create(...)      ...
Backgroundable                   export_controller.rb         def create           @export = ExcelExport.create(...)      ...
Backgroundable                   excel_export_job.rb         $ git rm excel_export_job.rb                                 ...
Backgroundable                       Implicit!magic!                                  Queue           Processor           ...
CachingFriday, April 27, 12
Caching                  ๏    template.rb does the work                       ๏ Web sessions                       ๏ Fragm...
No more                       memcached!Friday, April 27, 12
Cache         cache = TorqueBox::Infinispan::Cache.new         cache.put(“something”, anything)         cache.get(“somethi...
cron                       0 0 2 * * ?/WTF??Friday, April 27, 12
Heroku Cron                  ๏ Free version runs 1x daily                  ๏ Implemented as a rake task                  ๏...
Heroku Cron                   Rakefile         desc "This task is called by the heroku cron add-on"         task :cron => ...
Scheduled Jobs                  In TorqueBox, a scheduled job                  is a component of your                  app...
Straight-forward                   refresh_trip_planner.rb         class RefreshTripPlanner           def run()           ...
Configuration                   torquebox.yml         jobs:           cache.updater:             job:         RefreshTripPl...
But...                  Doing a huge query                  once-a-day isnt                  ideal, it was just           ...
ServicesFriday, April 27, 12
TorqueBox Services                  ๏Avoid the huge query                  ๏Keep data more fresherFriday, April 27, 12
Keep it fresher                   trip_planner_service.rb          class TripPlannerService           def initialize( opti...
Keep it fresher                   trip_planner_service.rb          TripPlannerService           def initialize( options={}...
Keep it fresher                   trip_planner_service.rb          TripPlannerService           def initialize( options={}...
Keep it fresher                   app/models/business.rb         require torquebox-messaging         class Business < Acti...
Keep it fresher                   app/models/business.rb         require torquebox-messaging         class Business < Acti...
Queue, Service, Cache                                             Queue                       Non-blocking                ...
Production!Friday, April 27, 12
(Remember, I work for Red Hat)Friday, April 27, 12
Set up the server           $ yum install                java-1.6.0-openjdk                httpd                mod_cluste...
Launch on                         bootFriday, April 27, 12
init.d                  Install                  /etc/init.d/jboss-as                  from the stock distributionFriday, ...
JBoss configuration                   /etc/jboss-as/jboss-as.conf         #      General configuration for the init.d scrip...
Load Balance                   with mod_clusterFriday, April 27, 12
mod_cluster                   httpd.conf         LoadModule     slotmem_module         modules/mod_slotmem.so         Load...
mod_cluster                   httpd.conf (continued)         <VirtualHost torquebox-balancer:6666>                     <Di...
Deploy with                       CapistranoFriday, April 27, 12
Capistrano                  Regular capistrano deployments                  are supported given the recipes               ...
Deployed           [root@torquebox opt]#   ls -l apps/buyappalachian.org/           total 8           lrwxrwxrwx 1   23 Ma...
And then it grows...                  As your app evolves, you                  might add stuff like                  WebS...
Can we go                        further?Friday, April 27, 12
Whats a PaaS?                       Cache                     Jobs                                Application             ...
OPENSHIFT                       http://openshift.redhat.com     https://github.com/torquebox/torquebox-openshift-expressFr...
Roadmap & Status                  ๏ Current 2.0.1                  ๏ Continued Red Hat investment                  ๏ Inter...
Resources           http://torquebox.org/           @torquebox on Twitter           #torquebox on IRCFriday, April 27, 12
Question                       everything.Friday, April 27, 12
Creative Commons BY-SA 3.0Friday, April 27, 12
Upcoming SlideShare
Loading in …5
×

Deploy with CapistranoFriday, April 27, Complex Made Simple: Sleep Better With TorqueBox

9,050 views

Published on

Deploy with CapistranoFriday, April 27, 12

Published in: Technology
  • Dating direct: ♥♥♥ http://bit.ly/36cXjBY ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ❶❶❶ http://bit.ly/36cXjBY ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

×