Forum OpenACS Q&A: ACS/pg is disrupting AOLserver

Collapse
Posted by David Richards on
OK, I know it's late, so that can answer a lot of what's going on.
Nevertheless, I've gone over what I've done in my head a thousand
times, and I can't figure out what I've done.  So, here's the lowdown.

I had AOLserver serving static files.  No problem.  I was using
AOLserver 3.0.  I just downloaded the latest version last week, to get
all the fixes from their upgrades. To serve static files, I just
modified the default nsd.tcl a little.  I had AOLserver installed in
/home/nsadmin.  I can't remember why I put it there, but it worked.

I got PostgreSQL 6.5.3 running without any trouble.  I can do all the
work I need as postgres, as well as nsadmin (my AOLserver
administrator).

I compiled the PostgreSQL driver for AOLserver without any errors.

I loaded the latest ACS/pg (3. something beta--I just got it tonight,
so I know it's the latest).

I unzipped ACS/pg without any trouble, but I kept things in /tmp.

Up to this point, I could still get the web server to serve static
pages.

I was playing with the driver, trying to use it in my nsd.tcl.  I had
a few problems, read the docs, read these discussion forums, found
some answers.  I can't remember what all happened there.  I've had a
tough day, and my head is swimming.

I moved ACS/pg from /tmp to /web/rbs (my virtual server).

Somewhere in the last two steps, I lost the ability to serve static
pages.  I haven't even tried to serve anything from the ACS yet.  I
went back and commented out all the Postgres driver related code out
of my nsd.tcl file.  I moved the contents of /web/rbs/parameter to
somewhere else (I know that there was something pointing to these
files from nsd.tcl, and I didn't have any additional parameters
before).

I also checked my server.log, and there are no errors.  It says
"Notice: waiting for connections" as the last line in server.log.  I
know that this line was written from the most recent time I ran the
server.

The command I ran was:

/home/nsadmin/bin/nsd8x -u nsadmin -t /home/nsadmin/nsd1.tcl &

I ran the command as root.  When I hit return after this, the terminal
says the process is done, although it leaves running threads.

The bottom line is I can't serve static files, and I can't figure out
what I broke.

Can anyone help me please?

Collapse
Posted by David Richards on
OK, I apologize.  I figured out what's going on.  I'm really embarrased to leave a long message in all your mailboxes and in this bboard.  I got my urls mixed up--I was looking for a server that doesn't exist on my server.  I'm going to go get three hours of sleep an then see if I can tackle some of the ACS.

Since I've got your attention, maybe someone could save me some time and show me where to start looking to configure a bboard on my test server.  I think I'm to the point where I can try to implement some of the toolkit.  thanks.

David Richards

Collapse
Posted by Don Baccus on
No need to apologize, I'm sure we've all done similar things.

After you get openACS up (hey, am I the first to use our new name?), you'll get a login screen.  Log in as system/changeme.  From your workspace page, select "sitewide administration".  From there, just select "bboard" and then "add new topic".

You'll be off and running.

Collapse
Posted by Ben Adida on
Just to reiterate Don's point: we welcome all questions and problems on this bboard that are related to openACS. Even if it's late at night :)
Collapse
Posted by David Richards on
Good morning!  I slept very well, thank you.  I tried to sleep for only 3 hours, but it's been 6!

Anyway, I thought while I have some expert attention, I could use some help telling openACS (Is that what you're calling ACS/pg now?) about postgres.  Last night I found someone's post that included a section of their nsd.tcl file.  After using that, and guessing with a thing or two, I know I don't have it right.  Here's what I've got at the end of the file (warning, it's pretty messy):

# This section is cut from a post in the ACS/pg bb

ns_section "ns/db/drivers"
ns_param postgres postgres.so
#ns_param postgres nspostgres.so

ns_section "ns/db/pools"
ns_param users "nsadmin"

ns_section "ns/db/pool/users"
ns_param Driver "postgres"
ns_param User "postgres"
ns_param Datasource "127.0.0.1:5432"
#ns_param Datasource "127.0.0.1:5432:users"

ns_param Connection 10

ns_log notice "nsd1.tcl: finished reading config file."

I know that a lot of what I've got above is just a wild guess at what I'm supposed to tell AOLserver, but I'm not sure what to try.  Any suggestions?  (with a test index.adp, I can confirm that I can't see the db.  However, I can see, insert, and delete as nsadmin from the command line using psql.)

Collapse
Posted by Don Baccus on
Here's exactly what has worked for me (I installed acs under its own account, so user is acs in the pool def):
ns_section "ns/db/drivers"
    ns_param    postgres       "nspostgres.so"

    ns_section "ns/db/driver/postgres"
    ns_param   datestyle       "iso"

    ns_section "ns/db/pool/main"
    ns_param   Driver          "postgres"
    ns_param   Connections     4
    ns_param   MaxOpen         1000000000
    ns_param   MaxIdle         1000000000
    ns_param   User            "acs"
    ns_param   Verbose         "On"
    ns_param   LogSQLErrors    "On"
    ns_param   DataSource      "localhost::acs"

...

ns_section "ns/db/pools"
    ns_param   main            "main"
    ns_param   subquery        "subquery"
    ns_param   log             "log"

...

# Database configuration
    ns_section "ns/server/${servername}/db"
    ns_param   pools           "*"  
    ns_param   defaultpool     "main"

You need the pools section as well as the bit that hooks your virtual server to the pools.
Collapse
Posted by David Richards on
Bless you and thank you.  I'll try that tonight when I get back to my computer at home.

I have a couple of questions.  When I compiled the driver, it created postgres.so instead of nspostgres.so.  Is that just a difference between platforms?

Also, it looks like you've got user acs running database acs.  Is that how I should interpret everything?  (I know you mentioned the user account, I'm just making sure I'm not working off of assumptions.)

Thank you again.

Collapse
Posted by Don Baccus on
Yes, user acs, database acs.

As far as your other question goes, the make file might make postgres.so, and perhaps I just copied the binary to nspostgres.so?  I  think the AOLserver3 docs refer to nspostgres.so and the binary distribution has it named nspostgres.so.

My machine with all this on it isn't reachable at the moment, so I can't check and don't feel like downloading sources at the moment...

Collapse
Posted by David Richards on
I promise, if there were something that I could think of to read, I would check that out before I relied on all your time and effort.  I really appreciate that you've taken the time to help me out thus far.

I've used the code Don just gave me.  As AOLserver tries to load the driver, it chokes.  Here's the problem:

in the server.log, I get a warning that /home/nsadmin/bin/postgres.so can't load.  This is the right path of the file.  The next message is undefined symbol: Ns_dbAddColumnInfo.  I've gone through the driver code (there are 4 references in postgres.c and 1 in postgres-backup.c) but I haven't tried to really debug the .c.  I'm assuming the problem is somewhere else.

Any ideas?

Collapse
Posted by Roberto Mello on
Did you edit the drivers' Makefile before compiling it ? You have to tell it that you are using AOLserver 3 (right?). You also have to tell it where your Postgres libraries are. The location is different for the RPM and the source distribution of PostgreSQL.

After you compile the postgres driver downloaded from acspg, make sure you move that binary to the AOLserver bin directory.

Collapse
Posted by David Richards on
hmmm, I don't know anything about telling it that I'm using AOLserver3.  I did get the NSHOME, lib, and include directories right.  Those were the only three parameters I changed in the makefile.  It did put the driver in the right directory.

Also, I've taken a closer look at postgres.c.  It declares the class at the top.  It uses Ns_DbAddColumnInfo in Ns_PgGetTableInfo.  Finally, it defines the class lower.  That's all there is to the c side of things.

It sounds, however, that there's something else to the makefile that I don't know about.

Collapse
Posted by Lamar Owen on
Well, the makefile has a parameter in it that needs to be set -- FOR_ACS_USE.  The postgres.c code figures out at compile time whether it is AOLserver 3 or not.  The default makefile has FOR_ACS_USE set, IIRC.
Collapse
Posted by Don Baccus on
David, when you upgraded AOLserver3, did you grab sources and build yourself a new one, or just grab binaries and then compile the Postgres driver gotten from elsewhere (say, our SourceForge page)?

Again, I downloaded AOLserver3 release sources (including the driver) and compiled it (and the driver) and it works just fine with PG7 and OpenACS.  The makefile that comes down with the release sources has FOR_ACS_USE define that's needed (or is it embedded in postgres.c as a default?  doesn't matter, it works).

So somewhere in this long train of events you've followed you've probably gotten a bogus makefile.