I have a Ruby on Rails app which runs perfectly in development, but once deployed to production, puma fails to launch. I've been debugging and googling this matter all day, to no avail.
I've tried completely wiping this app off the production server and started over from scratch. Same result.
I've tried different versions of puma -- no difference.
I've tried ordering the Gemfile differently -- no luck.
I've looked up known issues with ckeditor, mini_magick and carrierwave and have not found anything helpful thus far.
The mekilacms gem is a version of Wellspring that I have modified for this project. I have not found anything about Wellspring that appeared to be relevant.
Honestly I'm running out of ideas. Would really appreciate some help on this one.
Here is the puma.error.log which shows the issue I'm getting:
=== 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)
This occurs whether run from Capistrano or from the command line as the deploying user.
This is what scrolls up on the command line:
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...>
Environment: Rails 5.0.1, Ruby 2.4.0rc1 (2016-12-12 trunk 57064) [x86_64-linux], Ubuntu Server 16.04 (both prod and dev -- fully updated) rvm 1.28.0, bundler 1.14.6.
Capistrano Version: 3.8.1 (Rake Version: 12.0.0) is used to perform the deployment to production, which completes without error.
Here is the 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'
Here is the 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 }
Let me know if there is anything else you need to look at...happy to include it in this post.
Thanks for your help! David
In the interest of readability, here is the Asset model. I put it in comments and it looked hard to read...
class Ckeditor::Asset < ActiveRecord::Base
include ActiveRecord
include Ckeditor::Orm::ActiveRecord::AssetBase
include Ckeditor::Backend::CarrierWave
end
Here is the ckeditor_picture_uploader file. It does indeed have the "process" call that puma is complaining about. I'm currently looking at asset paths and asset precompiles...
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
end
Well this is weird, but solved.
The 'process' method that puma has been griping about is normally defined in the uploader/processing.rb file in the carrierwave gem.
I say normally because in mine, it wasn't. Somehow I wound up with a malformed processing.rb file which did not contain 'process' (nor it's evil twin 'process!') as it should have. I've strained my brain over how this happened and can't really account for it.
Nevertheless, grabbing a good copy of the file and replacing my malformed one with it solved the problem.
Seems almost anticlimactic, doesn't it?
Anyhow, onward and I'd like to thank @Md.FarhanMemon and @SachinSingh for their taking the time to respond and ask questions.