Radio, Web and Free Software

Changeset fbc0c51a22a4646da07780df6d8e303e1c8026b4

Show
Ignore:
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:
1 modified

Legend:

Unmodified
Added
Removed
  • config/deploy.rb

    r70813b7 rfbc0c51  
    11set :application, "bonnes-ondes" 
    22set :scm, "git" 
    3 set :repository, "git://projects.tryphon.eu/bonnes-ondes" 
     3set :repository, "git://www.dbx.tryphon.priv/bonnes-ondes" 
    44 
    55set :deploy_to, "/var/www/bonnes-ondes" 
     
    99set :use_sudo, false 
    1010 
    11 set :synchronous_connect, true 
     11server "radio.dbx.tryphon.priv", :app, :web, :db, :primary => true 
    1212 
    13 server "zigmun.tryphon.org", :app, :web, :db, :primary => true 
    14  
    15 set :mongrel_conf, "bonnes-ondes.conf" 
     13after "deploy:update_code", "deploy:symlink_shared", "deploy:gems" 
    1614 
    1715namespace :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)" 
    2121  end 
    22 end 
    2322 
    24 after "deploy:update_code", "deploy:gems" 
    25  
    26 namespace :deploy do 
    2723  desc "Install gems" 
    2824  task :gems, :roles => :app do 
    2925    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}" 
    3045  end 
    3146end 
     
    3348desc "Create data directories" 
    3449task :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") 
    3651  run "umask 02 && mkdir -p #{attachements_shared_dir}" 
    3752 
     
    4055end 
    4156 
    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}" 
     57namespace :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 
    5663end