簡體   English   中英

puma無法在生產中啟動,引發無法加載應用程序:NoMethodError:#的“ process” <Class:0x000000065f8ee8>

[英]puma fails to launch in production, throws Unable to load application: NoMethodError: `process' for #<Class:0x000000065f8ee8>

我有一個Ruby on Rails應用程序,可以在開發中完美運行,但是一旦部署到生產環境,puma便無法啟動。 我整天都在調試和搜索此事,但無濟於事。

我嘗試從生產服務器上徹底清除該應用程序,然后從頭開始。 結果相同。

我嘗試過不同版本的彪馬-沒什么不同。

我嘗試以不同的方式訂購Gemfile-祝您好運。

我查找了ckeditor,mini_magick和carrierwave的已知問題,到目前為止,沒有發現任何有用的信息。

mekilacms寶石是我為該項目修改的Wellspring版本。 我還沒有發現與Wellspring相關的任何信息。

老實說,我的想法已經用完了。 非常感謝您對此提供的幫助。

這是puma.error.log,其中顯示了我遇到的問題:

=== puma startup: 2017-05-08 17:35:06 -0400 ===
! Unable to load application: NoMethodError: undefined method `process' for #<Class:0x000000065f8ee8>
Did you mean?  proc
bundler: failed to load command: puma (/home/www-data/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bin/puma)

無論是從Capistrano還是從作為部署用戶的命令行運行,都會發生這種情況。

這是在命令行上滾動的內容:

Puma starting in single mode...
* Version 3.6.2 (ruby 2.3.0-p0), codename: Sleepy Sunday Serenity
* Min threads: 4, max threads: 16
* Environment: production
! Unable to load application: NoMethodError: undefined method `process' for #<Class:0x000000065f55b8>
Did you mean?  proc
bundler: failed to load command: puma (/home/www-data/apps/TrueSelfAcademy    /shared/bundle/ruby/2.3.0/bin/puma)
NoMethodError: undefined method `process' for #<Class:0x000000065f55b8>
Did you mean?  proc
/home/www-data/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0 /gems/activerecord-5.0.1/lib/active_record/dynamic_matchers.rb:21:in `method_missing'
/var/www/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bundler/gems/ckeditor-11d3a5b90564/lib/ckeditor/backend/carrierwave.rb:14:in `block in extended'
/var/www/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bundler/gems/ckeditor-11d3a5b90564/lib/ckeditor/backend/carrierwave.rb:13:in `class_eval'
/var/www/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bundler/gems/ckeditor-11d3a5b90564/lib/ckeditor/backend/carrierwave.rb:13:in `extended'
/var/www/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bundler/gems/ckeditor-11d3a5b90564/lib/ckeditor/backend/carrierwave.rb:8:in `extend'
/var/www/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bundler/gems/ckeditor-11d3a5b90564/lib/ckeditor/backend/carrierwave.rb:8:in `included'
/var/www/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bundler/gems/MeKila-CMS-f997bb08ed5d/app/models/mekilacms/asset.rb:4:in `include'
/var/www/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bundler/gems/MeKila-CMS-f997bb08ed5d/app/models/mekilacms/asset.rb:4:in `<class:Asset>'
/var/www/apps/TrueSelfAcademy/shared/bundle/ruby/2.3.0/bundler/gems/MeKila-CMS-f997bb08ed5d/app/models/mekilacms/asset.rb:1:in `<top (required)>'
<...snip...>

環境:Rails 5.0.1,Ruby 2.4.0rc1(2016-12-12 trunk 57064)[x86_64-linux],Ubuntu Server 16.04(prod和dev-均已完全更新)rvm 1.28.0,bundler 1.14.6。

Capistrano版本:3.8.1(Rake版本:12.0.0)用於執行生產部署,該部署完成沒有錯誤。

這是Gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.1'
#use postgresql as the database
gem 'pg'
# Use Puma as the app server
gem 'puma', '3.6.2'  # 3.7.0 has bug which results in no socket being created
# Use SCSS for stylesheets
gem 'sass-rails', '>= 5.0.6'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'therubyracer', platforms: :ruby
# Sprockets
gem 'sprockets', '3.6.3'
# Use Bootstrap for site CSS
gem 'bootstrap-sass'
gem 'twitter-bootswatch-rails'
gem 'twitter-bootswatch-rails-helpers'
gem 'twitter-bootswatch-rails-fontawesome'

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'


gem 'devise'
# gem 'toastr-rails'
gem 'remotipart', github: 'mshibuya/remotipart'
gem 'rails_admin', '>= 1.0.0.rc'
gem 'cancancan'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
  gem 'spring-commands-rspec'
  gem 'database_cleaner'
  gem 'rspec-rails'
  gem 'factory_girl_rails'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '~> 3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  gem 'capistrano',            require: false
  gem 'capistrano-rvm',        require: false
  gem 'capistrano-rails',      require: false
  gem 'capistrano-bundler',    require: false
  gem 'capistrano3-puma',      require: false

end

group :test do
  gem 'capybara'
  gem 'selenium-webdriver'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gembundle
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Capture user's timezone from their browser
gem 'browser-timezone-rails'

gem 'yaml_db'
gem 'rails-html-sanitizer'

# WYSIWYG functionality
gem 'carrierwave'
gem 'mini_magick'
gem 'ckeditor', :git => 'git://github.com/galetahub/ckeditor.git'

# CMS functionality
#gem 'mekilacms', path: '../mekilacms/'
gem 'mekilacms', :git => 'git@maitaikawika.hopto.org:david/MeKila-CMS.git'

這是Capfile:

require 'capistrano/setup'
require 'capistrano/deploy'

require 'capistrano/rails'
require 'capistrano/bundler'
require 'capistrano/rvm'
require 'capistrano/puma'
install_plugin Capistrano::Puma
require 'capistrano/scm/git'
install_plugin Capistrano::SCM::Git

Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

讓我知道您是否還需要查看其他內容...很高興將其包含在這篇文章中。

謝謝你的幫助! 大衛

為了便於閱讀,這里是資產模型。 我把它放在評論中,看起來很難看...

class Ckeditor::Asset < ActiveRecord::Base
  include ActiveRecord
  include Ckeditor::Orm::ActiveRecord::AssetBase
  include Ckeditor::Backend::CarrierWave
end

這是ckeditor_picture_uploader文件。 確實確實有puma抱怨的“過程”調用。 我目前正在查看資產路徑和資產預編譯...

class CkeditorPictureUploader < CarrierWave::Uploader::Base
  include Ckeditor::Backend::CarrierWave
  include CarrierWave::MiniMagick

  storage :file

  def store_dir
    "uploads/ckeditor/pictures/#{model.id}"
  end

  process :extract_dimensions

  version :thumb do
    process resize_to_fill: [118, 100]
  end

 version :content do
  process resize_to_limit: [800, 800]
 end

 def extension_white_list
  Ckeditor.image_file_types
 end

結束

好吧,這很奇怪,但是已經解決了。

puma一直在抓緊的“處理”方法通常是在carrierwave gem中的uploader / processing.rb文件中定義的。

我之所以這樣說,是因為在我的不是。 我以某種方式結束了一個格式不正確的processing.rb文件,該文件不包含應有的“ process”(也不是邪惡的孿生“ process!”)。 我為這種情況的發生而費了腦筋,無法真正解釋它。

不過,獲取一份好的文件副本並用它替換格式錯誤的文件即可解決問題。

似乎幾乎是滑稽的,不是嗎?

無論如何,我要感謝@ Md.FarhanMemon和@SachinSingh抽出寶貴的時間回答並提出問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM