问题
I am using Capistrano 3. In the past I could successfully deploy to my server.
Now the server migrated and has new parameters:
- SSH Access (I updated SSH credentials and made sure that I can connect without password using
authorized_keys) - Deploy Dir (I updated
staging.rbaccordingly along with SSH Credentials) - Now
capcould connect to my new server so the Auth seemed fine.
Problems with current directory
However, I got an Error when using cap staging deploy:
SSHKit::Command::Failed: if test ! -d /var/www/my-project/subdomains/dev/current; then echo "Directory does not exist '/var/www/my-project/subdomains/dev/current'" 1>&2; false; fi exit status: 1
I checked and the curiously the current directory was still there (migrated along with the rest). I deleted the current directory because this will be created on the deploy (I thought then).
On the next deploy I got the same error. So I did some googling and I ended up adding the following hook:
# Had to insert this hook after migrating the server
# Maybe this can be removed after the first successful deployment
after 'deploy:set_current_revision', 'deploy:symlink:release'
I think this is not a very clean approach but from then on the current directory was created and I got a little farther with cap staging deploy.
Now whenever I setup Capistrano I am amazed how painless it works but now since I have moved to another server I keep running into issues.
I wonder:
- Is there a new way to configure the environment in
deploy.rborstaging|production.rbrespectively? - Do I have to delete existing shared files (e.g. bundler, tmp, pids etc.) or the current directory when I am on a new environment?
回答1:
I managed to fix my deploy and I am not sure which of the steps I took were really required. I documented the solution in this SO Post: Bundler in deployment mode does not find Gems
来源:https://stackoverflow.com/questions/26146080/capistrano3-deploy-fails-after-migrating-the-server