|
30 | 30 |
|
31 | 31 | role :web, "[email protected]:8050"
|
32 | 32 | role :app, "[email protected]:8050"
|
33 |
| -role :app, "[email protected]:8051", :no_release => true, :no_symlink => true |
| 33 | +role :app, "[email protected]:8051", :no_release => true, :no_symlink => true |
34 | 34 | role :db, "[email protected]:8050", :primary => true
|
35 | 35 |
|
36 | 36 | # =============================================================================
|
|
109 | 109 | sudo "chmod 755 #{release_path}/public/themes/default.liquid"
|
110 | 110 | sudo "ln -nfs #{shared_path}/public/attachments #{release_path}/public/attachments"
|
111 | 111 | end
|
| 112 | + |
| 113 | +role :staging, '[email protected]' |
| 114 | +task :stage, :roles => :staging do |
| 115 | + #UPDATE CODE |
| 116 | + on_rollback { delete release_path, :recursive => true } |
| 117 | + |
| 118 | + source.checkout(self) |
| 119 | + |
| 120 | + run <<-CMD |
| 121 | + rm -rf #{release_path}/log #{release_path}/public/system && |
| 122 | + ln -nfs #{shared_path}/log #{release_path}/log && |
| 123 | + ln -nfs #{shared_path}/system #{release_path}/public/system |
| 124 | + CMD |
| 125 | + |
| 126 | + run <<-CMD |
| 127 | + test -d #{shared_path}/pids && |
| 128 | + rm -rf #{release_path}/tmp/pids && |
| 129 | + ln -nfs #{shared_path}/pids #{release_path}/tmp/pids; true |
| 130 | + CMD |
| 131 | + |
| 132 | + # uncache the list of releases, so that the next time it is called it will |
| 133 | + # include the newly released path. |
| 134 | + @releases = nil |
| 135 | + |
| 136 | + #AFTER UPDATE CODE |
| 137 | + run <<-CMD |
| 138 | + ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml |
| 139 | + CMD |
| 140 | + |
| 141 | + #AFTER SYMLINK |
| 142 | + run "ln -nfs #{shared_path}/public/attachments #{current_path}/public/attachments" |
| 143 | + run "ln -nfs #{shared_path}/public/themes #{current_path}/public/themes" |
| 144 | + |
| 145 | + #RESTART |
| 146 | + begin |
| 147 | + run "cd #{current_path} && mongrel_rails restart" |
| 148 | + rescue RuntimeError => e |
| 149 | + puts e |
| 150 | + puts "Probably not a big deal, so I'll just keep trucking..." |
| 151 | + end |
| 152 | +end |
0 commit comments