1
+ default_run_options [ :pty ] = true
2
+
3
+ set :application , "authlogic_example.binarylogic.com"
4
+ set :repository , "[email protected] :binarylogic/authlogic_example.git"
5
+ set :keep_releases , 5
6
+
7
+ set :scm , :git
8
+ set :deploy_via , :remote_cache # prevent git from cloning on every deploy
9
+ set :deploy_to , "/var/www/#{ application } "
10
+ set :branch , "master"
11
+
12
+ set :thin_conf , "#{ current_path } /config/thin.yml" # must be set after :deploy_to is set
13
+
14
+ set :user , 'root'
15
+ set :runner , 'root'
16
+ set :use_sudo , false
17
+
18
+ role :app , "binarylogic.com"
19
+ role :web , "binarylogic.com"
20
+ role :db , "binarylogic.com" , :primary => true
21
+
22
+ task :after_update_code do
23
+ # handle shared files
24
+ %w{ /config/database.yml /config/thin.yml } . each do |file |
25
+ run "ln -nfs #{ shared_path } #{ file } #{ release_path } #{ file } "
26
+ end
27
+
28
+ deploy . cleanup
29
+ end
30
+
31
+ namespace :deploy do
32
+ namespace :thin do
33
+ [ :stop , :start , :restart ] . each do |t |
34
+ desc "#{ t . to_s . capitalize } the thin servers"
35
+ task t , :roles => :app do
36
+ #invoke_command checks the use_sudo variable to determine how to run the thin command
37
+ invoke_command "thin #{ t . to_s } -C #{ thin_conf } " , :via => run_method
38
+ end
39
+ end
40
+ end
41
+
42
+ desc "Custom restart task for thin cluster"
43
+ task :restart , :roles => :app , :except => { :no_release => true } do
44
+ deploy . thin . restart
45
+ end
46
+
47
+ desc "Custom start task for thin cluster"
48
+ task :start , :roles => :app do
49
+ deploy . thin . start
50
+ end
51
+
52
+ desc "Custom stop task for thin cluster"
53
+ task :stop , :roles => :app do
54
+ deploy . thin . stop
55
+ end
56
+ end
0 commit comments