Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploying Rails apps with Capistrano

Deploying Rails apps with Capistrano

Bruno Sutic

October 01, 2014
Tweet

More Decks by Bruno Sutic

Other Decks in Technology

Transcript

  1. About: Bruno Sutic, github.com/bruno-/
 Rails & Javascript developer
 Ideal Project

    Group, Chicago Worked on a Capistrano plugins: github.com/capistrano-plugins/
  2. Goals • motivate Rails devs to try Capistrano • make

    Capistrano vs Heroku comparison • demo app deployment
  3. What is Capistrano? • Capistrano is a deployment tool.
 It

    gets the app running on the server. • Other deployment strategies:
 - manual (zip + ftp)
 - Mina
 - Heroku 
 - Engine Yard
 - Docker
 - Chef, Puppet…
  4. Heroku PROS • Free! • Really simple • Single click

    add-ons CONS • Paid plans are expensive • Closed (and expensive)
 add-on ecosystem • Technical lock-in
  5. What is Capistrano? • Ruby gem • built on top

    of ssh and Rake (think tasks) • mature and battle tested
 v1.1.0 in March 2006 • scalable • technology agnostic: used for deploying apps in Ruby, PHP + other
  6. What Capistrano is *not*? • server installation / provisioning tool


    think: `apt-get install nginx` • server configuration tool
 think: updating IPtables • Chef, Puppet, Ansible are better for these tasks
  7. How does it work? • built on top of `ssh`

    $ ssh my_server “echo ‘foo’” $ scp some_file.txt my_server:/dir/
  8. How does it work? $ ssh my_server “git clone github.com/myapp”

    $ ssh my_server “service nginx restart” 2) git clone myapp 1) ssh my_server Dev machine Server Git repo (Github)
  9. Capistrano downsides • more work (than i.e. Heroku) • requires

    learning • capistrano itself • dev ops: server installation, configuration, hardening • familiarity with ssh
  10. Capistrano vs Heroku quiz Situation: • Ruby on Rails beginner

    • Created first app for practice How do you deploy?
  11. Capistrano vs Heroku quiz Situation: • Rails dev team •

    Long term customer • Big app, will need scaling How do you deploy?
  12. Capistrano vs Heroku quiz Situation: • Experienced Rails dev •

    Small app built over the weekend How do you deploy? Both are fine! (it depends )
  13. Capistrano demo STEPS 1. make a Rails app ✅ 2.

    buy & setup a server ✅ 3. setup Capistrano 4. deploy STACK • Nginx • Unicorn • PostgreSQL