2017-05-09 21 views
0

我有一个Ruby on Rails应用程序,它在开发过程中运行完美,但一旦部署到生产,美洲狮失败发射。我一直在调试和搜索这个问题整天,没有用。美洲狮无法在生产中启动,抛出无法加载应用程序:NoMethodError:`进程'为#<Class:0x000000065f8ee8>

我试过完全擦拭生产服务器的这个应用程序,并从头开始。同样的结果。

我试过不同版本的美洲狮 - 没有区别。

我试着订购不同的Gemfile - 没有运气。

我查了一下ckeditor,mini_magick和carrierwave的已知问题,到目前为止还没有找到有用的东西。

mekilacms宝石是我为这个项目修改的一个版本。我还没有发现任何有关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, 红宝石2.4.0rc1(2016年12月12日躯干57064)[x86_64的Linux的], Ubuntu服务器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 => '[email protected]: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 } 

让我知道是否有其他任何你需要看看......高兴把它列入本帖子。

感谢您的帮助! David

为了便于阅读,这里是Asset模型。我把它写在评论中,它看起来很难看...

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

这是ckeditor_picture_uploader文件。它确实有美洲狮所抱怨的“进程”呼叫。我目前正在查看资产路径和资产预编译...

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 

+0

在整个应用程序中搜索'process',你找到了多少?当然有一个流浪的人躺在.. –

+0

添加'资产'模型的代码。 –

+0

@ Md.FarhanMemon正好有3个不在注释中,所有3个都在一个名为ckeditor_picture_uploader.rb的文件中。我在github的ckeditor gem页面上查看了那里记录的问题。有趣的是,在生产中部署这个gem有很多问题,但到目前为止他们所提供的修复都没有解决我的问题。 –

回答

0

嗯,这是不可思议的,但解决。

puma一直在持续的'process'方法通常在carrierwave gem的uploader/processing.rb文件中定义。

我说通常是因为在我的,它不是。不知何故,我最终得到了一个格式不正确的processing.rb文件,它不包含'process'(也不是它的邪恶孪生过程!)。我对于这件事发生的事情感到紧张,并不能真正解释它。

尽管如此,抓住文件的好副本,并用它取代我的畸形的文件解决了问题。

似乎几乎是反胃,不是吗?

无论如何,我还要感谢@ Md.FarhanMemon和@SachinSingh花时间回复并提出问题。

相关问题