Capistrano Switchtower - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Capistrano Switchtower

Description:

config/deploy.rb. Lib/tasks/Capistrano.rake. Configure Capistrano. Edit deploy.rb to match your ... My Modifications to deploy.rb. set :application, 'captest' ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 12
Provided by: orug
Category:

less

Transcript and Presenter's Notes

Title: Capistrano Switchtower


1
Capistrano (Switchtower)
  • Automating Application Deployment

By Gregg Pollack
2
Deployment isnt that complex, right?
  • Simple sites are easy
  • One Database
  • One Webserver
  • One Application
  • Multiple Sites?

3
Intro to Capistrano
  • What is Capistrano?
  • Can be used everywhere
  • Lots of Assumptions

4
Installing Capistrano
  • Gem install capistrano
  • cap h to see commands
  • Now to apply it to an application
  • cap apply-to /path/to/my/app ApplicationName
  • Creates two files
  • config/deploy.rb
  • Lib/tasks/Capistrano.rake

5
Configure Capistrano
  • Edit deploy.rb to match your apps setup
  • Youll need to specify the servers, repository
    location and deployment path at minimum
  • Defaults to SVN, normal SSH port, key in user
    home, SCM executable on PATH, etc.
  • When you first start, youll probably only have
    one server fulfill the DB, web and app roles.

6
My Modifications to deploy.rb
  • set application, "captest"
  • set repository, "https//pollack.textdriven.com/s
    vn/captest"
  • role web, "burnaby.textdrive.com"
  • role app, "burnaby.textdrive.com"
  • role db, "burnaby.textdrive.com"
  • set deploy_to, "/users/home/patched/sites/captest
    "
  • set user, "patched"
  • set svn_username, "captest"
  • set svn_password, "captest"
  • desc "Restart the webserver/fcgi procs, however
    you do it"
  • task restart, roles gt app do
  • Im not going to restart anything for this
    example
  • end
  • task after_deploy, roles gt app do
  • Set my new dispatch.fcgi to be executable
  • run "chmod 755 deploy_to/current/public/dispat
    ch.fcgi"
  • end

7
Setup
  • rake remoteexec ACTIONsetup
  • Sets up the base directories

This creates /sites/captest/releases /sites/captes
t/shared /sites/captest/shared/log /sites/captest/
shared/system
8
Deployment Structure
9
Lets Deploy!
  • Rake --tasks to see all our options
  • Rake deploy to push a version
  • Rake rollback to rollback

10
How Ive hacked Capistrano
  • desc "My Simple Deploy"
  • task deploy, roles gt app do
  • run "svn update deploy_to"
  • run "cd deploy_to "
  • "rake RAILS_ENVproduction migrate"
  • run "ruby deploy_to/script/process/reaper
    -a reload -r .pid"
  • end

11
Documentation on Capistrano
  • Online Book
  • http//manuals.rubyonrails.com/read/book/17
Write a Comment
User Comments (0)
About PowerShow.com