Your SlideShare is downloading. ×
Capistrano Overview
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Capistrano Overview

5,667
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
5,667
On Slideshare
0
From Embeds
0
Number of Embeds
8
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Capistrano
    • Travis Roberts
    • [email_address]
    • http://twitter.com/travisroberts
  • 2. Prerequisites
    • SSH access to server
    • SSH user/password (ssh keys are better)
    • Ruby
  • 3.
      • Step 1: Cut a hole in the box
      • gem install capistrano
      • Step 2: cd path/to/project
      • Step 3: capify .
    Project Setup
  • 4. Customize deploy.rb
    • Required settings
    set :application , "test_app" set :domain , "mysite.com" set :deploy_to , "/var/www/apps/#{application}" set :repository , " http://svn.centresource.com/#{application}/trunk " role :web , domain # where the web server runs role :app , domain # where the application layer runs role :db , domain, :primary => true # where your db runs
  • 5. Customize deploy.rb
    • Optional settings
    set :scm , :git set :repository , " [email_address] :username/projectname.git" set :user , "deploy" set :password , "p@55w0rd" set :use_sudo , false
    • Recommended settings
    set :deploy_via , 'remote_cache' set :keep_releases , 5
  • 6. Folder Structure
    • Folder structure on server (created by calling cap servers:setup )
    /deploy_to_path --current (symlink) --releases --20100422123598 --20100422123942 --shared --system --pids --logs
  • 7. The Process
    • Container (does nothing)
    • Container (does nothing)
    • Copies code to server
    • Touches up the copied code
    • Updates current symlink
    • Restarts application
  • 8. Custom Tasks # symlink database namespace :deploy do desc "Symlink database." task :symlink_db do run "ln -nfs #{shared_path}/system/database.yml #{release_path}/config/database.yml" end end after 'deploy:update_code' , 'deploy:symlink_db'
  • 9. Overwrite Tasks namespace :deploy do # symfony doesn't need these tasks task :start do ; end task :stop do ; end task :restart do ; end # doctrine migration task :migrate do run "cd #{release_path} && php symfony doctrine:migrate --env='prod'" end end
  • 10. Put It All Together
    • cap servers:setup
    • cap deploy:cold
    • cap deploy
    • cap deploy:migrations
    • cap deploy:rollback
    • cap -T