Forum: Ruby on Rails Broken config/lighttpd.conf? (in EdgeRails)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Peter T Bosse II (Guest)
on 2006-03-21 21:46
(Received via mailing list)
I'm using Mac OS X, I installed Ruby/Rails/lighttpd/etc via the
instructions from hivelogic.  I think I've found a bug with
EdgeRails, but I'm not sure how to submit it (and maybe I'm doing
something wrong and someone can just point me in the right
direction).  Anyway I thought I'd report it just in case it is a bug.

I've downloaded the EdgeRails tree (revision 4007 using `/usr/local/
bin/svn co http://dev.rubyonrails.org/svn/rails/trunk rails`) and
built a new rails app (using `/usr/local/bin/ruby rails/railties/bin/
rails ~/Sites/test2`)

I then cd to the test2 directory, and `rake freeze_edge` (I also have
GemRails installed which I can't change yet).  When I try to start
the lighty server (using start/server) it tries to copy lighttpd.conf
from my vendor directory (as it should).  Unfortunately, `rake
freeze_edge` doesn't put "rails/railties/configs/lighttpd.conf" into
my vendor directory.  So script/server barfs:

---%<---

=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> config/lighttpd.conf not found, copying from /Users/ptb/Sites/
Rails/test2/vendor/rails/railties/configs/lighttpd.conf
/usr/local/lib/ruby/1.8/fileutils.rb:1182:in `stat': No such file or
directory - /Users/ptb/Sites/Rails/test2/vendor/rails/railties/
configs/lighttpd.conf (Errno::ENOENT)
         from /usr/local/lib/ruby/1.8/fileutils.rb:1182:in `lstat'
         from /usr/local/lib/ruby/1.8/fileutils.rb:1160:in `stat'
         from /usr/local/lib/ruby/1.8/fileutils.rb:1242:in `copy_file'
         from /usr/local/lib/ruby/1.8/fileutils.rb:459:in `copy_file'
         from /usr/local/lib/ruby/1.8/fileutils.rb:383:in `cp'
         from /usr/local/lib/ruby/1.8/fileutils.rb:1377:in
`fu_each_src_dest'
         from /usr/local/lib/ruby/1.8/fileutils.rb:1393:in
`fu_each_src_dest0'
         from /usr/local/lib/ruby/1.8/fileutils.rb:1375:in
`fu_each_src_dest'
         from /usr/local/lib/ruby/1.8/fileutils.rb:382:in `cp'
         from ./script/../config/../vendor/rails/railties/lib/
commands/servers/lighttpd.rb:40
         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:21:in `require'
         from ./script/../config/../vendor/rails/activesupport/lib/
active_support/dependencies.rb:149:in `require'
         from ./script/../config/../vendor/rails/railties/lib/
commands/server.rb:34
         from script/server:3

---%<---

Unfazed, I tried copying the entire rails tree directly into my
vendor directory (`/usr/local/bin/svn co http://dev.rubyonrails.org/
svn/rails/trunk vendor/rails`).  That should fix the problem of the
missing lighttpd.conf file.  Well it does, but it doesn't replace
"CWD" in lighttpd.conf with the current directory, so even though
lighttpd.conf has been copied, it doesn't point to the correct
directory.

---%<---

=> Booting lighttpd (use 'script/server webrick' to force WEBrick)
=> config/lighttpd.conf not found, copying from /Users/ptb/Sites/
Rails/test/vendor/rails/railties/configs/lighttpd.conf
=> 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)
Undefined config variable: var.CWD
2006-03-21 11:25:28: (configfile.c.800) source: config/lighttpd.conf
line: 8 pos: 43 parser failed somehow near here: +
Exiting

---%<---

What I've been doing is opening the file with vi then doing search
and replace with CWD with the correct path, but that's tedious and
not the way it should be.  I think it's script/server that should do
the substitutions after it copies the file, but it's currently not
doing that.  What do you think, bug?

- Peter
Stephen B. (Guest)
on 2006-03-22 19:37
(Received via mailing list)
Hi Peter,

I had the same problem. Here's my simple test, a description of the
problem, and what I did to fix it. There may be a reason why the
configs dir is not checked out but I don't know why that is.

I have rails 1.0 installed. After updating rake I tried the following:

rails editor
cd editor
rake freeze_edge
script/server

which produced an error when it couldn't find the file:

   vendor/rails/railties/configs/lighttpd.conf

to copy into config/lighttpd.conf

Problem:

The freeze_edge task in framework.rake only checks out the lib
directories in each framework but
vendor/rails/railties/lib/commands/servers/lighttpd.rb is looking for
vendor/rails/railties/configs/lighttpd.conf.

I patched my Rails 1.0 rake freeze_edge task
(rails-1.0.0/lib/tasks/framework.rake):

   for framework in %w( railties actionpack activerecord actionmailer
activesupport actionwebservice )
     mkdir_p "vendor/rails/#{framework}"
     system  "svn export
http://dev.rubyonrails.org/svn/rails/trunk/#{framework}/lib
vendor/rails/#{framework}/lib #{revision_switch}"
   end
end

By inserting the following line after line 46:

   for framework in %w( railties actionpack activerecord actionmailer
activesupport actionwebservice )
     mkdir_p "vendor/rails/#{framework}"
     system  "svn export
http://dev.rubyonrails.org/svn/rails/trunk/#{framework}/lib
vendor/rails/#{framework}/lib #{revision_switch}"
   end
   system  "svn export
http://dev.rubyonrails.org/svn/rails/trunk/railties/configs
vendor/rails/railties/configs #{revision_switch}"
end

After rm -rf vendor/rails/ and rake freeze_edge my script/server
command worked.
Peter T Bosse II (Guest)
on 2006-03-22 22:51
(Received via mailing list)
So, `rake freeze_edge` runs from rails-1.0.0 and not vendor/rails?

Is that what everyone should expect is the correct behavior for
rake?  I would have thought that rake would use vendor/rails if it
existed, and gemrails only if vendor/rails wasn't available (in which
case http://dev.rubyonrails.org/ticket/4047 would have fixed this
problem).

- Peter
Samuel Johnson (Guest)
on 2006-03-22 23:47
(Received via mailing list)
Undefined config variable: var.CWD
means your (and my) lighttpd doesn't support mod_cml and I guess edge
rails assumes you have it.
I'm on Mac OS X and I haven't found an easy way to compile lighty with
mod_cml yet. The lighttpd +cml darwinport is broken, I think, because
the lua port doesn't generate a pkgconfig file. I'd file a bug if I
had any idea who's responsibility it is :-)
I'd love to hear a non-darwinports way of installing lighty with
mod_cml (on OSX x86).

thanks,
-Sam
Peter T Bosse II (Guest)
on 2006-03-23 01:42
(Received via mailing list)
*** Rails 1.1 will require lighttpd 1.4.11 (if you're using lighttpd)
***

---

I submitted a ticket on this issue: http://dev.rubyonrails.org/ticket/
4344 and DHH said that "Yes, Rails 1.1 will assume that you have
1.4.11 or above. You're still free to use 1.4.8, but it'll require
that you alter your lighttpd.conf accordingly."  (See the ticket for
a workaround.)

I've built lighttpd 1.4.11 on Mac OS X 10.4.5 using the instructions
from hivelogic (1) (changing the version number obviously) and "CWD"
is built into 1.4.11.  Everyone will need to upgrade to 1.4.11 if
they want to run Rails 1.1 apps.

>>> So, `rake freeze_edge` runs from rails-1.0.0 and not vendor/rails?

This is my statement, so I'll give myself a big "DUH".  `rake
freeze_edge` copies the EdgeRails trunk *into* vendor/rails so
obviously rake is going to use "rails-1.0.0/lib/tasks/framework.rake"
for it's configuration (vendor/rails doesn't exist until it's run!).
Unfortunately, rails-1.0 didn't copy vendor/rails/railties/configs/
lighttpd.conf from the trunk into vendor/rails.  (This was fixed with
http://dev.rubyonrails.org/ticket/4047)

Therefore, in order to get a *complete* checkout of EdgeRails into
vendor/rails is to actually run `rake freeze_edge` **twice**.  The
first time it uses the config from rails-1.0.0 (your gem install),
the second time it runs the config from vendor/rails which correctly
copies lighttpd.conf into your app.

- Peter

(1) - http://hivelogic.com/articles/2005/12/01/
ruby_rails_lighttpd_mysql_tiger
This topic is locked and can not be replied to.