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

USING CAPISTRANO FOR DEPLOYING EVERYTHING - Codemash 2013

7a6f8abf3af4af2ab8720782b06c9d77?s=47 Rob
January 10, 2013

USING CAPISTRANO FOR DEPLOYING EVERYTHING - Codemash 2013

7a6f8abf3af4af2ab8720782b06c9d77?s=128

Rob

January 10, 2013
Tweet

More Decks by Rob

Other Decks in Programming

Transcript

  1. Rob Harr @robertharr USING CAPISTRANO FOR DEPLOYING EVERYTHING Monday, April

    29, 13
  2. Teams are afraid of deploying code. Monday, April 29, 13

  3. Why? Monday, April 29, 13

  4. We are lazy. Monday, April 29, 13

  5. We dislike things that are unpredictable. Monday, April 29, 13

  6. We hate being blamed for things. Monday, April 29, 13

  7. We need to make shipping code easy and enjoyable. Monday,

    April 29, 13
  8. USING CAPISTRANO FOR DEPLOYING EVERYTHING INTRODUCING CAPISTRANO Monday, April 29,

    13
  9. Capistrano is a remote server automation tool which works wonderfully

    for automating deployments and other server tasks. Monday, April 29, 13
  10. 2 Core Assumptions ‣ You are using SSH to access

    the remote servers. ‣ You either have the same password to all target machines, or you have public keys in place to allow passwordless access to them. Monday, April 29, 13
  11. You also have to be using source control. Monday, April

    29, 13
  12. https://help.github.com/ articles/deploying-with- capistrano Installing Capistrano Monday, April 29, 13

  13. Capistrano was originally created to work with rails (it is

    written in Ruby). Monday, April 29, 13
  14. How it works ssh $ cap deploy Monday, April 29,

    13
  15. How it works Clone from Github Monday, April 29, 13

  16. How it works Remote push Monday, April 29, 13

  17. Continuous integration goes here. Monday, April 29, 13

  18. How it works ssh $ cap deploy Monday, April 29,

    13
  19. How it works ssh $ cap deploy update from github

    Monday, April 29, 13
  20. How it works ssh $ cap deploy update from github

    ssh Monday, April 29, 13
  21. $ gem install capistrano Installing Capistrano Monday, April 29, 13

  22. $ capify . Installing Capistrano Monday, April 29, 13

  23. set :deploy_to, "/var/www" set :repository, "git@github.com:sparkbox/ sparkbox-web.git" set :scm, :git

    role :app, "www.test.com" Installing Capistrano Monday, April 29, 13
  24. CAPISTRANO TASKS USING CAPISTRANO FOR DEPLOYING EVERYTHING Monday, April 29,

    13
  25. $ cap deploy:check Capistrano Tasks Monday, April 29, 13

  26. $ cap deploy:setup Capistrano Tasks Monday, April 29, 13

  27. $ cap deploy Capistrano Tasks Monday, April 29, 13

  28. $ cap deploy:rollback Capistrano Tasks Monday, April 29, 13

  29. Rails deployment tasks. Monday, April 29, 13

  30. New tasks can easily be added with a little ruby

    code. Monday, April 29, 13
  31. Simple task for compiling sass on a PHP Project desc

    "Compile sass to css" task :compile_sass, :roles => :app do run "cd #{release_path}; sass --update sass:css --style compressed" end Capistrano Tasks Monday, April 29, 13
  32. Simple task for creating a symlink for managed content task

    :create_symlinks, :roles => :app do run "ln -s #{deploy_to}/#{shared_dir}/ uploads #{current_release}/uploads" end Capistrano Tasks Monday, April 29, 13
  33. Monday, April 29, 13

  34. Case study with ExpressionEngine. Monday, April 29, 13

  35. THE BENEFITS USING CAPISTRANO FOR DEPLOYING EVERYTHING Monday, April 29,

    13
  36. More releases with smaller change sets. Monday, April 29, 13

  37. Practice makes perfect. Monday, April 29, 13

  38. Helps enforce other development best practices. Monday, April 29, 13

  39. Get everyone involved. Monday, April 29, 13

  40. Mistakes are easy to recover from. Monday, April 29, 13

  41. You can’t have continuous deployment without automating deployment. Monday, April

    29, 13
  42. So easy your clients can do it. Monday, April 29,

    13
  43. More confidence shipping code. Monday, April 29, 13

  44. We are lazy. Monday, April 29, 13

  45. We dislike things that are unpredictable. Monday, April 29, 13

  46. We hate being blamed for things. Monday, April 29, 13

  47. Monday, April 29, 13

  48. “Are you not entertained? Are you not entertained? Is this

    not why you are here?” Monday, April 29, 13
  49. Monday, April 29, 13

  50. Questions? Monday, April 29, 13

  51. THANKS! @robertharr rob@heysparkbox.com Monday, April 29, 13