unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Daniel Condomitti <daniel@condomitti.com>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: Issue starting unicorn with non-ActiveRecord Rails app
Date: Tue, 4 Dec 2012 23:48:41 -0800	[thread overview]
Message-ID: <5B98719E611543C3A54EB428C7869BF7@condomitti.com> (raw)
In-Reply-To: <CA+c-+BaDCBCCeKC-WV6h4COc4qg7=LvNXE+sMv33TqdA9mMd8Q@mail.gmail.com>

On Tuesday, December 4, 2012 at 9:19 PM, Peter Hall wrote:
> Hi,
> 
> I'm trying to use unicorn in a test deployment of a Rails app that
> uses Mongoid, so Activerecord isn't included in the app. When I start
> unicorn through Capistrano though, the stderr log fills up endlessly
> with identical ActiveRecord-related errors:
> 
> I, [2012-12-05T04:19:25.375952 #5096] INFO -- : Refreshing Gem list
> I, [2012-12-05T04:19:32.941249 #5096] INFO -- : listening on
> addr=/var/www/webapps/fugu-cp/shared/pids/unicorn.sock fd=11
> I, [2012-12-05T04:19:32.990825 #5096] INFO -- : master process ready
> E, [2012-12-05T04:19:33.108183 #5110] ERROR -- : uninitialized
> constant ActiveRecord (NameError)
> /var/www/webapps/fugu-cp/current/config/unicorn.rb:68:in `block in reload'
> /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:569:in
> `call'
> /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:569:in
> `init_worker_process'
> /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:593:in
> `worker_loop'
> /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:491:in
> `spawn_missing_workers'
> /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/lib/unicorn/http_server.rb:141:in
> `start'
> /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/gems/unicorn-4.4.0/bin/unicorn_rails:209:in
> `<top (required)>'
> /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/bin/unicorn_rails:23:in `load'
> /var/www/webapps/fugu-cp/shared/bundle/ruby/1.9.1/bin/unicorn_rails:23:in
> `<main>'
> 
> This repeats until I kill Unicorn.
> 
> If you're curious, the way I'm starting Unicorn in the deploy file is
> as follows:
> 
> set :unicorn_rails, "#{deploy_to}/shared/bundle/ruby/1.9.1/bin/unicorn_rails"
> run "cd #{latest_release} && bundle exec \"#{unicorn_rails} -c
> #{deploy_to}/current/config/unicorn.rb -D -E #{rails_env}\""
> 
> Incidentally, if there's a standard Unicorn include file for
> Capistrano so I don't have to specify my own tasks to start and stop
> it, I'd be grateful to know, because I couldn't find one and had to
> use a very heavily-modified version of something I copied+pasted from
> this gist: https://gist.github.com/1003099
> 
> Thanks,
What's L68 of your config/unicorn.rb file look like? Check to see if you have copied/pasted a line that references ActiveRecord in the before_fork or after_fork blocks.

A lot of unicorn examples have an ActiveRecord::Base.connection.disconnect! (with a defined?(ActiveRecord::Base) but that might not be present in your config) statement to ensure that AR connections aren't shared between the master and worker processes. 
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

  parent reply	other threads:[~2012-12-05  7:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CA+c-+BYTxv+5mQ2MKeKVYEoxgPbi2QjwY6Oak-R_g65GhixEzg@mail.gmail.com>
2012-12-05  5:19 ` Fwd: Issue starting unicorn with non-ActiveRecord Rails app Peter Hall
2012-12-05  7:45   ` Eric Wong
2012-12-05  7:48   ` Daniel Condomitti [this message]
2012-12-05  9:56     ` Peter Hall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5B98719E611543C3A54EB428C7869BF7@condomitti.com \
    --to=daniel@condomitti.com \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).