Ihr Browser versucht gerade eine Seite aus dem sogenannten Internet auszudrucken. Das Internet ist ein weltweites Netzwerk von Computern, das den Menschen ganz neue Möglichkeiten der Kommunikation bietet.

Da Politiker im Regelfall von neuen Dingen nichts verstehen, halten wir es für notwendig, sie davor zu schützen. Dies ist im beidseitigen Interesse, da unnötige Angstzustände bei Ihnen verhindert werden, ebenso wie es uns vor profilierungs- und machtsüchtigen Politikern schützt.

Sollten Sie der Meinung sein, dass Sie diese Internetseite dennoch sehen sollten, so können Sie jederzeit durch normalen Gebrauch eines Internetbrowsers darauf zugreifen. Dazu sind aber minimale Computerkenntnisse erforderlich. Sollten Sie diese nicht haben, vergessen Sie einfach dieses Internet und lassen uns in Ruhe.

Die Umgehung dieser Ausdrucksperre ist nach §95a UrhG verboten.

Mehr Informationen unter www.politiker-stopp.de.

Capistrano Deployment using rsync

This was meant to be a comment to to this article here, where comments have unfortunately been closed, but trackbacks are still enabled (it seems). Let's see if it works.

Hi,
I am using your receipe, thanks very much! However, this will not actually only transfer the differences between releases, will it? Since cap creates a new directory for each release you could just as well use scp :(

This is especially bad for me because I have a single huge database fixture (~20MB) and the rest of the application is rather small (<1MB). "cap deploy" takes almost ten minutes just because of this single file.

Any ideas how to do this better? Is there a variable available in cap to refer to the "previous" release? Then you could do something like

cp -a #{previous_path} #{release_path}
rsync -avz --delete -e ssh ./ ........

UPDATE 2007.05.19

I found out how to "do it".

task :update_code, :roles => [:web] do 
  on_rollback { delete release_path, :recursive => true } 
  username = user || ENV['USER']
  current_task.servers.each do |server| 
    run "/usr/bin/rsync --exclude=tmp/sessions/** -a \
        #{current_release}/ #{release_path}"    # cp fails on log/tmp files
    puts `rsync -avz -e ssh "./" "#{username}@#{server}:#{release_path}" \
      --exclude "tmp" --exclude "log" --exclude "_darcs" --exclude ".svn" --exclude "log"` 
  end 
  run <<-CMD
  rm -rf #{release_path}/log &&
  rm -rf #{release_path}/public/system &&
  rm -rf #{release_path}/public/files &&
  ln -nfs #{shared_path}/log #{release_path}/log &&
  ln -nfs #{shared_path}/files #{release_path}/public/files &&
  ln -nfs #{shared_path}/system #{release_path}/public/system &&
  mkdir -p #{release_path}/tmp/{cache,pids,sessions,sockets} &&
  chmod a+rwt #{release_path}/tmp/{cache,pids,sessions,sockets} &&
  cd #{release_path}/config && ln -nfs db-mysql.yml database.yml && cd - && 
  perl -pi -e "s/^RAILS_GEM_VERSION = '1.2.1'/RAILS_GEM_VERSION = '1.2.3'/;" \
       #{release_path}/config/environment.rb
CMD
end

The last two lines are just to adjust for my different versions and database configuration. But this #{current_release} variable works like a charm. I have to use rsync (can't use cp) because there are unreadable files in the tmp/sessions directory (at least for my "deployment" user) that cp would fail on, and cp can't exclude files.

Works like a charm and only transmits files that actually have changed. Except for a small glitch in the 'symlink' task that once used the wrong path, I haven't found out why that happened yet.

Thanks!

Jens

Trackback URL for this post:

http://news.jensbenecke.de/trackback/1008

Neue Kommentare abschicken

Please solve the math problem above and type in the result. e.g. for 1+1, type 2
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <p> <a> <em> <b> <i> <u> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <h4> <img> <pre> <blockquote>
  • Lines and paragraphs break automatically.
  • Web and e-mail addresses are automatically converted into links.
More information about formatting options