ferret drb server on start gives Errno::ECONNREFUSED: Connection refused - connect(2)
after spending the good half of my day on this issue, i’m pulling my hair and saying to myself
WTF?
and other times
HowTheF*&^
still no solution. I’m using the acts as ferret gem 0.4.3 (latest at time of writing). I’m using ‘ferretstart’ and ‘ferretstop’ scripts with ‘script/runner’
I’ll investigate if using the plugin might be the way to go as someone was saying in his article that a patch has been submitted to acts_as_ferret to fix this issue. [link will go here, once i find it again]
basically the issue is…. In my activerecord i’ve specified the in macro ‘actsas_ferret’ to use remote index. Now when ferret goes to load the models, they think ferret is up and try to connect to it on the port specified in your ferretserver.yml . This should somehow to be suppressed till ferret server comes up.
later in the day….
specifying
FERRET_USE_LOCAL_INDEX=1
should fix my woes, and i truely believed it won’t (following my theory of “believe in failure”)… and to my misfortune, it didn’t. Got this error instead:
runner.rb:45: (eval):21:in `load': wrong number of arguments (0 for 1) (ArgumentError)
Now i’m completely ditching aaf gem and going over to plugin version of aaf. Also it turns out that best way to start drb server is using script/ferret_server
But of course i’ve got no ferretserver in my script dir. HTF?? As it turns out I installed the plugin at early stages of project (when it had ferretstart instead), and then turned to aaf gem. Moment i update my vendor plugin dir , I’ve got what i need!!! ferret_server.
here we go again…
I copied the ferret_server from plugin dir to script, changed permissions and issue this command, hoping that it’ll fail :)
$ script/ferret_server start -e production $ no such file to load -- /usr/bin/../config/environment
WTF??
google to rescue, stumbled upon this post by jens following the post, i changed the servermanager.rb to use FILE instead. issued ferretserver start again …
$ script/ferret_server start -e production $ starting ferret server...
eeeeeeHAAAAA……. Finally :)
Improvements
Since i’m running it on live server, i prefer starting processes with lower permissions. i’ve made a simple script which invoke as root and spawn the ferret server as lower privilege.
--------------script ferret_start-------------------- #!/bin/sh FERRET_USE_LOCAL_INDEX=1 script/ferret_server start -e production -------------------end of script---------- $ sudo -u www-data ./ferret_start