-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcapistrano.txt
55 lines (41 loc) · 1.84 KB
/
capistrano.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Capisrano
Summary:
- define servers + repos in deploy.rb
- cap deploy (ssh to server, clone app or pull)
Details:
cd /location/from/where/you/want/to/deploy
capify .
└→ Capfile
└→ config/deploy.rb - deployment recipes # <=> project name click in Webistrano (Project configuration)
require 'capistrano/ext/multistage' # for production.rb...
set :stages, ["staging", "production"]
set :default_stage, "staging"
set :application, "fancy_shoes"
set :repository, "[email protected]:/account/repository.git"
---------------------------------------------------------------------------
set :user, "server-user-name"
set :deploy_via, :remote_cache # use clone once to the server then use git pulls
namespace :deploy do
# default
# task :restart, :roles => :web do
# run "touch #{ current_path }/tmp/restart.txt"
# end
desc "Restarting all daemons!"
task :restart_daemons, :roles => :app do
sudo "monit restart all -g daemons"
end
end
after "deploy", "deploy:restart_daemons"
# after "deploy", "deploy:restart" # built into Capistrano so not explicitly needed
config/production.rb
set :branch, 'master'
config/staging.rb
set :branch, 'staging'
server "my_fancy_server.com", :app, :web, :db, :primary => true # 3 roles for that server
set :deploy_to, "/var/www/fancy_shoes"
--------------------------------------
cap deploy:setup # look for equivalent link in Webistrano
└→ ssh to server (deploy_to) and create a special directory structure
cap deploy:check
cap production deploy
cap deploy # default