Question

I'm upgrading from Capistrano 2 to Capistrano 3 and everything seems to be running successfully except i'm seeing these 2 fail when it runs:

DEBUG [bbfe01ec] Running /usr/bin/env [ -L /var/www/myapp/releases/20140211033611/public/assets ] on myapp.com
DEBUG [bbfe01ec] Command: [ -L /var/www/myapp/releases/20140211033611/public/assets ]
DEBUG [bbfe01ec] Finished in 0.146 seconds with exit status 1 (failed).
DEBUG [26f99b11] Running /usr/bin/env [ -d /var/www/myapp/releases/20140211033611/public/assets ] on myapp.com
DEBUG [26f99b11] Command: [ -d /var/www/myapp/releases/20140211033611/public/assets ]
DEBUG [26f99b11] Finished in 0.141 seconds with exit status 1 (failed).

Why are these failing and how can I fix them?

Was it helpful?

Solution

I have the same issue and here is capistrano code, implementing when you receive these errors:

desc 'Symlink linked directories'
  task :linked_dirs do
    next unless any? :linked_dirs
    on release_roles :all do
      execute :mkdir, '-pv', linked_dir_parents(release_path)

      fetch(:linked_dirs).each do |dir|
        target = release_path.join(dir)
        source = shared_path.join(dir)
        unless test "[ -L #{target} ]"
          if test "[ -d #{target} ]"
            execute :rm, '-rf', target
          end
          execute :ln, '-s', source, target
        end
      end
    end
  end

As I can understand here is using command ln for creating symlinks.

Reading manual about ln (man ln) we understand, that the command will probably fail due to system restrictions, when trying to make hard link directories.

-d, -F, --directory
  allow the superuser to attempt to hard link directories (note: will probably fail 
  due to system restrictions, even for the superuser)

'ln -d' failing to create hard link and that's why executing 'ln -s' in order to create symlink(symbolic link instead of hard link).

So, no worries about this fail. If you would like to avoid it just change your deploy options like this:

set :format, :pretty
set :log_level, :info
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top