Deployment with Ruby on Rails

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    1 Favorite

    Deployment with Ruby on Rails - Presentation Transcript

    1. Advanced Deployment with Rails JAX 2009 Jonathan Weiss, 21 April 2009 Peritor GmbH
    2. Who am I? Jonathan Weiss •  Consultant for Peritor GmbH in Berlin •  Specialized in Rails, Scaling, Deployment, and Code Review •  Webistrano - Rails deployment tool •  FreeBSD Rubygems and Ruby on Rails maintainer http://www.peritor.com http://blog.innerewut.de http://twitter.com/jweiss 2
    3. Advanced Deployment 3
    4. Advanced Deployment 4
    5. Deployment Deployment Architecture Process 5
    6. Infrastructure Architecture 6
    7. Simple Rails Setup One Rails instance handles all requests Rails is (was) single-threaded: There is only one concurrent request 7
    8. Rails Setup 8
    9. Rails Setup 9
    10. Typical Rails Setup •  A load-balancer distributes the incoming requests •  Some load-balancers will deliver static requests themselves •  Several Rails instances handle all requests •  Number of concurrent requests equals number of Rails instances 10
    11. Rails Setup Options 11
    12. Deployment Questions Apache? Pound? mod_proxy_balancer? FastCGI? Mongrel? Proxy? Load-balancer? Nginx? mod_rails? Ebb? HA-Proxy? Reverse Proxy? Swiftiply? Phusion Passenger? Thin? Pen? Rails Application Lighttpd? Server? 12
    13. The relevant ones Rails Application Server Proxy/Web Server •  Mongrel •  Apache2 •  mod_rails / Phussion Passenger •  Nginx •  JRuby + Glassfish & Co. •  HA-Proxy 13
    14. Mongrel 14
    15. Mongrel •  Complete HTTP-Server that can load arbitrary Ruby-servlets •  Built-in Rails support 15
    16. Mongrel 16
    17. Mongrel Apache 2.2 – mod_proxy_balancer Lighttpd Nginx HA-Proxy Pound 17
    18. Mongrel Cluster Utility to manage several Mongrel instances 18
    19. Mongrel Cluster Control Mongrels 19
    20. Mongrel •  Very robust •  Strict HTTP parser •  Easy to debug (HTTP!) •  Defacto standard deployment with Apache 2.2 and mod_proxy_balancer •  Can be a bit difficult to setup (mongrel_cluster, ports, Apache) •  Not so easy on mass/virtual hosting 20
    21. mod_rails 21
    22. mod_rails a.k.a Phusion Passenger •  Module for Apache 2.2 (and Nginx) •  Allows Apache to control Rails instances •  Apache starts and stops application instances depending on the application load •  Able to run any RACK-compatible Ruby application (Merb & Co.) •  Only manages Rails on one host - no remote instances •  Combine with HTTP-Proxy / balancing solution 22
    23. Install Phusion Passenger Install module Load and activate in Apache 23
    24. Control Phusion Passenger Restart after deployment: 24
    25. Phusion Passenger One machine 25
    26. Phusion Passenger One machine Multiple machines 26
    27. Phusion Passenger •  Fairly new but ready for production •  Makes setup easier – on the single machine level •  Multiple servers still require load balancer •  Suitable for mass-hosting •  (upcoming) standard way of deploying Rails 27
    28. JRuby 28
    29. •  Ruby Runtime on the Java Virtual Machine •  Implemented in Java and Ruby •  Compiles Ruby into Java-bytecode •  Integrates with Java code and libraries •  Java’s promises of native threads and JIT •  Allows for Ruby/Rails applications to be packaged as WAR files •  WAR files deployable on any J2EE-container: Glassfish, JBoss, Tomcat, Jetty, … 29
    30. JRuby on Rails 30
    31. JRuby on Glassfish One machine 31
    32. JRuby on Glassfish One machine Multiple machines 32
    33. Setup JRuby on Glassfish 1.  Download JRuby and Glassfish 2.  From http://blog.headius.com/2008/08/zero-to-production-in-15-minutes.html 33
    34. Warble Configuration Define min/max Rails runtimes 34
    35. Infrastructure Process 35
    36. Deployment Process Requirements Reproducible Accountable Notifications Automatic 36
    37. Deployment Options 37
    38. Deployment Options 38
    39. Deployment Options 39
    40. Deployment Options 40
    41. What does Capistrano do? 41
    42. Capistrano Deployment Cycle 42
    43. The Deployment Lifecycle 43
    44. Requirements 44
    45. Get Your Capistrano On 45
    46. Get Your Capistrano On config/deploy.rb 46
    47. Capistrano Your one-stop deployment shop 47
    48. Capistrano Tasks To find all the tasks available in your project, use 48
    49. Custom Tasks Override build-in 49
    50. Write your own Tasks 50
    51. Write your own Tasks 51
    52. The Rest •  Callbacks •  Transactions •  Capistrano Shell •  Custom tasks and namespaces •  Staging and multiple setups •  Gem dependencies •  Support for deploying through gateway servers •  Server setup with deprec gem 52
    53. One Click Deploy 53
    54. Webistrano 54
    55. Webistrano •  Web-UI to Capistrano •  Manages projects and their stages •  Alerting and Accounting •  Scriptable and extendable •  BSD License http://labs.peritor.com/webistrano 55
    56. Macistrano •  Mac-GUI to Webistrano •  Fire and monitor deployments from your desktop http://github.com/mattmatt/macistrano 56
    57. Cloud Infrastructure 57
    58. Cloud Infrastructure Servers come and go •  You do not know your servers before deploying •  Restarting is the same as introducing a new machine You can’t hardcode IPs database.yml 58
    59. Solution #1 Query and manually adjust •  Servers do not change that often •  New nodes probably need manual intervention •  Use AWS ElasticIPs to ease the pain Set servers dynamically AWS Elastic IP 59
    60. Solution #2 Use a central directory service •  A central place to manage your running instances •  Instances query the directory and react 60
    61. Solution #2 Use a central directory service •  A central place to manage your running instances •  Instances query the directory and react 61
    62. Central Directory Different Implementations •  File on S3 •  SimpleDB •  A complete service, capable of monitoring and controlling your instances 62
    63. Final words Once understood the Rails infrastructure is quite simple Passenger is very easy to setup and should be the default choice Learn how to use Capistrano and Webistrano, they will make your life much easier – even in non-Rails setups 63
    64. Questions? 64
    65. Peritor GmbH Teutonenstraße 16 14129 Berlin Telefon: +49 (0)30 69 20 09 84 0 Telefax: +49 (0)30 69 20 09 84 9 Internet: www.peritor.com E-Mail: kontakt@peritor.com 65 Peritor GmbH - Alle Rechte vorbehalten 65

    + Jonathan WeissJonathan Weiss, 6 months ago

    custom

    1770 views, 1 favs, 1 embeds more stats

    Introduction to deployment with Ruby on Rails prese more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1770
      • 1745 on SlideShare
      • 25 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 32
    Most viewed embeds
    • 25 views on http://blog.peritor.com

    more

    All embeds
    • 25 views on http://blog.peritor.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories