Deploying Rails Applications

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

    24 Favorites & 1 Group

    Deploying Rails Applications - Presentation Transcript

    1. Deploying Rails Applications Vivek Prahlad
    2. Agenda
        • Typical Rails deployment scenarios
        • Mongrel
        • Nginx vs. Apache vs. Lighttpd
        • Shared vs. Virtual vs. Dedicated hosting
        • Monitoring Rails Applications
    3. Typical Rails Deployment Setup Web Server (Static Content)‏ Rails App (Mongrel)‏ Database (MySQL / PostgreSQL)‏
    4. Lots of Static content? Web Server (Static Content)‏ Rails App (Mongrel)‏ Database )‏ (MySQL / PostgreSQL)‏ Load Balancer Cluster
    5. Heavy database load? Web Server (Static Content)‏ Rails App (Mongrel)‏ Database (MySQL / PostgreSQL)‏ Cluster
    6. Very dynamic application? Web Server (Static Content)‏ Rails App (Mongrel)‏ Database (MySQL / PostgreSQL)‏ Cluster
    7. Installing the stack using Deprec
        • cd /path/to/railsapp
        • deprec --apply-to . --name projectname --domain www.projectname.com
        • # edit config/deploy.rb to add svn details
        • cap install_rails_stack
        • cap setup
        • cap deploy_with_migrations
        • cap restart_apache
    8. Mongrel
    9. Mongrel
        • Pure Ruby web server for Ruby applications
        • Supports Rails, Camping, Og + Nitro
        • Need a cluster due to Rails threadsafety issue
        • Significant footprint increase with Rails 1.2
          • Approximately 60MB / Mongrel / Mephisto instance
        • Dash B logging for detecting memory leaks
    10.  
    11. Nginx
        • Web server from Igor Sysoev: best used as a reverse proxy
        • Rapidly becoming preferred choice of Rails community
        • 10MB footprint with 10,000 concurrent connections
        • Load balancing
        • Weighted load balancing
        • Relatively straightforward configuration
    12. Nginx vs. Apache
        • Apache: Relatively Larger footprint
        • Thread per request
        • Nginx: Low footprint
        • Non blocking IO
    13. Issues with Lighttpd
        • Stability
        • Memory leaks
        • Non-trivial URL rewriting
    14. Nginx: configuring mongrel
        • upstream mongrel {
        • server 127.0.0.1:10000;
        • server 127.0.0.1:10001;
        • }
        • proxy_pass http://mongrel;
    15. Nginx: load balancing
        • upstream backend {
        • server backend1.example.com weight=5;
        • server backend2.example.com:8080;
        • server unix:/tmp/backend3;
        • }
    16. Nginx: Caveats
        • Primary documentation in Russian
          • (Documentation is rapidly improving, though)‏
        • No X-sendfile support (useful for serving large files)‏
        • Virtual host support poor
    17. Rails Hosting
        • Rails 1.2+ unsuitable for shared hosting
        • Most shared hosts have published / unpublished memory caps
          • Textdrive: 47 MB per process
        • Dedicated hosting expensive
          • Starts at ~ $70 per month (e.g. ServerPronto)‏
    18. Virtual Private Server (VPS) Hosting
        • Fits in between Shared and Dedicated hosting
        • Nice performance / price ratio (starts @ $20 / month)‏
        • Can potentially exploit superior hardware
        • Alternatives:
          • Xen
          • Virtuzzo
        • Baked in kernel level virtualization support is coming
        • Caveat: Need to manage your own setup
    19. Advantages of VPS hosting
        • Entire CPU available when other users are idle.
        • Disk I/O usually faster than dedicated box (due to RAID etc.)‏
        • Can take advantage of SANs if required.
        • Hosting company takes care of the VPS server
        • Fairly easy to scale VPS setup (just add more VMs)‏
    20. Monitoring Rails applications
        • Monit (http://www.tideslash.com/monit)‏
        • Process monitoring tool
        • Can monitor:
          • HTTP server
          • Processes
          • Databases (MySQL and PostgreSQL)‏
    21. Cron Jobs
        • Clear stale sessions
        • Database maintenance
        • Clear logs
        • Best practice: get Cron to call out to a script
        • Don't hardcode commands in the crontab
        • Makes it easy to test
    22. Putting it all together
        • Can use Monit to create 'self healing' setup
        • PostgresQL
        • Nginx
        • Mongrel
        • Cron
        • http://nginx.net/
        • http://railsexpress.de/blog (performance tuning)‏
        • http://hostingfu.com (blog on hosting)‏
        • http://www.slideshare.net/Georgio_1999/how-to-scale-your-web-app/ (scaling Rails)‏
      Additional Information
    23. Thank You http://blog.vivekprahlad.com/

    + vivek_prahladvivek_prahlad, 3 years ago

    custom

    11988 views, 24 favs, 8 embeds more stats

    Covers the different options for scaling Rails appl more

    More Info

    © All Rights Reserved

    Go to text version
    • Total Views 11988
      • 11895 on SlideShare
      • 93 from embeds
    • Comments 0
    • Favorites 24
    • Downloads 37
    Most viewed embeds
    • 77 views on http://blog.vivekprahlad.com
    • 6 views on http://www.lonerunners.net
    • 3 views on http://localhost:3000
    • 3 views on http://10.14.200.192
    • 1 views on http://feeds.feedburner.com

    more

    All embeds
    • 77 views on http://blog.vivekprahlad.com
    • 6 views on http://www.lonerunners.net
    • 3 views on http://localhost:3000
    • 3 views on http://10.14.200.192
    • 1 views on http://feeds.feedburner.com
    • 1 views on http://static.slideshare.net
    • 1 views on http://209.85.175.104
    • 1 views on http://192.168.3.59:3000

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as innappropriate

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

    Cancel

    Categories

    Groups / Events