Deploying Rails applications with Capistrano             http://www.flickr.com/photos/jsome1/2226394415
What is Capistrano?                      http://www.flickr.com/photos/dionisio/2481071707
requirementsRuby + Rake   SCM      SSH
installation$ gem install capistrano
assumptions●    We are using SSH. Telnet and FTP are not    supported●    Servers have POSIX-compatible shell●    SSH Keys...
capification$ cd my_app$ cap ./my_app| - Capifile| - /config/deploy.rb
1/2                        configurationset :application, “siege”set :repository, “git@github.com:m3nd3s/siege.git”set :sc...
2/2                  configurationrole :web, “siege.giran.com.br”role :app, “siege.giran.com.br”role :db, “siege.giran.com...
taskstask :acceptance do set :user, "root" set :deploy_to, "/var/www/siege"end
setting up$ cap deploy:setup# Or cascaded tasks$ cap acceptance deploy:setup
structure[deploy_to][deploy_to]/releases[deploy_to]/shared[deploy_to]/shared/log[deploy_to]/shared/pids[deploy_to]/shared/...
database  ●      Database needs to be creatednamespace :deploy do  task :database, :roles => :app do    run "cp #{deploy_t...
deploy$ cap deploy# Or cascaded tasks$ cap acceptance deploy
after and beforeafter :deploy, deploy:databasenamespace :deploy do      ...end
restartnamespace :deploy do  task :restart, :roles => :app, :except => {:no_release => true } do          run "cd #{curren...
http://www.flickr.com/photos/mpawl/1572150843
referenceshttps://github.com/capistrano/capistrano/wiki/_pages
thank you !        Almir m3nd3s          @m3nd3shttp://www.almirmendes.com almir.mendes@giran.com.br     m3nd3s@gmail.com ...
Upcoming SlideShare
Loading in …5
×

Deploying Rails Applications with Capistrano

1,823 views

Published on

Published in: Technology, Business
  • Be the first to comment

Deploying Rails Applications with Capistrano

  1. 1. Deploying Rails applications with Capistrano http://www.flickr.com/photos/jsome1/2226394415
  2. 2. What is Capistrano? http://www.flickr.com/photos/dionisio/2481071707
  3. 3. requirementsRuby + Rake SCM SSH
  4. 4. installation$ gem install capistrano
  5. 5. assumptions● We are using SSH. Telnet and FTP are not supported● Servers have POSIX-compatible shell● SSH Keys configured
  6. 6. capification$ cd my_app$ cap ./my_app| - Capifile| - /config/deploy.rb
  7. 7. 1/2 configurationset :application, “siege”set :repository, “git@github.com:m3nd3s/siege.git”set :scm, :gitset :branch, “master”set :ssh_options, { :forward_agent => true }set :user, “giran”set :deploy_to, “/home/giran/siege”set :my_var, “Giran Siege” config/deploy.rb
  8. 8. 2/2 configurationrole :web, “siege.giran.com.br”role :app, “siege.giran.com.br”role :db, “siege.giran.com.br”
  9. 9. taskstask :acceptance do set :user, "root" set :deploy_to, "/var/www/siege"end
  10. 10. setting up$ cap deploy:setup# Or cascaded tasks$ cap acceptance deploy:setup
  11. 11. structure[deploy_to][deploy_to]/releases[deploy_to]/shared[deploy_to]/shared/log[deploy_to]/shared/pids[deploy_to]/shared/system
  12. 12. database ● Database needs to be creatednamespace :deploy do task :database, :roles => :app do run "cp #{deploy_to}/shared/database.yml#{current_path}/config/" endend
  13. 13. deploy$ cap deploy# Or cascaded tasks$ cap acceptance deploy
  14. 14. after and beforeafter :deploy, deploy:databasenamespace :deploy do ...end
  15. 15. restartnamespace :deploy do task :restart, :roles => :app, :except => {:no_release => true } do run "cd #{current_path} && touch tmp/restart.txt" endend
  16. 16. http://www.flickr.com/photos/mpawl/1572150843
  17. 17. referenceshttps://github.com/capistrano/capistrano/wiki/_pages
  18. 18. thank you ! Almir m3nd3s @m3nd3shttp://www.almirmendes.com almir.mendes@giran.com.br m3nd3s@gmail.com http://www.flickr.com/photos/meepfriends/2279161806

×