Refresh-Hilo 
http://capistranorb.com
What is Capistrano? 
A remote server automation and 
deployment tool written in Ruby. 
... 
A kick ass way to save you time!
Workflow Requirements 
● Code Repository (Git, SVN, HG) 
o Preferably hosted - GitHub, BitBucket, etc 
● Terminal access to servers via SSH 
o Root privileges not required 
● Basic terminal bash commands
How does it work? 
● Gem is installed on workstation ONLY 
● Connects to server via SSH and runs 
commands 
● Code deployment between servers = fast! 
● Create custom tasks and bind thru hooks 
● Manually trigger custom tasks too
Cool features! 
● Task Hooks 
● Quick Deployment & Rollback 
● Automation - clean cache, run builds 
● Deployment log - who did what when 
● Time saver
Installation 
● Requires Ruby >= 1.9 
● Latest release v3 
$ gem install capistrano
Capify 
● Goto a project folder 
$ cap install 
● Should create a few files: 
o Capfile, config/deploy.rb, 
config/deploy/*.rb, lib/capistrano/tasks
Config 
● Your deploy.rb file contains project level 
configs, or any config that applies to all 
environments (production, staging, etc) 
● deploy/{env}.rb file contains environment 
level configs - this can be complex - multiple 
servers, etc.
Config 
https://raw.githubusercontent.com/Refresh- 
Hilo/Capistrano-Demo/master/config/deploy.rb 
https://raw.githubusercontent.com/Refresh- 
Hilo/Capistrano- 
Demo/master/config/deploy/production.rb
Good to know 
● Must use : linked_dirs and/or linked_files 
for shared assets 
● Shared folder good for database config files, 
etc

Capistrano demo

  • 1.
  • 2.
    What is Capistrano? A remote server automation and deployment tool written in Ruby. ... A kick ass way to save you time!
  • 3.
    Workflow Requirements ●Code Repository (Git, SVN, HG) o Preferably hosted - GitHub, BitBucket, etc ● Terminal access to servers via SSH o Root privileges not required ● Basic terminal bash commands
  • 4.
    How does itwork? ● Gem is installed on workstation ONLY ● Connects to server via SSH and runs commands ● Code deployment between servers = fast! ● Create custom tasks and bind thru hooks ● Manually trigger custom tasks too
  • 6.
    Cool features! ●Task Hooks ● Quick Deployment & Rollback ● Automation - clean cache, run builds ● Deployment log - who did what when ● Time saver
  • 7.
    Installation ● RequiresRuby >= 1.9 ● Latest release v3 $ gem install capistrano
  • 8.
    Capify ● Gotoa project folder $ cap install ● Should create a few files: o Capfile, config/deploy.rb, config/deploy/*.rb, lib/capistrano/tasks
  • 9.
    Config ● Yourdeploy.rb file contains project level configs, or any config that applies to all environments (production, staging, etc) ● deploy/{env}.rb file contains environment level configs - this can be complex - multiple servers, etc.
  • 10.
    Config https://raw.githubusercontent.com/Refresh- Hilo/Capistrano-Demo/master/config/deploy.rb https://raw.githubusercontent.com/Refresh- Hilo/Capistrano- Demo/master/config/deploy/production.rb
  • 11.
    Good to know ● Must use : linked_dirs and/or linked_files for shared assets ● Shared folder good for database config files, etc