View
1.826
Download
5
Embed Size (px)
DESCRIPTION
Citation preview
http://www.flickr.com/photos/jsome1/2226394415
Deploying Rails applications withDeploying Rails applications with
CapistranoCapistrano
What is Capistrano?What is Capistrano?
http://www.flickr.com/photos/dionisio/2481071707
requirementsrequirements
Ruby + Rake SCM SSH
$ gem install capistrano
installationinstallation
assumptionsassumptions
● We are using SSH. Telnet and FTP are not supported
● Servers have POSIX-compatible shell
● SSH Keys configured
capificationcapification
$ cd my_app$ cap .
/my_app| - Capifile| - /config/deploy.rb
set :application, “siege”
set :repository, “[email protected]:m3nd3s/siege.git”
set :scm, :git
set :branch, “master”
set :ssh_options, { :forward_agent => true }
set :user, “giran”
set :deploy_to, “/home/giran/siege”
set :my_var, “Giran Siege”
configuration configuration 1/21/2
config/deploy.rb
role :web, “siege.giran.com.br”
role :app, “siege.giran.com.br”
role :db, “siege.giran.com.br”
configuration configuration 2/22/2
task :acceptance do
set :user, "root"
set :deploy_to, "/var/www/siege"
end
taskstasks
$ cap deploy:setup
# Or cascaded tasks
$ cap acceptance deploy:setup
setting upsetting up
[deploy_to]
[deploy_to]/releases
[deploy_to]/shared
[deploy_to]/shared/log
[deploy_to]/shared/pids
[deploy_to]/shared/system
structure structure
namespace :deploy do
task :database, :roles => :app do
run "cp #{deploy_to}/shared/database.yml #{current_path}/config/"
end
end
databasedatabase
● Database needs to be created
$ cap deploy
# Or cascaded tasks
$ cap acceptance deploy
deploydeploy
after :deploy, 'deploy:database'
namespace :deploy do
...
end
after and beforeafter and before
namespace :deploy do
task :restart, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && touch tmp/restart.txt"
end
end
restartrestart
http://www.flickr.com/photos/mpawl/1572150843
referencesreferences
https://github.com/capistrano/capistrano/wiki/_pages
thank you !thank you !
Almir 'm3nd3s'Almir 'm3nd3s'@m3nd3s@m3nd3s
http://www.almirmendes.comhttp://[email protected]@giran.com.br
[email protected]@gmail.com
http://www.flickr.com/photos/meepfriends/2279161806