Capistrano将代码部署到服务器15分钟以上

时间:2014-12-18 00:34:57

标签: ruby-on-rails ruby ubuntu deployment capistrano

我在向生产服务器部署代码时遇到了Capistrano的问题。我跑的时候

cap production deploy

该命令最多需要20分钟。

可能是什么问题?我还有一个临时服务器,部署过程大约需要90-120秒。登台服务器是从生产服务器的快照创建的。

为什么部署需要这么多时间?我应该从哪里开始寻找问题?

编辑:在我入睡之前,我运行了cap production deploy命令,7个小时之后,只有以下内容:

    triggering load callbacks
  * 2014-12-18 01:04:22 executing `production'
    triggering start callbacks for `deploy'
  * 2014-12-18 01:04:22 executing `multistage:ensure'
  * 2014-12-18 01:04:22 executing `deploy'
    triggering before callbacks for `deploy'
  * 2014-12-18 01:04:22 executing `deploy:check_revision'
  * 2014-12-18 01:04:23 executing `deploy:update'
 ** transaction: start
  * 2014-12-18 01:04:23 executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@bitbucket.org:name/project.git master"
    command finished in 2906ms
  * executing "if [ -d /home/deployer/apps/project-production/shared/cached-copy ]; then cd /home/deployer/apps/project-production/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 18138753b77ec5b2a25c292536a512c1d7851448 && git clean -q -d -x -f; else git clone -q -b master git@bitbucket.org:name/project.git /home/deployer/apps/project-production/shared/cached-copy && cd /home/deployer/apps/project-production/shared/cached-copy && git checkout -q -b deploy 18138753b77ec5b2a25c292536a512c1d7851448; fi"
    servers: ["IP"]
Password:
    [IP] executing command
    command finished in 32534ms
    copying the cached version to /home/deployer/apps/project-production/releases/20141218000536
  * executing "cp -RPp /home/deployer/apps/project-production/shared/cached-copy /home/deployer/apps/project-production/releases/20141218000536 && (echo 18138753b77ec5b2a25c292536a512c1d7851448 > /home/deployer/apps/project-production/releases/20141218000536/REVISION)"
    servers: ["IP"]
    [IP] executing command
    command finished in 1254ms
  * 2014-12-18 01:05:37 executing `deploy:finalize_update'
    triggering before callbacks for `deploy:finalize_update'
  * 2014-12-18 01:05:37 executing `bundle:install'
  * executing "cd /home/deployer/apps/project-production/releases/20141218000536 && bundle install --gemfile /home/deployer/apps/project-production/releases/20141218000536/Gemfile --path /home/deployer/apps/project-production/shared/bundle --quiet --no-cache --without development test"
    servers: ["IP"]
    [IP] executing command
^C*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deployer/apps/project-production/releases/20141218000536; true"
    servers: ["IP"]
 ** [deploy:update_code] exception while rolling back: Errno::ECONNRESET, Connection reset by peer - recvfrom(2)

7个小时后,我取消了它。试图再次运行它。

EDIT2:我刚刚重新运行cap production deploy并且现在已成功部署,但部署过程需要10分钟。

我不知道如何处理这个问题 - 我应该从哪里开始寻找缓慢部署的问题?

0 个答案:

没有答案