Changeset fbc0c51a22a4646da07780df6d8e303e1c8026b4
- Timestamp:
- 07/26/10 21:12:09 (6 weeks ago)
- Author:
- Alban Peignier <alban@…>
- Parents:
- aa902da0b29edcfed29dab3c8c4bf807931412ee
- Children:
- 0ead693cbae79e21f5c4828ffc14506af0279788
- git-committer:
- Alban Peignier <alban@tryphon.eu> / 2010-07-26T21:12:09Z+0200
- Message:
-
Update capistrano settings for new server
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r70813b7
|
rfbc0c51
|
|
| 1 | 1 | set :application, "bonnes-ondes" |
| 2 | 2 | set :scm, "git" |
| 3 | | set :repository, "git://projects.tryphon.eu/bonnes-ondes" |
| | 3 | set :repository, "git://www.dbx.tryphon.priv/bonnes-ondes" |
| 4 | 4 | |
| 5 | 5 | set :deploy_to, "/var/www/bonnes-ondes" |
| … |
… |
|
| 9 | 9 | set :use_sudo, false |
| 10 | 10 | |
| 11 | | set :synchronous_connect, true |
| | 11 | server "radio.dbx.tryphon.priv", :app, :web, :db, :primary => true |
| 12 | 12 | |
| 13 | | server "zigmun.tryphon.org", :app, :web, :db, :primary => true |
| 14 | | |
| 15 | | set :mongrel_conf, "bonnes-ondes.conf" |
| | 13 | after "deploy:update_code", "deploy:symlink_shared", "deploy:gems" |
| 16 | 14 | |
| 17 | 15 | namespace :deploy do |
| 18 | | desc "Custom restart task for mongrel" |
| 19 | | task :restart, :roles => :app, :except => { :no_release => true } do |
| 20 | | sudo "/usr/local/sbin/mongrel_restart #{mongrel_conf}" |
| | 16 | # Prevent errors when chmod isn't allowed by server |
| | 17 | task :setup, :except => { :no_release => true } do |
| | 18 | dirs = [deploy_to, releases_path, shared_path] |
| | 19 | dirs += shared_children.map { |d| File.join(shared_path, d) } |
| | 20 | run "mkdir -p #{dirs.join(' ')} && (chmod g+w #{dirs.join(' ')} || true)" |
| 21 | 21 | end |
| 22 | | end |
| 23 | 22 | |
| 24 | | after "deploy:update_code", "deploy:gems" |
| 25 | | |
| 26 | | namespace :deploy do |
| 27 | 23 | desc "Install gems" |
| 28 | 24 | task :gems, :roles => :app do |
| 29 | 25 | sudo "rake --rakefile=#{release_path}/Rakefile gems:install RAILS_ENV=production" |
| | 26 | end |
| | 27 | |
| | 28 | desc "Symlinks shared configs and folders on each release" |
| | 29 | task :symlink_shared, :except => { :no_release => true } do |
| | 30 | run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/" |
| | 31 | run "ln -nfs #{shared_path}/config/production.rb #{release_path}/config/environments/" |
| | 32 | |
| | 33 | attachements_shared_dir = File.join(shared_path, "attachments") |
| | 34 | attachements_local_dir = File.join(release_path, "public", "attachments") |
| | 35 | |
| | 36 | run "ln -nfs #{attachements_shared_dir} #{attachements_local_dir}" |
| | 37 | |
| | 38 | templates_shared_dir = File.join(shared_path, "templates") |
| | 39 | templates_local_dir = File.join(release_path, "templates") |
| | 40 | |
| | 41 | run "rsync -a #{templates_local_dir}/* #{templates_shared_dir}/" |
| | 42 | run "rm -rf #{templates_local_dir}" |
| | 43 | |
| | 44 | run "ln -nfs #{templates_shared_dir} #{templates_local_dir}" |
| 30 | 45 | end |
| 31 | 46 | end |
| … |
… |
|
| 33 | 48 | desc "Create data directories" |
| 34 | 49 | task :after_setup, :roles => [:app, :web] do |
| 35 | | attachements_shared_dir = File.join(shared_path, "data", "attachments") |
| | 50 | attachements_shared_dir = File.join(shared_path, "attachments") |
| 36 | 51 | run "umask 02 && mkdir -p #{attachements_shared_dir}" |
| 37 | 52 | |
| … |
… |
|
| 40 | 55 | end |
| 41 | 56 | |
| 42 | | desc "Link data directories" |
| 43 | | task :after_symlink, :roles => [:app, :web] do |
| 44 | | attachements_shared_dir = File.join(shared_path, "data", "attachments") |
| 45 | | attachements_local_dir = File.join(current_path, "public", "attachments") |
| 46 | | |
| 47 | | run "ln -nfs #{attachements_shared_dir} #{attachements_local_dir}" |
| 48 | | |
| 49 | | templates_shared_dir = File.join(shared_path, "templates") |
| 50 | | templates_local_dir = File.join(current_path, "templates") |
| 51 | | |
| 52 | | run "rsync -av #{templates_local_dir}/ #{templates_shared_dir}/" |
| 53 | | run "rm -rf #{templates_local_dir}" |
| 54 | | |
| 55 | | run "ln -nfs #{templates_shared_dir} #{templates_local_dir}" |
| | 57 | namespace :deploy do |
| | 58 | task :start do ; end |
| | 59 | task :stop do ; end |
| | 60 | task :restart, :roles => :app, :except => { :no_release => true } do |
| | 61 | run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" |
| | 62 | end |
| 56 | 63 | end |