Beyond Heroku: Hosting Your Rails App Yourself
Upcoming SlideShare
Loading in...5
×
 

Beyond Heroku: Hosting Your Rails App Yourself

on

  • 474 views

These are the slides from my presentation at CPOSC 2013.

These are the slides from my presentation at CPOSC 2013.

Statistics

Views

Total Views
474
Views on SlideShare
474
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • {"5":"Comparable to Thin, WEBrick, Puma\nThe no-multithreading part is important. It’s not just your code that needs to be thread-safe, but any Gems that you use as well. Pay a higher price in memory, but get single threaded code. This is in contrast to Puma which runs your code in a multithreaded environment and works best on a Ruby implementation that supports it (Rubinius, JRuby)\nExisting workers can continue to serve requests while a new master is being started. Then the new master takes over spawning new workers. Not perfect since you may have DB changes, etc., but still nice.\nConfigured via a Ruby DSL. So you can write actual code as part of the configuration.\n","6":"nginx keeps getting more popular. June 2013 Netcraft survey has nginx ahead of Microsoft IIS in market share of active sites.\nOfficial documentation is good - lots written elsewhere, too (blogs, etc.)\nEasy to install - nginx is available in most distros package managers, built with a reasonable set of defaults (compression, SSL). nginx uses modules that must be included at compile-time (unlike Apache modules that are added at runtime). Compiling is pretty easy if necessary.\nConfiguration is straightforward - just configuring the reverse proxy to Unicorn and whatever you want for static files (far-future expires)\n","7":"Uses tasks (like Rake). So individual steps can be executed separately.\nCan deploy from public source code hosts (Github, Bitbucket). Can also deploy via copying files, upload of directories. When the source code is accessible to the web server, incremental updates are possible.\nVersions are deployed into separate directories with the current version symlinked to a known location. Rollbacks are as easy as updating the symlink (at least if there aren’t conflicting DB changes).\nDB migrations can be executed as part of the deployment (or separately).\nLike Unicorn, uses a Ruby DSL for configuration. So code can be written to control Capistrano. You can also add your own tasks.\n","2":"Cost for dynos: $35/month - need a dyno for a worker\nCost for SSL: $20/month\nDB’s are expensive: $50/month for “production” quality\nYou trade flexibility for infrastructure expertise\nYou can choose to run Redis or Memcached on the same machine\nYou need to handle configuration\nSingle dynos are idled - take a long time to start up\n","3":"Lots of options for Linux hosting. Digital Ocean is only $5/month for 512 MB of RAM, $10/month for 1GB\nConfiguration management: Chef, Puppet, Ansible\nYou do need to be comfortable enough to build and deploy a server - it’s not that hard and it’s cheap to experiment with different configurations\nSet up your config management software, then throw away the VM, create a new one, and try it out\n","4":"nginx handles the web serving (static files, compression, SSL) and hands off the request to one or more Unicorn workers\nCapistrano is a deployment tool written in Ruby targeted for Rails\n"}

Beyond Heroku: Hosting Your Rails App Yourself Beyond Heroku: Hosting Your Rails App Yourself Presentation Transcript

  • Beyond Heroku: Hosting Your Rails App Yourself Sean Carpenter @scarpenter sean@seancarpenter.net
  • Why not Heroku? • Cost • Lack of control • Dyno idling
  • How can you do it? • Many affordable Linux hosts: Amazon (free tier), Windows Azure (with MSDN), Digital Ocean, Linode • Lots of open source configuration management software
  • Hosting a Rails Application • Unicorn as the app server • nginx as a reverse proxy • Deployment via Capistrano
  • Unicorn • Rack HTTP server • Multiple workers - concurrency without multithreading • Graceful restarts • Ruby for configuration
  • nginx • Fast and reliable • Well documented • Available in most distros • Straightforward configuration
  • Capistrano • Deploys code directly from source control • Easy rollback • Executes DB migrations • Ruby for configuration
  • Demo
  • Questions? https://github.com/scarpenter/cposc @scarpenter http://www.cleverarmadillo.com
  • Questions? https://github.com/scarpenter/cposc @scarpenter http://www.cleverarmadillo.com