Forum OpenACS Development: aolserver on port 80

Collapse
Posted by Iuri Sampaio on
Hi there,

I am using aolserver and openacs on my home server.
In order to set up aolserver service on port 80 using daemontools, i did the following procedure:
I opened the file openacs/etc/config.tcl and properly set to port 80, then i restart the machine

and I got the expected error.

[31/Oct/2009:10:48:38][2975.3083900608][-main-] Notice: nsmain: AOLserver/4.5.1 running
[31/Oct/2009:10:48:38][2975.3083900608][-main-] Notice: nsmain: security info: uid=1001, euid=1001, gid=104, egid=104
[31/Oct/2009:10:48:38][2975.3074726832][-sched-] Notice: sched: starting
[31/Oct/2009:10:48:38][2975.3083900608][-main-] Notice: driver: starting: nssock
[31/Oct/2009:10:48:38][2975.2997271472][-nssock:driver-] Notice: starting
[31/Oct/2009:10:48:38][2975.2997271472][-nssock:driver-] Error: nssock: failed to listen on 192.168.1.15:80: Permission denied
[31/Oct/2009:10:48:38][2975.3083900608][-main-] Fatal: could not start drivers

because port 80 is not a user-land port. i will have to start the aolserver instance as root, while making sure that nothing else is listening on that port.
That means to make daemontools start aolserver as root user

Then, i shut down daemontools svc -d /service/openacs and I ran the command as root user:
svgroup root /service/*

I restarted the machine again. But it didn't work, daemontools still starts aolserver as openacs user.
I realized that some services of daemontools already run as root user and somehow it changes to openacs to start aolserver

root 2315 1 0 10:32 ? 00:00:00 /bin/sh /command/svscanboot
root 2321 2315 0 10:32 ? 00:00:00 svscan /service
root 2322 2315 0 10:32 ? 00:00:00 readproctitle service errors: ...ng threadsafe tcl: 1?[31/Oct/2009:10:56:06][3263.3083060928][-main-] Notice:
root 2323 2321 0 10:32 ? 00:00:00 supervise root
root 2947 2232 0 10:47 ? 00:00:00 sshd: openacs [priv]
openacs 2963 2947 0 10:48 ? 00:00:00 sshd: openacs@pts/0
openacs 2964 2963 0 10:48 pts/0 00:00:00 -sh
openacs 3277 2323 34 10:56 ? 00:00:02 /usr/local/aolserver/bin/nsd -it /usr/local/aolserver/servers/openacs/etc/config.tcl -u openacs -g web

Furthermore, if i shut down daemontools svc -d /service/openacs
I can start aolserver manually as root user using the command:

/usr/local/aolserver/bin/nsd-postgres -it /usr/local/aolserver/servers/openacs/etc/config.tcl -u openacs -g web

and everything works fine on port 80

I went back to the installation procedure of daemontools to verify where in daemontools i set openacs as the user to exec aolserver. But i have not found anything related.

That's how i compiled and install daemontools:

# Install Daemontools
mkdir -p /package
chmod 755 /package
cd /package
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
wget http://www.qmail.org/moni.csi.hu/pub/glibc-2.3.1/daemontools-0.76.errno.patch
tar -xvfz daemontools-0.76.tar.gz
cd admin/daemontools-0.76
patch -Np1 -i ../../daemontools-0.76.errno.patch
package/install
cvs -d:pserver:mailto:anonymous@cvs.openacs.org:/cvsroot co openacs-4/packages/acs-core-docs/www/files/svgroup.txt
mv openacs-4/packages/acs-core-docs/www/files/svgroup.txt /usr/sbin/svgroup
chmod 700 /usr/sbin/svgroup

How do i make daemontools to run the script under openacs/etc/daemontools/run as root user?

Collapse
2: Re: aolserver on port 80 (response to 1)
Posted by Victor Guerra on
Make sure that in your run script used by daemontools, you pass the option -b to nsd-postgres.

/usr/local/aolserver/bin/nsd-postgres -b 192.168.1.15:80 -it /usr/local/aolserver/servers/openacs/etc/config.tcl -u openacs -g web

Collapse
3: Re: aolserver on port 80 (response to 2)
Posted by Iuri Sampaio on
Victor,

Thanks Victor you were right on it
problem solved.