Forum OpenACS Development: Error on OS X using install-ns.sh

Collapse
Posted by Dave Bauer on
I am using OS X 10.9.5

First off I had a problem creating the user

I ended up using this script http://superuser.com/a/547151

but it doesn't create the group.
I tried dscl . -create /Groups/nsadmin

then I got illegal group name error:

/usr/bin/install -c -m 644 tdomConfig.sh /usr/local/ns/lib
Installing header files in /usr/local/ns/include
Installing ../generic/tdom.h
Installing documentation in /usr/local/ns/man
Installing ../doc/dom.n
Installing ../doc/domDoc.n
Installing ../doc/domNode.n
Installing ../doc/expat.n
Installing ../doc/expatapi.n
Installing ../doc/tdomcmd.n
Installing ../doc/tnc.n
chgrp: nsadmin: illegal group name

Possibly the script needs to be updated?

Collapse
Posted by Dave Bauer on
I was able to continue by seeing the group PrimaryGroupID

I just picked a random number that would likely be unused.

dseditgroup -o edit -i 555 nsdmin

Collapse
Posted by Gustaf Neumann on
user and group generation is not fully automatics for all platforms. you are right, for Mac OS X, the script was creating the group automatically, but without the ID (which has to be picked manually on Mac OS X), but not the user.

Just now, i've further extended the script, such it creates the specified group with a fresh ID and the specified user when necessary. The updated version is on github.

Collapse
Posted by Dave Bauer on
Thanks for your quick reply! I wasn't sure based on the wiki page description, but as usual I learned something figuring it out.
Collapse
Posted by Dave Bauer on
I found a few more issues.

1) You can't run naviserver without setting path if you have another version of postgresql installed. I use the homebrew installed postgresql.

Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

It is running but the socket file is in /tmp/.s.PGSQL.5432
Some answers suggest creating a symlink. That is one option. It seems to solve the problem.

sudo mkdir /var/pgsql_socket
sudo ln -s /tmp/.s.PGSQL.5432 /var/pgsql_socket/

I am not sure if this will survive a restart of postgresql.

After this I found a bug in tdom pkgIndex.tcl, a missing space.

error reading package index file /usr/local/ns/lib/tdom0.8.3/pkgIndex.tcl: expected version number but got "0.8.3"load"

Collapse
Posted by Gustaf Neumann on
The first one seems to be a problem of homebrew. If you use the preconfigured versions from MacPorts, everything is fine. Are you using the postgres client and server from homebrew? if yes, this is a homebrew problem and should be reported to the homebrew maintainers.

The problem with tDOM is an old one, and was fixed 7 years ago [1]. Unfortunately, the release strategy of tDOM is very slow. So far, i was reluctant to use the tip verison from github in the script, but that gives unreliable results when new commits are added. The git repo seems outdated, but fossil archive is not better in this regard.

Maybe i'll find some time to work on a portfile for mac ports for OpenACS and its needed components.

[1] https://github.com/tDOM/tdom/commit/c652019092165ac1eb67dfb10992a86c69385c26

Collapse
Posted by Gustaf Neumann on
To address the tdom problem, i've changed the install script to use a date-based git release (due to lack of a proper tag in the tdom repos).
Collapse
Posted by Dave Bauer on
Gustaf, do you know how Naviserver gets the path to the PostgreSQL socket? I use the home brew version of PostgreSQL every day and it seems to work fine with other applications, so somewhere there is a difference in how it connects.

I'll see if I can look into this further myself as well, but I thought you might know this type of thing.

Thanks for updating the tdom install. I found it simple enough to change but if there is a good way to automate it, that works, even better.

Collapse
Posted by Gustaf Neumann on
NaviServer does not do anything for specifying the socket, it just uses the defaults from the postgres client library.
Collapse
Posted by Dave Bauer on
Thanks for confirming that. I'll have to figure out where it gets that information.

I don't seem to be able to find more than one version of psql. I did

sudo su -
cd /
find . -type f -name "psql"

and only the home brew install of psql was found.

Is there another way I can look for another postgresql install? I am running OS X 10.9.5 Mavericks.

next I looked at the postgresql install script that builds postgresql https://github.com/Homebrew/homebrew/blob/master/Library/Formula/postgresql.rb

I don't see any configuration that changes the default socket directory. Presumably the Naviserver database driver is connecting to a misconfigured library? The socket is definitely in /tmp/.s.PGSQL.5432 and that is the default setting for Postgresql, from what I can find.

Any other ideas where to look? I'd like to be able to consistenly install it correctly, and if possible find the home brew postgresql install script, but I don't see where this is changed when postgresql is compiled.

Collapse
Posted by Michael Aram on
Hello Dave,

IIRC, when compiling PG manually the default location of the socket is in /tmp/.s.PGSQL.5432. When using PG from the distribution, it is somewhere else.

Anyhow, when I install OpenACS, I typically use a wrapper script for starting NaviServer, which includes the PATH to PG. To be honest, I dont know if this is (still) really needed, but maybe it helps?


function install_nsd_pg {
# Add wrapper script
local NSD_PREFIX=$1
local PG_VERSION=$2
local PG_PREFIX=$3

cat <<EOF > ${NSD_PREFIX}/bin/nsd-pg${PG_VERSION}
#!/bin/bash
export PATH=\$PATH:${PG_PREFIX}/bin
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${PG_PREFIX}/lib:${NSD_PREFIX}/lib
ulimit -c unlimited
exec ${NSD_PREFIX}/bin/nsd \$*
EOF
chmod 755 ${NSD_PREFIX}/bin/nsd-pg${PG_VERSION}
}
# Set vars as needed....
install_nsd_pg $PREFIX_NS $POSTGRES_VERSION $PREFIX_POSTGRES

Collapse
Posted by Gustaf Neumann on
Dave, the relevant place to look for the client library is the command used for building/linking.

To link with the client library from mac ports, i use under MacPorts Mavericks and Yosemite

   make PGLIB=/opt/local/lib/postgresql94/ PGINCLUDE=/opt/local/include/postgresql94/
use the following command under Mac OS X to see, which client libaries you are using on your installation:
% otool -L nsdbpg.so 
nsdbpg.so:
	/usr/local/ns/lib/libnsdb.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/postgresql94/libpq.5.dylib (compatibility version 5.0.0, current version 5.7.0)
	/usr/local/ns/lib/libnsthread.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/ns/lib/libnsd.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/local/ns/lib/libtcl8.5.dylib (compatibility version 8.5.0, current version 8.5.17)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
No warpper etc. is needed.
Collapse
Posted by Dave Bauer on
Ok Thanks!

So my naviserver db driver is using the wrong PG library and I'll track that down.

otool -L nsdbpg.so
nsdbpg.so:
/usr/local/ns/lib/libnsdb.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libpq.5.dylib (compatibility version 5.0.0, current version 5.5.0)
/usr/local/ns/lib/libnsthread.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/ns/lib/libnsd.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/ns/lib/libtcl8.5.dylib (compatibility version 8.5.0, current version 8.5.18)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

Collapse
Posted by Gustaf Neumann on
... whatever wrong means. Is /usr/lib/libpq.5.dylib installed by homebrew? This would be strange, a package manager should not install into /usr/lib (rather e.g. /usr/local/lib).

What do you see from

% strings /usr/lib/libpq.5.dylib | fgrep PGSQL
Collapse
Posted by Dave Bauer on
I meant wrong as /usr/lib/libpq.5.dylib is the built-in postgresql. My home brew postgresql is in /usr/local/lib/

I had to re-run ns-install.sh. I did not realize I needed to change the paths to pglib and pginclude in the script before running it.

I learned my lesson. Again than you for your patience.