Tag Archives: server

Link

Hey everyone,

I’ve just done a fresh install of RVM using the guide below. There were a few dependencies missing, but other than that it all went pretty smoothly.

Link: http://stjhimy.com/posts/10-five-quick-steps-to-set-up-rvm-with-rails-2-and-rails3

Next time I do an install I’ll try to document the whole thing, but for now that link is probably one of the better/simpler guides I’ve come across. If you have any problems please leave a comment below and I’ll try to get back to you.

UPDATE:

Just another guide I’ve come across that seems to work well, this one is a complete “start to finish” one:
http://rails.vandenabeele.com/blog/2011/11/26/installing-ruby-and-rails-with-rvm-on-ubuntu-11-dot-10/

Uninstalling a Gem – Ruby on Rails

Due to a few recent issues with SunSpot (see my previous posts), I’ve decided to uninstall it until I have enough time to work on it properly. Once again, Ruby makes this pretty simple:


chris@chris-VirtualBox:~/site$ sudo gem uninstall sunspot
[sudo] password for chris: 

You have requested to uninstall the gem: sunspot-1.2.1 sunspot_rails-1.2.1 depends on [sunspot (= 1.2.1)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y


Remove executables: sunspot-solr, sunspot-installer in addition to the gem? [Yn]  y


Removing sunspot-solr
Removing sunspot-installer


Successfully uninstalled sunspot-1.2.1

Errno::ECONNREFUSED in – Ruby on Rails

First problem of the morning – Errno::ECONNREFUSED in ProductsController#create. This one was actually a little bit tricky – for me anyway. The error seemed to imply a database issue, so I started by checking all the common problems there however no luck unfortunately.

After a bit of a Google I came across a post mentioning that a few people had encountered this after installing Solr. I had previously setup Sunspot, which just so happens to sit on top of Solr.

Manually starting solr fixed the problem – just using the code below:

chris@chris-VirtualBox:~/site$ rake sunspot:solr:start

 

I’m not really sure what triggered the error as I’d been using the exact same functionality all morning without any changes or issues. Thankfully it’s a quick fix. If anyone has anymore info on the problem please let me know.

Anyway, that’s all I’ve got for you for now, Good Luck!

UPDATE: I had this problem again this morning and realised that it was the models with search fields still defined that were triggering the error. Removing this code seems to have completely resolved the issue.

Rails Server – Address Already in Use

Well, looks like the first thing I’ve managed to break today is WEBrick – a web server for ruby on rails. The general idea behind the error message appears to be that the address it’s trying to start is already in use:

[2011-12-02 19:01:34] INFO  WEBrick 1.3.1
[2011-12-02 19:01:34] INFO  ruby 1.8.7 (2010-08-16) [i686-linux]
[2011-12-02 19:01:39] WARN  TCPServer Error: Address already in use – bind(2)
Exiting
/usr/lib/ruby/1.8/webrick/utils.rb:73:in `initialize’: Address already in use – bind(2) (Errno::EADDRINUSE)
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `new’
from /usr/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners’
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `each’
from /usr/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners’
from /usr/lib/ruby/1.8/webrick/server.rb:75:in `listen’
from /usr/lib/ruby/1.8/webrick/server.rb:63:in `initialize’
from /usr/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize’
from /usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/handler/webrick.rb:10:in `new’
from /usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/handler/webrick.rb:10:in `run’
from /usr/lib/ruby/gems/1.8/gems/rack-1.3.4/lib/rack/server.rb:265:in `start’
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/commands/server.rb:70:in `start’
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/commands.rb:54
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap’
from /usr/lib/ruby/gems/1.8/gems/railties-3.1.1/lib/rails/commands.rb:49
from script/rails:6:in `require’
from script/rails:6

 

Sure enough, it turns out that one of my previous WEBrick processes had not closed properly. I was able to view the existing processes using the following:
chris@chris-VirtualBox:~/site$ pgrep ruby
1601

 

In order to close them simply kill the process:
chris@chris-VirtualBox:~/site$ kill 1601

 

Ensure that the process is gone:
chris@chris-VirtualBox:~/site$ pgrep ruby

 

And finally, start WEBrick again.
chris@chris-VirtualBox:~/site$ rails server
=> Booting WEBrick
=> Rails 3.1.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-12-02 19:13:21] INFO  WEBrick 1.3.1
[2011-12-02 19:13:21] INFO  ruby 1.8.7 (2010-08-16) [i686-linux]
[2011-12-02 19:13:26] INFO  WEBrick::HTTPServer#start: pid=1814 port=3000

 

Good luck!