Jump to content

The ultimate community for Ruby on Rails developers.


Capistano getting timestamps wrong when creating 'current' symlink.

  • Please log in to reply
2 replies to this topic

#1 Kelli Shaver

Kelli Shaver


  • Administrators
  • 76 posts
  • LocationKentucky

Posted 14 August 2013 - 07:22 PM

Maybe someone here can help me with this.


I'm having a problem of Capistrano getting the timestamp wrong (and thus pointing to the wrong release) after deployment when creating the 'current' symlink. 


I've tried setting normalize_asset_timestamps to false (which is the default these days, I believe), and also tried setting it to true. I've tried a few other things, as well (e.g. a custom method to re-create the symlink) and nothing seems to work. 


Here's my deploy.rb file... It's about as simple as it gets.

set :application, "MyApp"
set :repository, "git@github.com:kellishaver/MyApp.git"
set :scm, :git

default_run_options[:pty] = true
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "id_rsa")]
set :user, "deploy"
server "IP_ADDRESS", :app, :web, :db, :primary => true
set :branch, "master"
set :deploy_to, "/home/deploy/MyApp"
set :repository_cache, "git_cache"
set :deploy_via, :remote_cache
set :ssh_options, {:forward_agent => true}
set :use_sudo, false

after "deploy:restart", "deploy:cleanup"

namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"

Capistrano version 2.15.4

#2 Adam



  • Administrators
  • 87 posts

Posted 14 August 2013 - 07:47 PM

That's rather odd. I've never seen that happen before. Is the timestamp used for the symlinking the time when it starts to create the symlink?


Can you post the full output from running a cap deploy?

Adam Cooke

from aTech Media - UK-based Ruby on Rails developers. 


Follow me on Twitter  •  Check out my code on GitHub  •  Take a look at my designs

#3 Kelli Shaver

Kelli Shaver


  • Administrators
  • 76 posts
  • LocationKentucky

Posted 14 August 2013 - 08:34 PM   Best Answer

OK, I may have jumped the gun a bit in posting this, but hopefully it will be helpful to someone else. I had this problem repeatedly a couple of weeks ago, hence the reason I posted. Thinking about it more in trying to reproduce it just now, I see that it only happens when I precompile assets before deploy.


So I think I was running into this: https://github.com/c...rano/issues/440


Moving load 'deploy/assets' to the bottom of my Capfile seems to have resolved it, but that still doesn't make a whole lot of sense to me, because where it's defined shouldn't matter. It's where it's called that counts and in the recipe it's defined as before 'deploy:assets:precompile', 'deploy:assets:update_asset_mtimes'



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users