【问题标题】:Capistrano rails deploy failed upgrading to rails 5.1.5, still set current to failed deployCapistrano rails deploy 升级到 rails 5.1.5 失败,仍将当前设置为失败部署
【发布时间】:2018-11-12 14:32:14
【问题描述】:

我决定将 Rails 应用程序从 5.0.1 升级到 5.1.5。这包括从 Zurb 基金会从 6.2.3 升级到 6.4.x,这样我就可以开始覆盖到 grix-xy。

我有两个 Rails 应用程序部署到 Debian 机器上。一个是本地盒子,它是一个自定义应用程序,用于管理 VFW(对外战争退伍军人)职位。几个月前我在那个盒子上做了同样的升级,只有小问题。没有 yarn 和 node.js 似乎是问题之一,但已经持续了几个月。另一个部署到 Digital Oceans 虚拟服务器。这是我被卡住的那个。

我的过程是

  • 添加并签出一个 rails5.1 分支
  • 为新的导轨和基础导轨更改 gemfile
  • 使用 rails app:update 更新系统内容
  • 是否有任何新的生成安装
  • 清理视图以使用较新版本的基础
  • 测试了我在开发中的能力
  • 将 rails5.1 分支合并到 master 并将更改提交到我的 repo
  • 尝试使用 Capistrano 进行部署 - 卡住了

我担心 SECRETS,但我的方法适用于 VFW 应用程序(使用 rbenv-vars 设置机密)。我做了一个上限生产部署,开始了我的问题之旅。

我得到了纱线错误

 DEBUG [27ff41fe] Command: cd /home/deploy/apps/pt_golfer/releases/20181111214738 && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" RAILS_ENV="production" RAILS_GROUPS="" ; RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.3.1 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile )
 DEBUG [fee53ebb]   Yarn executable was not detected in the system.
 DEBUG [fee53ebb]   
 DEBUG [fee53ebb]   Download Yarn at https://yarnpkg.com/en/docs/install
 DEBUG [fee53ebb]   
 DEBUG [fee53ebb]   I, [2018-11-11T16:37:28.513883 #11920]  INFO -- : Writing /home/deploy/apps/pt_golfer/releases/20181111214738/public/assets/application-683e0728d4efb1932c42933c1d3e66430959c9f4575bf91d83518c647597847f.js
 DEBUG [fee53ebb]   I, [2018-11-11T16:37:28.514512 #11920]  INFO -- : Writing /home/deploy/apps/pt_golfer/releases/20181111214738/public/assets/application-683e0728d4efb1932c42933c1d3e66430959c9f4575bf91d83518c647597847f.js.gz
 DEBUG [fee53ebb]   I, [2018-11-11T16:37:28.516684 #11920]  INFO -- : Writing /home/deploy/apps/pt_golfer/releases/20181111214738/public/assets/application.js-d85e0f2634e381cd64bda8c1bc5a6097e295cbdbbd7ef0880e0016d19cfa6e35.copy
 DEBUG [fee53ebb]   I, [2018-11-11T16:37:28.519517 #11920]  INFO -- : Writing /home/deploy/apps/pt_golfer/releases/20181111214738/public/assets/_settings.scss-b317c61809f397c15bef60771da1f85f01f265fa195aabb8dc44da529c36319c.copy
 DEBUG [fee53ebb]   rake aborted!
Autoprefixer doesn’t support Node v0.10.29. Update it.

但部署仍在继续,我相当确定它将“当前”链接设置为失败的部署 然后我在 DO 虚拟服务器上安装了 yarn 并尝试再次部署。

这次似乎完成了部署,但在 unicorn:restart 任务中失败了

 INFO [3dfc7929] Running RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.3.1 $HOME/.rbenv/bin/rbenv exec bundle exec unicorn -c /home/deploy/apps/pt_golfer/current/config/unicorn.rb -E production -D as deploy@my.do.ip.238
DEBUG [3dfc7929] Command: cd /home/deploy/apps/pt_golfer/current && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.3.1" ; RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.3.1 $HOME/.rbenv/bin/rbenv exec bundle exec unicorn -c /home/deploy/apps/pt_golfer/current/config/unicorn.rb -E production -D )
DEBUG [355f81af]  master failed to start, check stderr log for details

在我的终端上我确实看到了以下错误

(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@@my.do.ip.238: cat /home/deploy/apps/pt_golfer/shared/tmp/pids/unicorn.pid.oldbin exit status: 1
cat /home/deploy/apps/pt_golfer/shared/tmp/pids/unicorn.pid.oldbin stdout: Nothing written
cat /home/deploy/apps/pt_golfer/shared/tmp/pids/unicorn.pid.oldbin stderr: cat: /home/deploy/apps/pt_golfer/shared/tmp/pids/unicorn.pid.oldbin: No such file or directory

此时 unicorn 仍在运行旧版本。我走上了一条通往更多失败的道路。

我尝试了一个上限生产独角兽:硬重启。这杀死了旧版本但没有启动新服务器

发现我在一些我不理解的事情上失败了,我做了一个上限生产回滚。失败并出现错误“找不到 Rails 资产清单文件(或备份文件)”

查看我的部署结构“当前”指向上次失败的部署版本(有两个)。然后我跳过鲨鱼并将当前链接到最后一个好版本(rails 5.0.x)并启动独角兽。它提出了旧的红宝石,但新的 css!它是可行的,幸运的是我没有做太多的 css 更改,我的顶栏被基础 css 的更改搞砸了,但功能齐全。

我的问题是我从这里去哪里?我可以尝试恢复我的登台服务器,但这可能需要几天时间。我想我也可以尝试以某种方式将登台放在我的 DO 虚拟主机上。

如果我是 git 专家,我确​​信这是一种回退到我最后一次良好提交的方法,但仍然保留 rails5.1 分支,直到我弄清楚出了什么问题。

我的下一条路径,因为我知道我可以调出旧版本,它试图找出独角兽失败错误是什么。猜猜做一个捆绑执行独角兽应该把 Capistrano 排除在外。

【问题讨论】:

    标签: ruby-on-rails git capistrano


    【解决方案1】:

    Capistrano 错误并不清楚从哪里找出错误所在。

    由于我没有得到任何关于在哪里查看的建议,我切换回当前的新版本并尝试使用service unicorn start 启动它,但得到了一个我可以遵循的错误。

    Nov 13 04:19:36 stevealex systemd[1]: Starting LSB: starts the unicorn app server...
    Nov 13 04:19:41 stevealex unicorn_ptgolf[28314]: master failed to start, check stderr log for details
    Nov 13 04:19:41 stevealex systemd[1]: unicorn_ptgolf.service: control process exited, code=exited status=1
    Nov 13 04:19:41 stevealex systemd[1]: Failed to start LSB: starts the unicorn app server.
    Nov 13 04:19:41 stevealex systemd[1]: Unit unicorn_ptgolf.service entered failed state.
    

    这最终将我指向了 unicorn.stderr.log(如果您已经有几年没有遇到部署问题,那么您有点忘记了这些东西!)。我在那里找到了:

    NoMethodError: undefined method `skip_before_filter' for SaController:Class
    Did you mean?  skip_before_action
    

    然后我想起来这是从5.0升级到5.1要检查的项目之一。

    解决了这个问题,我可以开始跑步了。

    我猜我这个晦涩的问题的答案是:“检查所有系统日志,你最终会发现一个意味着什么的错误”

    【讨论】:

      猜你喜欢
      • 2012-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-31
      • 2012-09-04
      • 1970-01-01
      • 2021-06-10
      • 1970-01-01
      相关资源
      最近更新 更多