ruby-on-rails - unicorn ,无法重启: "rack and Rack::Builder must be available for processing config.ru"

标签 ruby-on-rails ubuntu capistrano unicorn digital-ocean

我有一个带有 nginx 和 unicorn 的 Ubuntu 14.04 服务器。我已使用 capistrano 将 Rails 应用程序部署到 /home/rails/myapp

当尝试使用 sudo service unicorn restart 重新启动 unicorn 时,我得到以下信息:

* Restarting Unicorn web server unicorn
rack not available, functionality reduced
rack and Rack::Builder must be available for processing config.ru

当我尝试在浏览器中访问该网站时,我从 nginx 收到 502。

这是我的/etc/default/unicorn 文件:

# Change paramentres below to appropriate values and set CONFIGURED to yes.
CONFIGURED=yes

# Default timeout until child process is killed during server upgrade,
# it has *no* relation to option "timeout" in server's config.rb.
TIMEOUT=60

# Path to your web application, sh'ld be also set in server's config.rb,
# option "working_directory". Rack's config.ru is located here.
APP_ROOT=/home/rails/myapp/current

# Server's config.rb, it's not a rack's config.ru
CONFIG_RB=/etc/unicorn.conf

# Where to store PID, sh'ld be also set in server's config.rb, option "pid".
PID=/home/rails/myapp/current/pids/unicorn.pid
RAILS_ENV="production"
UNICORN_OPTS="-D -c $CONFIG_RB -E $RAILS_ENV"

PATH=/usr/local/rvm/rubies/ruby-2.3.0/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:/usr/local/rvm/bin:/usr/local/rvm/gems/ruby-2.3.0@global/bin:/usr/local/rvm/gems/ruby-2.3.0/bin/
export GEM_HOME=/usr/local/rvm/gems/ruby-2.3.0
export GEM_PATH=/usr/local/rvm/gems/ruby-2.3.0:/usr/local/rvm/gems/ruby-2.3.0@global
DAEMON=/usr/local/rvm/gems/ruby-2.3.0/wrappers/unicorn

这是我的/etc/unicorn.conf 文件:

listen "unix:/var/run/unicorn.sock"
worker_processes 4
user "rails"
working_directory "/home/rails/myapp/current"
pid "/var/run/unicorn.pid"
stderr_path "/var/log/unicorn/unicorn.log"
stdout_path "/var/log/unicorn/unicorn.log"

有什么想法吗?我觉得我已经尝试了一切。

最佳答案

在启动 unicorn 之前尝试运行以下命令:

gem install rack

关于ruby-on-rails - unicorn ,无法重启: "rack and Rack::Builder must be available for processing config.ru",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38421958/

相关文章:

ruby-on-rails - Active Admin 和 Sass 错误

jquery - 如何使用从 json 上传的 jquery 文件自定义服务器响应

php - Symfony 3、Php 和 Ubuntu 16 无法上传大文件

php - SSH 隧道 - MySQL 服务器已消失

gwt - 通过命令行编译 GWT

ruby-on-rails - Rails 5 AbstractController::ActionNotFound:在 [GET] 'new' 上找不到 DeviseTokenAuth::RegistrationsController 的操作 "/auth/sign_up"

ruby-on-rails - 从 Rails 5 模型访问 jsonb 列和属性

PHP 5.5 rename() 修改文件并删除权限 - 为什么?

ruby-on-rails - 我可以在没有 SCM 的情况下使用 Capistrano 进行部署吗?

ruby-on-rails - 使用 Capistrano 在 Heroku 上部署?