简体   繁体   中英

Capistrano3 deploy fails after migrating the server

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.rb accordingly along with SSH Credentials)
  • Now cap could 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.rb or staging|production.rb respectively?
  • Do I have to delete existing shared files (eg bundler, tmp, pids etc.) or the current directory when I am on a new environment?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM