Sinatra on heroku production tries to load development gems - heroku

Trying to learn Sinatra I just deployed a simple app to heroku.
My config file:
require './main'
require 'sinatra'
run Sinatra::Application
Gemfile:
source 'http://rubygems.org'
ruby '1.9.3'
gem 'sinatra'
gem 'slim'
gem 'sass'
gem 'dm-core'
gem 'dm-migrations'
gem 'thin'
gem 'pg', :group => :production
gem 'dm-postgres-adapter', :group => :production
gem 'dm-sqlite-adapter', :group => :development
I get following error in the logs:
2015-03-31T09:13:54.051645+00:00 heroku[web.1]: State changed from crashed to starting
2015-03-31T09:13:57.281158+00:00 heroku[web.1]: Starting process with command `bundle exec ruby main.rb -p 28463`
2015-03-31T09:13:59.598142+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `require': cannot load such file -- dm-sqlite-adapter (LoadError)
2015-03-31T09:13:59.598161+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:163:in `load_adapter'
2015-03-31T09:13:59.598164+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:133:in `adapter_class'
2015-03-31T09:13:59.598165+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core/adapters.rb:13:in `new'
2015-03-31T09:13:59.598167+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.1/lib/dm-core.rb:230:in `setup'
2015-03-31T09:13:59.598169+00:00 app[web.1]: from /app/song.rb:5:in `block in <top (required)>'
2015-03-31T09:13:59.598171+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1410:in `configure'
2015-03-31T09:13:59.598172+00:00 app[web.1]: from /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.4.6/lib/sinatra/base.rb:1989:in `block (2 levels) in delegate'
2015-03-31T09:13:59.598174+00:00 app[web.1]: from /app/song.rb:4:in `<top (required)>'
2015-03-31T09:13:59.598178+00:00 app[web.1]: from main.rb:6:in `require'
2015-03-31T09:13:59.598187+00:00 app[web.1]: from main.rb:6:in `<main>'
2015-03-31T09:14:00.479331+00:00 heroku[web.1]: State changed from starting to crashed
2015-03-31T09:14:00.461548+00:00 heroku[web.1]: Process exited with status 1
I tried the solution proposed here but it did not work.
Thanks in advance for ideas

I think you need datamapper in your Gemfile.
gem "datamapper"

Related

Passenger throwing error for Sinatra app on Amazon EC2

I am trying to start Passenger with a Sinatra app on an Amazon EC2 instance and I get the following error:
$ passenger start -e production
=============== Phusion Passenger Standalone web server started ===============
PID file: /home/ec2-user/github/mainpage/tmp/pids/passenger.3000.pid
Log file: /home/ec2-user/github/mainpage/log/passenger.3000.log
Environment: production
Accessible via: http://0.0.0.0:3000/
You can stop Phusion Passenger Standalone by pressing Ctrl-C.
Problems? Check https://www.phusionpassenger.com/documentation/Users%20guide%20Standalone.html#troubleshooting
===============================================================================
App 29028 stdout:
App 29028 stdout:
[ 2015-01-20 05:16:52.8259 28997/7fb5c6463700 Pool2/Implementation.cpp:287 ]: Could not spawn process for application /home/ec2-user/github/mainpage: An error occured while starting up the preloader.
Error ID: 0ad6d346
Error details saved to: /tmp/passenger-error-911MCI.html
Message from application: cannot load such file -- json (LoadError)
/home/ec2-user/.gem/ruby/2.0/gems/mime-types-2.4.3/lib/mime/type.rb:4:in `require'
/home/ec2-user/.gem/ruby/2.0/gems/mime-types-2.4.3/lib/mime/type.rb:4:in `<top (required)>'
/home/ec2-user/.gem/ruby/2.0/gems/mime-types-2.4.3/lib/mime/types.rb:3:in `require'
/home/ec2-user/.gem/ruby/2.0/gems/mime-types-2.4.3/lib/mime/types.rb:3:in `<top (required)>'
/home/ec2-user/.gem/ruby/2.0/gems/mail-2.6.3/lib/mail.rb:9:in `require'
/home/ec2-user/.gem/ruby/2.0/gems/mail-2.6.3/lib/mail.rb:9:in `<module:Mail>'
/home/ec2-user/.gem/ruby/2.0/gems/mail-2.6.3/lib/mail.rb:2:in `<top (required)>'
/home/ec2-user/.gem/ruby/2.0/gems/pony-1.11/lib/pony.rb:1:in `require'
/home/ec2-user/.gem/ruby/2.0/gems/pony-1.11/lib/pony.rb:1:in `<top (required)>'
/home/ec2-user/github/mainpage/app.rb:9:in `require'
/home/ec2-user/github/mainpage/app.rb:9:in `<top (required)>'
config.ru:1:in `require'
config.ru:1:in `block in <main>'
/home/ec2-user/.gem/ruby/2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `instance_eval'
/home/ec2-user/.gem/ruby/2.0/gems/rack-1.6.0/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:112:in `eval'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:112:in `preload_app'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:158:in `<module:App>'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
/home/ec2-user/.gem/ruby/2.0/gems/passenger-4.0.57/helper-scripts/rack-preloader.rb:28:in `<main>'
[ 2015-01-20 05:16:52.8332 28997/7fb5bffff700 agents/HelperAgent/RequestHandler.h:2306 ]: [Client 20] Cannot checkout session because a spawning error occurred. The identifier of the error is 0ad6d346. Please see earlier logs for details about the error.
Here is my config.ru file:
require './app'
run Sinatra::Application
and my gem file:
source 'https://rubygems.org'
source 'https://rubygems.org'
gem 'sinatra'
gem 'nokogiri'
gem 'pony'
gem 'passenger'
Is the error related to json? I tried installing the json gem but I still get this error. Any help would be appreciated.
Thank you.
I was able to finally get it working....
I had to manually add gem 'json' into my Gemfile and then did bundle install. After reading the errors, I figured that it had something to do with the pony gem. I am guessing that there was a dependency for pony (json gem) that was not being picked up by the bundler.

Rake task not working with postgresql and sinatra-activerecord

I was trying to setup facebook app locally, using ruby and sinatra, in Kubuntu 12.04.
I have included following gems in my gemfile. I have postgresql installed in my system and I am able to run the postgresql command line and run basic commands as createdb, create table etc.
gem "sinatra"
gem "koala"
gem "json", "1.5.5"
gem "httparty"
gem "thin"
gem "rack", "1.3.10"
gem "pg"
gem "activerecord"
gem "sinatra-activerecord"
And in my app.rb file added these files,
require "rubygems"
require "sinatra"
require "sinatra/activerecord"
require "koala"
require "./config/environment" #database configuration
Running
rake -T
in my terminal gives me the following error.
rake aborted!
(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:39:in `database_file='
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1033:in `set'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:50:in `registered'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1317:in `block in register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `each'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1315:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1648:in `register'
/var/lib/gems/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1688:in `register'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:76:in `<module:Sinatra>'
/var/lib/gems/1.9.1/gems/sinatra-activerecord-1.2.2/lib/sinatra/activerecord.rb:6:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/app.rb:3:in `<top (required)>'
/home/nitin/facebook_app/guarded-gorge-3234/Rakefile:1:in `<top (required)>'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/var/lib/gems/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
Could any one please help. Thank you.
As #iain mentioned, this is due to a parse error in your config/database.yml file.
Check that it is valid syntax, and replace any tabs with spaces.

Redmine Installation with activerecord-mysql-adapter

I'm working on a CentOS 6.3 Linux server with the Ruby version: 1.8.7 and the Gem version: 1.8.25
I'm trying to run the command: ruby script/rails server webrick -e production
It spits out this error:
=> Booting WEBrick
=> Rails 3.2.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib64/ruby/gems/1.8/gems/bundler-1.2.3/lib/bundler/rubygems_integration.rb:157:in `gem': Please install the mysql adapter: `gem install activerecord-mysql-adapter` (can't activate mysql (~> 2.8.1), already activated mysql-2.9.0. Make sure all dependencies are added to Gemfile.) (LoadError)
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql_adapter.rb:5
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:41:in `resolve_string_connection'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/railtie.rb:82
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:43:in `run_load_hooks'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `each'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/base.rb:721
from /var/www/redmine/lib/plugins/acts_as_activity_provider/init.rb:2
from /var/www/redmine/config/initializers/00-core_plugins.rb:12
from /var/www/redmine/config/initializers/00-core_plugins.rb:2:in `each'
from /var/www/redmine/config/initializers/00-core_plugins.rb:2
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:245:in `load'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:588
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:587
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /var/www/redmine/config/environment.rb:14
from /var/www/redmine/config.ru:4:in `require'
from /var/www/redmine/config.ru:4
from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize'
from /var/www/redmine/config.ru:1:in `new'
from /var/www/redmine/config.ru:1
This is my Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"
gem "coderay", "~> 1.0.6"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
gem "rake", "0.8.7"
gem "rack", "1.4.0"
gem "rubytree", "0.5.2", :require => "tree"
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay
gem "mysql", "2.9.0"
# Optional gem for LDAP authentication
group :ldap do
gem "net-ldap", "~> 0.3.1"
end
# Optional gem for OpenID authentication
group :openid do
gem "ruby-openid", "~> 2.1.4", :require => "openid"
gem "rack-openid"
end
# Optional gem for exporting the gantt to a PNG file, not supported with jruby
platforms :mri, :mingw do
group :rmagick do
# RMagick 2 supports ruby 1.9
# RMagick 1 would be fine for ruby 1.8 but Bundler does not support
# different requirements for the same gem on different platforms
gem "rmagick", ">= 2.0.0"
end
end
# Database gems
platforms :mri, :mingw do
group :postgresql do
gem "pg", ">= 0.11.0"
end
group :sqlite do
gem "sqlite3"
end
end
platforms :mri_18, :mingw_18 do
group :mysql do
gem "mysql", "2.9.0"
end
end
platforms :mri_19, :mingw_19 do
group :mysql do
gem "mysql2", "~> 0.3.11"
end
end
platforms :jruby do
gem "jruby-openssl"
group :mysql do
gem "activerecord-jdbcmysql-adapter"
end
group :postgresql do
gem "activerecord-jdbcpostgresql-adapter"
end
group :sqlite do
gem "activerecord-jdbcsqlite3-adapter"
end
end
group :development do
gem "rdoc", ">= 2.4.2"
gem "yard"
end
group :test do
gem "shoulda", "~> 2.11"
# Shoulda does not work nice on Ruby 1.9.3 and seems to need test-unit explicitely.
gem "test-unit", :platforms => [:mri_19]
gem "mocha", "0.12.3"
end
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
if File.exists?(local_gemfile)
puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(local_gemfile)
end
# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(file)
end
I've installed activerecord-mysql-adapter -- it had no errors...
I've tried to change the Gemfile to match the error it's spitting out, the (~> 2.8.1) version but that did not work either...
Any help would really be appreciated...
UPDATE!!
I uninstalled MySQL 2.9.0 and installed MySQL 2.8.1 and changed my Gemfile to reflect the proper version, but now I'm getting this error:
=> Booting WEBrick
=> Rails 3.2.8 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query': Mysql::Error: Table 'redmine.users' doesn't exist: SHOW FULL FIELDS FROM `users` (ActiveRecord::StatementInvalid)
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql_adapter.rb:324:in `execute_and_free'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:426:in `columns'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/schema_cache.rb:12:in `initialize'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `call'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `default'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `[]'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:228:in `columns'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/model_schema.rb:237:in `columns_hash'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/inheritance.rb:19:in `descends_from_active_record?'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/inheritance.rb:25:in `finder_needs_type_condition?'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/base.rb:455:in `relation'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/scoping/named.rb:37:in `scoped'
from /usr/lib64/ruby/gems/1.8/gems/activerecord-3.2.8/lib/active_record/querying.rb:9:in `order'
from /var/www/redmine/app/models/group.rb:32
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_load'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:313:in `depend_on'
from /usr/lib64/ruby/gems/1.8/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:225:in `require_dependency'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:439:in `eager_load!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:438:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:438:in `eager_load!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:436:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/engine.rb:436:in `eager_load!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application/finisher.rb:53
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `run_initializers'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `send'
from /usr/lib64/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /var/www/redmine/config/environment.rb:14
from /var/www/redmine/config.ru:4:in `require'
from /var/www/redmine/config.ru:4
from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `instance_eval'
from /usr/lib64/ruby/gems/1.8/gems/rack-1.4.0/lib/rack/builder.rb:51:in `initialize'
from /var/www/redmine/config.ru:1:in `new'
from /var/www/redmine/config.ru:1
EDIT: I figured it out... I needed to run the command: RAILS_ENV=production bundle exec rake db:migrate
DOH!
Try
bundle exec ruby script/rails server webrick -e production
Also, why are you using script/rails? This should work:
bundle exec rails server webrick -e production
HTH

Error with Rake DB:Migrate undefined method `confirm_within=' for Devise:Module

I'm getting this error when I try run DB:Rake :
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
Resolved collector.newrelic.com to 204.93.223.153
rake aborted!
undefined method `confirm_within=' for Devise:Module
/Users/jasonvdm/development/rails/config/initializers/devise.rb:66:in `block in <top (required)>'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/devise-2.1.2/lib/devise.rb:247:in `setup'
/Users/jasonvdm/development/rails/config/initializers/devise.rb:3:in `<top (required)>'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/engine.rb:555:in `each'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/engine.rb:555:in `block in <class:Engine>'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/jasonvdm/development/rails/config/environment.rb:5:in `<top (required)>'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/Users/jasonvdm/.rvm/gems/ruby-1.9.3-p194#wheelz/gems/activesupport- 3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
Not sure why i'm getting these errors at all.
This is what it is my gemfile, leaving out some of the end portions that are private.
source 'http://rubygems.org'
gem 'rails', '3.1.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2', '~> 0.3.11'
# gem 'sqlite3'
group :production do
gem 'thin'
gem 'pg'
end
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
gem 'typus', '~> 3.1.8'
gem "ckeditor-rails", :git => "https://github.com/fesplugas/rails-ckeditor.git" # for typus _text_with_ckeditor.html.erb
gem 'nokogiri'
gem 'aws-s3', :require => 'aws/s3'
gem 'aws-sdk'
gem 'paperclip', '~> 2.5.0'
gem 'devise'
gem 'omniauth-facebook'
gem 'cancan'
gem 'koala'
gem 'rc_rails'
gem 'dynamic_form' # to get back old 'error_messages_on' behavior
gem 'role_model'
gem 'renum'
gem 'geokit', "1.6.0"
gem 'rails3-settings', '~> 1.0.0', :require => 'settings', :git => 'git://github.com/jlaxson/rails-settings'
gem 'acts_as_api'
gem 'twilio-ruby'
gem 'xml-simple', :require => 'xmlsimple'
gem 'braintree', '>= 2.15.0'
gem 'carmen'
gem 'state_machine', :git => 'git://github.com/pluginaweek/state_machine.git'
rest is hidden due to privacy
Help?
Looks like you have an error in config/initializers/devise.rb (line 66). Without seeing that code it seems as though you are calling a method on Devise called confirm_within that was renamed to allow_unconfirmed_access_for in Devise 2.0.
https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.0

Heroku + Rack App + Active Support Timezones

I have a pretty simple Rack app that's defined in a file called config.ru:
require './environment'
class Ryan
def self.call(env)
[200, { "Content-Type" => "text/html" }, [Time.zone.now]]
end
end
run Ryan
In environment.rb, there's this:
require 'active_support/core_ext/time/zones'
require 'active_support/time_with_zone'
require 'active_support/core_ext/time/conversions'
Time.zone = 'Sydney'
And in the Gemfile:
source "http://rubygems.org"
gem 'rack'
gem 'tzinfo'
gem 'activesupport'
When I run this locally, it works! Huge success.
However, when I deploy this application to Heroku it fails entirely with this showing in the logs:
2012-03-01T02:01:55+00:00 app[web.1]: [2012-03-01 02:01:55] INFO ruby 1.9.2 (2011-07-09) [x86_64-linux]
2012-03-01T02:01:55+00:00 app[web.1]: [2012-03-01 02:01:55] INFO WEBrick 1.3.1
2012-03-01T02:01:55+00:00 app[web.1]: [2012-03-01 02:01:55] INFO WEBrick::HTTPServer#start: pid=1 port=27368
2012-03-01T02:01:56+00:00 heroku[web.1]: State changed from starting to up
2012-03-01T02:01:57+00:00 app[web.1]: [2012-03-01 02:01:57] ERROR NoMethodError: undefined method `now' for nil:NilClass
2012-03-01T02:01:57+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
2012-03-01T02:01:57+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
2012-03-01T02:01:57+00:00 app[web.1]: /app/config.ru:8:in `call'
2012-03-01T02:01:57+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
2012-03-01T02:01:57+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
So... what's the dealio here? Is Heroku running this in a different kind of process and so that's why it can't be found?
Weird, this did not run for me locally ,
Ruby 1.9.2p180 and gems,
i18n (0.6.0)
multi_json (1.1.0)
activesupport (3.2.1)
rack (1.4.1)
tzinfo (0.3.31)
bundler (1.0.18)
This did,
require './environment'
class Ryan
def self.call(env)
Time.zone = "Sydney"
[200, { "Content-Type" => "text/html" }, [Time.zone.now.to_s]]
end
end
run Ryan
More information on your local environment may shed some light on why is it happenning.
That will work with Thin instead of WEBrick.
Add Thin gem to your Gemfile then create a Procfile:
web: bundle exec thin start -p $PORT
It worked for me on cedar stack.
As to why it did work with Thin and not WEBrick: I don't have a clue!
http://ryan-cedar.herokuapp.com/

Resources