Switched to OSX...

I'm porting my app from a linux machine to OSX:

1. Seems like when I ctrl-C on the mac using webrick, and then restarting I get "address already in use" - I've killed every process I've seen, including doing a 'sudo ps'... I really don't want to do a -p to get out of this. How can I release the port? Seems like a lot of processes are getting filtered out on the mac. 2. I'm not finding the config method in Login Engine, which tells me Login Engine is not getting loaded. I've replaced my public directory with the mac generated version, are there any other suggestions?

Releasing the port is not in your control. The process should to do it before it dies.

Are you running in production mode? Could it be a buggy version of webrick?

I never had this problem with webrick or lighttpd. You might try ligttpd.

Jose

Jose Hales-Garcia

UCLA Department of Statistics

jose@stat.ucla.edu

Or mongrel. It's good enough that rails-edge uses it by default (if it's installed)

gem install mongrel mongrel_rails start

You can try netstat -a and see if the port is being used by the process. BSD's sockstat (which you can get via darwinports) is also a good call here.

Vish

That’s easy enough. I haven’t made the transition to Mongrel yet, but I should be doing it sooner than later. Can you say what caveats there are in transitioning a project from Lighttpd to Mongrel? I’ve configured the lighttpd.conf file how I want it. Are there transition guides?

By the way, Lighttpd is used over Webrick when it’s installed too.

Jose

Jose Hales-Garcia

UCLA Department of Statistics

jose@stat.ucla.edu

Ok, I tried switching to lighty, and I get:

$ ./script/server => Booting lighttpd (use 'script/server webrick' to force WEBrick) => Rails application started on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server (see config/lighttpd.conf for options) 2006-11-05 08:11:59: (network.c.300) can't bind to port: 0.0.0.0 3000 Address already in use Exiting

Webrick now fails with the error from Login Engine: ./script/server webrick => Booting WEBrick... ./script/../config/../config/environment.rb:56: undefined method `config' for LoginEngine:Module (NoMethodError)         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'

Maybe the real problem is the LoginEngine not being loaded? I see on the web most of these solutions are restarting the server after modifying environment.rb, but obviously that's not the case here.

You need to clear out the stuck process first. Did you reboot first? The point is, if your socket is clear to start with, and you use another server, you should be able to quit them and not get this problem again.

Jose

Jose Hales-Garcia

UCLA Department of Statistics

jose@stat.ucla.edu

Actually rebooting isn’t necessary just to test this. You can set the port in the lighttpd.conf file with…

server.port = 3003

Jose

Jose Hales-Garcia

UCLA Department of Statistics

jose@stat.ucla.edu

The reboot did clear out the port connection. I'm going to keep looking into netstat, hopefully I can determine how to find the process that is holding the port hostage. I'd rather not reboot when I have this issue. If I find anything I'll update the thread, netstat had a lot of information.

I've nailed down the core issue to links - when the directories script, config and public are links instead of directories, I see the config method not found in LoginEngine. I was using links for those directories because I want my synchronizer to avoid syncing them to the server.

Why would rails care if I'm using links? Seems like it's detecting all the directories, but not loading the plugins.

$ ls ../.. config <design_dir> public script $ rm -rf public config script $ ln -s ../../public public $ ln -s ../../config config $ ln -s ../../script script $ ./script/server webrick => Booting WEBrick... ./script/../config/../config/environment.rb:56: undefined method `config' for LoginEngine:Module (NoMethodError)         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'         from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:52         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'         from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'         from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'         from ./script/server:3 $ rm public config script $ cp -rf ../../public . $ cp -rf ../../config . $ cp -rf ../../script . $ ./script/server webrick => Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2006-11-05 10:28:23] INFO WEBrick 1.3.1 [2006-11-05 10:28:23] INFO ruby 1.8.4 (2005-12-24) [i686-darwin8.8.2] [2006-11-05 10:28:23] INFO WEBrick::HTTPServer#start: pid=711 port=3000

On the dev environment? None at all. The production set up involves a different architecture, and you'll probably still want lighty as your front server. mongrel.rubyforge.org has excellent guides for deployment. Developing (on Windows esp, Ruby is slow) with Mongrel is way faster.

Vish