Slide 1

Slide 1 text

Deploying Rails apps
 with Capistrano +

Slide 2

Slide 2 text

About: Bruno Sutic, github.com/bruno-/
 Rails & Javascript developer
 Ideal Project Group, Chicago Worked on a Capistrano plugins: github.com/capistrano-plugins/

Slide 3

Slide 3 text

Goals • motivate Rails devs to try Capistrano • make Capistrano vs Heroku comparison • demo app deployment

Slide 4

Slide 4 text

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…

Slide 5

Slide 5 text

Heroku PROS • Free! • Really simple • Single click add-ons CONS • Paid plans are expensive • Closed (and expensive)
 add-on ecosystem • Technical lock-in

Slide 6

Slide 6 text

Heroku is great, but expensive.
 
 Capistrano is the alternative.

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

How does it work? • built on top of `ssh` $ ssh my_server “echo ‘foo’” $ scp some_file.txt my_server:/dir/

Slide 10

Slide 10 text

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)

Slide 11

Slide 11 text

Capistrano downsides • more work (than i.e. Heroku) • requires learning • capistrano itself • dev ops: server installation, configuration, hardening • familiarity with ssh

Slide 12

Slide 12 text

Quiz

Slide 13

Slide 13 text

Capistrano vs Heroku quiz Situation: • Ruby on Rails beginner • Created first app for practice How do you deploy?

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

Capistrano vs Heroku quiz Situation: • Experienced Rails dev • Small app built over the weekend How do you deploy? Both are fine! (it depends )

Slide 16

Slide 16 text

Demo time

Slide 17

Slide 17 text

Capistrano demo STEPS 1. make a Rails app ✅ 2. buy & setup a server ✅ 3. setup Capistrano 4. deploy STACK • Nginx • Unicorn • PostgreSQL

Slide 18

Slide 18 text

Next steps • www.capistranorb.com • capistrano github • https://gist.github.com/bruno-/9808201