Capistrano3 deploy fails after migrating the server

狂风中的少年 提交于 2019-12-14 03:07:14

问题


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 (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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!