[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Problem getting tiny RAILS demo working

craig duncan

10/31/2004 7:59:00 PM

I've been following the instructions provided in
"http://darkhost.mine.nu:8080/~vince/rails/tutorial.... to see if i
could get the basic database (Postgres)/webserver (WEBrick)/Rails
functionality working. Everything seems ok until i get to the part
where i stick "scaffold :album" into the AlbumController class.

I've got two problems. 1a) postgres ident authorization won't work for
me for a non-postgres user (nothing to do with anything but postgres) so
i just made the first line in pg_hba.conf "local all all trust" and then
(re postgres all by itself) access seems to work ok... except when i go
to "http://localhost:3000/album" i see (1b):

PGError in Album#index
FATAL: IDENT authentication failed for user "postgres"
[followed by a stack trace]

(this is with "local all all trust" as the first line in pg_hba.conf)
I'm running WEBrick as a non-postgres, non-root user.

Problem 2: I run WEBrick with -r debug and i get an exception raised in
/usr/lib/ruby/1.8/webrick/httpservlet/filehandler.rb#235:

235: st = (File::stat(res.filename) rescue nil)

(rdb:2) p res.filename
"/home/craig/Album/public/album"
(rdb:2)

Which is causing the following output (even when not running the debugger):

#<WEBrick::HTTPStatus::NotFound: `/album' not found.>
127.0.0.1 - - [31/Oct/2004:14:37:01 EST] "GET /album HTTP/1.1" 500 3657
- -> /album

There *is* no public/album directory, though. Is something wrong here?
There were no instructions to make this directory, it didn't get made
by either the new_model or new_controller scripts and (crucially) the
example cited above shows things working at this point (displaying
"Listing todos" in the tutorial).

Could my Album object be insufficiently "business"-like?



6 Answers

vfoley

11/1/2004 12:57:00 PM

0

Is config/database.yml properly configured? An authorization error
seems related to username and password. Check out
http://www.rubyonrails.org/show/Tutor... to make sure your
PostgreSQL configuration is okay.

craig duncan <duncan@nycap.rr.com> wrote in message news:<41854418.6060704@nycap.rr.com>...
> I've been following the instructions provided in
> "http://darkhost.mine.nu:8080/~vince/rails/tutorial.... to see if i
> could get the basic database (Postgres)/webserver (WEBrick)/Rails
> functionality working. Everything seems ok until i get to the part
> where i stick "scaffold :album" into the AlbumController class.
>
> I've got two problems. 1a) postgres ident authorization won't work for
> me for a non-postgres user (nothing to do with anything but postgres) so
> i just made the first line in pg_hba.conf "local all all trust" and then
> (re postgres all by itself) access seems to work ok... except when i go
> to "http://localhost:3000/album" i see (1b):
>
> PGError in Album#index
> FATAL: IDENT authentication failed for user "postgres"
> [followed by a stack trace]
>
> (this is with "local all all trust" as the first line in pg_hba.conf)
> I'm running WEBrick as a non-postgres, non-root user.
>
> Problem 2: I run WEBrick with -r debug and i get an exception raised in
> /usr/lib/ruby/1.8/webrick/httpservlet/filehandler.rb#235:
>
> 235: st = (File::stat(res.filename) rescue nil)
>
> (rdb:2) p res.filename
> "/home/craig/Album/public/album"
> (rdb:2)
>
> Which is causing the following output (even when not running the debugger):
>
> #<WEBrick::HTTPStatus::NotFound: `/album' not found.>
> 127.0.0.1 - - [31/Oct/2004:14:37:01 EST] "GET /album HTTP/1.1" 500 3657
> - -> /album
>
> There *is* no public/album directory, though. Is something wrong here?
> There were no instructions to make this directory, it didn't get made
> by either the new_model or new_controller scripts and (crucially) the
> example cited above shows things working at this point (displaying
> "Listing todos" in the tutorial).
>
> Could my Album object be insufficiently "business"-like?

craig duncan

11/1/2004 4:15:00 PM

0

Vincent Foley wrote:

>Is config/database.yml properly configured? An authorization error
>seems related to username and password. Check out
>http://www.rubyonrails.org/show/Tutor... to make sure your
>PostgreSQL configuration is okay.
>
>
It is. I can't figure out why ident authentication (postgres) doesn't
seem to work but when i make the first line in pg_hba.conf "host all all
trust" then every local user has access (e.g. psql <database>
postgres). database.yml specifies user "postgres". It really shouldn't
matter, though. IDENT authentication shouldn't even be being used. I'm
running ruby 1.8.2 on debian unstable, postgresql 7.4.6. I saw
something somewhere about needing to run an IDENT daemon, but could find
no verification for that idea. Anyway, as i said, IDENT authentication
shouldn't even be being used.



craig duncan

11/3/2004 7:20:00 PM

0

craig duncan wrote:

> Vincent Foley wrote:
>
>> Is config/database.yml properly configured? An authorization error
>> seems related to username and password. Check out
>> http://www.rubyonrails.org/show/Tutor... to make sure your
>> PostgreSQL configuration is okay.
>>
>>
> It is. I can't figure out why ident authentication (postgres) doesn't
> seem to work but when i make the first line in pg_hba.conf "host all
> all trust" then every local user has access (e.g. psql <database>
> postgres). database.yml specifies user "postgres". It really
> shouldn't matter, though. IDENT authentication shouldn't even be
> being used. I'm running ruby 1.8.2 on debian unstable, postgresql
> 7.4.6. I saw something somewhere about needing to run an IDENT
> daemon, but could find no verification for that idea. Anyway, as i
> said, IDENT authentication shouldn't even be being used.
>
>
>
The reason why authentication is failing is because this fails:

psql -h localhost <database> postgres

without the "-h localhost" it works fine. I can ping localhost. I
don't know why that doesn't work but that's what's keeping Rails
(activerecord) from connecting to postgres.



Eric Hodel

11/4/2004 12:21:00 AM

0

On Nov 3, 2004, at 11:19 AM, craig duncan wrote:

> craig duncan wrote:
>
>> Vincent Foley wrote:
>>
>>> Is config/database.yml properly configured? An authorization error
>>> seems related to username and password. Check out
>>> http://www.rubyonrails.org/show/Tutor... to make sure your
>>> PostgreSQL configuration is okay.
>>>
>> It is. I can't figure out why ident authentication (postgres)
>> doesn't seem to work but when i make the first line in pg_hba.conf
>> "host all all trust" then every local user has access (e.g. psql
>> <database> postgres). database.yml specifies user "postgres". It
>> really shouldn't matter, though. IDENT authentication shouldn't even
>> be being used. I'm running ruby 1.8.2 on debian unstable, postgresql
>> 7.4.6. I saw something somewhere about needing to run an IDENT
>> daemon, but could find no verification for that idea. Anyway, as i
>> said, IDENT authentication shouldn't even be being used.
>>
>>
>>
> The reason why authentication is failing is because this fails:
>
> psql -h localhost <database> postgres
>
> without the "-h localhost" it works fine. I can ping localhost. I
> don't know why that doesn't work but that's what's keeping Rails
> (activerecord) from connecting to postgres.

I don't believe postgres accepts connections on the TCP socket by
default, only the UNIX socket. You need to edit the postgres config
files to set this up for yourself.



craig duncan

11/4/2004 1:02:00 AM

0

Eric Hodel wrote:

> On Nov 3, 2004, at 11:19 AM, craig duncan wrote:
>
>> craig duncan wrote:
>>
>>> Vincent Foley wrote:
>>>
>>>> Is config/database.yml properly configured? An authorization error
>>>> seems related to username and password. Check out
>>>> http://www.rubyonrails.org/show/Tutor... to make sure your
>>>> PostgreSQL configuration is okay.
>>>>
>>> It is. I can't figure out why ident authentication (postgres)
>>> doesn't seem to work but when i make the first line in pg_hba.conf
>>> "host all all trust" then every local user has access (e.g. psql
>>> <database> postgres). database.yml specifies user "postgres". It
>>> really shouldn't matter, though. IDENT authentication shouldn't
>>> even be being used. I'm running ruby 1.8.2 on debian unstable,
>>> postgresql 7.4.6. I saw something somewhere about needing to run
>>> an IDENT daemon, but could find no verification for that idea.
>>> Anyway, as i said, IDENT authentication shouldn't even be being used.
>>>
>>>
>>>
>> The reason why authentication is failing is because this fails:
>>
>> psql -h localhost <database> postgres
>>
>> without the "-h localhost" it works fine. I can ping localhost. I
>> don't know why that doesn't work but that's what's keeping Rails
>> (activerecord) from connecting to postgres.
>
>
> I don't believe postgres accepts connections on the TCP socket by
> default, only the UNIX socket. You need to edit the postgres config
> files to set this up for yourself.
>
It hadn't occurred to me that specifying localhost implied using a TCP
socket . . . but you're right. So that solves that. A note in any
documentation mentioning the role of the database.yml config file might
be in order . . . saying that if you _want_ to restrict the database to
only accept connections on UNIX sockets, then just leave the "host"
field blank.



Tobias Luetke

11/4/2004 2:04:00 AM

0

Please add it on the wiki where you see fit.


On Thu, 4 Nov 2004 10:02:19 +0900, craig duncan <duncan@nycap.rr.com> wrote:
> Eric Hodel wrote:
>
>
>
> > On Nov 3, 2004, at 11:19 AM, craig duncan wrote:
> >
> >> craig duncan wrote:
> >>
> >>> Vincent Foley wrote:
> >>>
> >>>> Is config/database.yml properly configured? An authorization error
> >>>> seems related to username and password. Check out
> >>>> http://www.rubyonrails.org/show/Tutor... to make sure your
> >>>> PostgreSQL configuration is okay.
> >>>>
> >>> It is. I can't figure out why ident authentication (postgres)
> >>> doesn't seem to work but when i make the first line in pg_hba.conf
> >>> "host all all trust" then every local user has access (e.g. psql
> >>> <database> postgres). database.yml specifies user "postgres". It
> >>> really shouldn't matter, though. IDENT authentication shouldn't
> >>> even be being used. I'm running ruby 1.8.2 on debian unstable,
> >>> postgresql 7.4.6. I saw something somewhere about needing to run
> >>> an IDENT daemon, but could find no verification for that idea.
> >>> Anyway, as i said, IDENT authentication shouldn't even be being used.
> >>>
> >>>
> >>>
> >> The reason why authentication is failing is because this fails:
> >>
> >> psql -h localhost <database> postgres
> >>
> >> without the "-h localhost" it works fine. I can ping localhost. I
> >> don't know why that doesn't work but that's what's keeping Rails
> >> (activerecord) from connecting to postgres.
> >
> >
> > I don't believe postgres accepts connections on the TCP socket by
> > default, only the UNIX socket. You need to edit the postgres config
> > files to set this up for yourself.
> >
> It hadn't occurred to me that specifying localhost implied using a TCP
> socket . . . but you're right. So that solves that. A note in any
> documentation mentioning the role of the database.yml config file might
> be in order . . . saying that if you _want_ to restrict the database to
> only accept connections on UNIX sockets, then just leave the "host"
> field blank.
>
>


--
Tobi