Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

failed to create symbolic link #109

Open
kristophM opened this issue Sep 9, 2016 · 1 comment
Open

failed to create symbolic link #109

kristophM opened this issue Sep 9, 2016 · 1 comment

Comments

@kristophM
Copy link

Hello, I have a Capistrano set up with the below configuration in my Capfile. When doing a cap staging deploy things normally work fine. However, upon implementing Capistrano-Resque, I receive an error: "failed to create symbolic link".

Here is my Capfile:

# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'


require 'capistrano/rbenv'
require 'capistrano/bundler'
require 'capistrano/rails/console'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

require 'capistrano/unicorn_nginx'
require 'capistrano/postgresql'
require 'capistrano-db-tasks'

require 'capistrano-resque'
require 'capistrano/clockwork'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

(I'm using Capistrano 3.6.1, and Capistrano-Resque 0.2.2 with require: false, as prescribed)

The backtrace of the error is as follows. Does anyone know what's going on here?

00:11 deploy:symlink:linked_files
      01 mkdir -p /home/deploy/apps/myapp_staging/releases/20160909140832/config
    ✔ 01 deploy@ec2-xxxxx.us-west-2.compute.amazonaws.com 0.237s
    ✔ 01 deploy@staging.myapp.com 0.238s
      02 ln -s /home/deploy/apps/myapp_staging/shared/config/secrets.yml /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml
    ✔ 02 deploy@staging.myapp.com 0.296s
      02 ln: failed to create symbolic link ‘/home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml’
      02 : File exists
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@ec2-xxx.us-west-2.compute.amazonaws.com: ln exit status: 1
ln stdout: Nothing written
ln stderr: ln: failed to create symbolic link ‘/home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml’: File exists

SSHKit::Command::Failed: ln exit status: 1
ln stdout: Nothing written
ln stderr: ln: failed to create symbolic link ‘/home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml’: File exists

Tasks: TOP => deploy:symlink:linked_files
(See full trace by running task with --trace)
The deploy has failed with an error: Exception while executing as deploy@ec2-xxx.us-west-2.compute.amazonaws.com: ln exit status: 1
ln stdout: Nothing written
ln stderr: ln: failed to create symbolic link ‘/home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml’: File exists

** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:

  INFO [b89a83c7] Finished in 0.238 seconds with exit status 0 (successful).
 DEBUG [ab33b1bd] Running [ -L /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml ] as deploy@staging.myapp.com
 DEBUG [ab33b1bd] Command: [ -L /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml ]
 DEBUG [7d27abbf] Finished in 0.267 seconds with exit status 1 (failed).
 DEBUG [8da38f89] Running [ -f /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml ] as deploy@ec2-xxx.us-west-2.compute.amazonaws.com
 DEBUG [8da38f89] Command: [ -f /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml ]
 DEBUG [ab33b1bd] Finished in 0.267 seconds with exit status 1 (failed).
 DEBUG [2a2c0ce7] Running [ -f /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml ] as deploy@staging.myapp.com
 DEBUG [2a2c0ce7] Command: [ -f /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml ]
 DEBUG [8da38f89] Finished in 0.245 seconds with exit status 1 (failed).
  INFO [7a175e21] Running /usr/bin/env ln -s /home/deploy/apps/myapp_staging/shared/config/secrets.yml /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml as deploy…
 DEBUG [7a175e21] Command: ( export RBENV_ROOT="/home/deploy/.rbenv" RBENV_VERSION="2.2.4" ; /usr/bin/env ln -s /home/deploy/apps/myapp_staging/shared/config/secrets.yml /home/deploy/apps/…
 DEBUG [2a2c0ce7] Finished in 0.245 seconds with exit status 1 (failed).
  INFO [00c3b638] Running /usr/bin/env ln -s /home/deploy/apps/myapp_staging/shared/config/secrets.yml /home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml as deploy…
 DEBUG [00c3b638] Command: ( export RBENV_ROOT="/home/deploy/.rbenv" RBENV_VERSION="2.2.4" ; /usr/bin/env ln -s /home/deploy/apps/myapp_staging/shared/config/secrets.yml /home/deploy/apps/…
  INFO [00c3b638] Finished in 0.296 seconds with exit status 0 (successful).
 DEBUG [3410bee8] Running [ -L /home/deploy/apps/myapp_staging/releases/20160909140832/config/sunspot.yml ] as deploy@staging.myapp.com
 DEBUG [3410bee8] Command: [ -L /home/deploy/apps/myapp_staging/releases/20160909140832/config/sunspot.yml ]
 DEBUG [7a175e21]       ln: failed to create symbolic link ‘/home/deploy/apps/myapp_staging/releases/20160909140832/config/secrets.yml’
 DEBUG [7a175e21]       : File exists
@dmarkow
Copy link
Collaborator

dmarkow commented Sep 9, 2016

It can't create the link because secrets.yml already exists where you're trying to create the link (i.e. in order for the link from shared to your current release to work, there can't be a secrets.yml file already sitting in config/ in your release).

Most likely, you'll just need to remove secrets.yml from your git repo so it's not there when you push/deploy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants