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

Deploying Rails apps with Capistrano

Deploying Rails apps with Capistrano

Ee1bd63b4d7f6e79bdcddf1611ccec99?s=128

Bruno Sutic

October 01, 2014
Tweet

Transcript

  1. Deploying Rails apps
 with Capistrano +

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

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

    Capistrano vs Heroku comparison • demo app deployment
  4. 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…
  5. Heroku PROS • Free! • Really simple • Single click

    add-ons CONS • Paid plans are expensive • Closed (and expensive)
 add-on ecosystem • Technical lock-in
  6. Heroku is great, but expensive.
 
 Capistrano is the alternative.

  7. 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
  8. 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
  9. How does it work? • built on top of `ssh`

    $ ssh my_server “echo ‘foo’” $ scp some_file.txt my_server:/dir/
  10. 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)
  11. Capistrano downsides • more work (than i.e. Heroku) • requires

    learning • capistrano itself • dev ops: server installation, configuration, hardening • familiarity with ssh
  12. Quiz

  13. Capistrano vs Heroku quiz Situation: • Ruby on Rails beginner

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

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

    Small app built over the weekend How do you deploy? Both are fine! (it depends )
  16. Demo time

  17. Capistrano demo STEPS 1. make a Rails app ✅ 2.

    buy & setup a server ✅ 3. setup Capistrano 4. deploy STACK • Nginx • Unicorn • PostgreSQL
  18. Next steps • www.capistranorb.com • capistrano github • https://gist.github.com/bruno-/9808201