我有一個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
末
在整個應用程序中搜索'process',你找到了多少?當然有一個流浪的人躺在.. –
添加'資產'模型的代碼。 –
@ Md.FarhanMemon正好有3個不在註釋中,所有3個都在一個名爲ckeditor_picture_uploader.rb的文件中。我在github的ckeditor gem頁面上查看了那裏記錄的問題。有趣的是,在生產中部署這個gem有很多問題,但到目前爲止他們所提供的修復都沒有解決我的問題。 –