Capistrano3部署失败

Capistrano3部署失败

本文介绍了迁移服务器后,Capistrano3部署失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



现在服务器已迁移并且有新的参数:




  • SSH访问(我更新了SSH凭据并确保我可以使用 authorized_keys 无密码连接) li>
  • 部署Dir(我相应地与SSH凭据一起更新了 staging.rb )
  • 现在 cap 可以连接到我的新服务器,所以Auth显得很好。


code> current directory



然而,当使用 cap staging deploy $ b $ pre $ SSHKit :: Command :: Failed:if test! -d / var / www / my-project / subdomains / dev / current;然后回显目录不存在/ var / www / my-project / subdomains / dev / current'1& 2;假; fi退出状态:1

我检查了 current 目录仍然存在(与其他一起迁移)。我删除了 current 目录,因为它将在deploy上创建(我想那时)。

在下一个部署我得到了同样的错误。所以我做了一些搜索,最后添加了下面的钩子:

 #必须在迁移服务器$ b后插入这个钩子$ b#也许这可以在第一次成功部署之后被移除
'deploy:set_current_revision','deploy:symlink:release'

我认为这不是一个非常干净的方法,但是从那时起 current 目录被创建,并且我得到了更远一点的 cap staging deploy 。



现在每当我设置Capistrano时,我都感到很惊讶,我不知道:


  • 有没有分别在 deploy.rb 或 staging | production.rb 中配置环境的新方法

  • 当我处于新环境中时,是否必须删除现有共享文件(例如bundler,tmp,pids等)或当前目录?


解决方案

我设法解决了我的部署问题,但我不确定我采取的哪些步骤是真正需要的。
我在此SO文件中记录了解决方案:部署中的Bundler


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?

解决方案

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

这篇关于迁移服务器后,Capistrano3部署失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 20:19