【发布时间】:2018-02-04 00:50:22
【问题描述】:
由于我无法控制的原因,我需要在 CentOS 7 上运行 Rails 4 应用程序。目前,它在具有 rvm 和 Passenger 的 Red Hat 上成功运行。我想将它迁移到 rbenv 和 Puma,但我遇到了这个问题。
我正在尝试在 VirtualBox 虚拟机上运行测试安装。我相信我已经正确地将所有东西连接在一起。我已禁用 SELinux。当我运行cap deploy 时,puma 启动成功:
04:03 puma:start
using conf file /var/www/rails-app/shared/puma.rb
01 bundle exec puma -C /var/www/rails-app/shared/puma.rb --daemon
01 * Pruning Bundler environment
01 [6464] Puma starting in cluster mode...
01 [6464] * Version 3.9.1 (ruby 2.1.10-p492), codename: Private Caller
01 [6464] * Min threads: 4, max threads: 16
01 [6464] * Environment: vm
01 [6464] * Process workers: 1
01 [6464] * Phased restart available
01 [6464] * Listening on unix:///var/www/rails-app/shared/tmp/sockets/puma.sock
01 [6464] * Daemonizing...
✔ 01 deploy@localhost 0.537s
但是 Puma 访问日志在无限循环中旋转出这个错误:
/home/deploy/.rbenv/versions/2.1.10/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- bundler/setup (LoadError)
... stack trace clipped ...
列出与我的 Puma 用户显示相关的进程:
$ ps aux | grep deploy
deploy 12645 0.0 0.2 115384 2084 pts/0 S 18:18 0:00 -bash
deploy 18517 0.7 1.7 271344 18076 ? Sl 18:27 0:00 puma 3.9.1 (unix:///var/www/rails-app/shared/tmp/sockets/puma.sock)
deploy 23279 7.0 0.0 0 0 ? Z 18:29 0:00 [ruby] <defunct>
deploy 23283 4.0 1.7 273400 17464 ? Rl 18:29 0:00 puma: cluster worker 0: 18517
我已确认我可以以拥有 Rails 应用程序和 Puma 进程的deploy 用户身份成功运行 Bundler:
cd /var/www/rails-app/current && bundler --version
Bundler version 1.15.4
所以我不确定为什么会看到这个错误。经过数小时的研究和故障排除后,我陷入了困境。如果需要,我可以提供配置文件,但它们非常标准,我认为此时只会混淆这个问题。
这个问题对任何人来说都很熟悉吗?
【问题讨论】:
-
你的问题好像和这个stackoverflow.com/questions/19061774/…类似
-
如果您使用的是 RVM stackoverflow.com/questions/32670779/…
标签: ruby-on-rails centos rbenv puma