Index: openacs-4/packages/acs-core-docs/www/install-openacs-keepalive.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/install-openacs-keepalive.html,v diff -u -r1.25 -r1.26 --- openacs-4/packages/acs-core-docs/www/install-openacs-keepalive.html 7 Aug 2017 23:47:50 -0000 1.25 +++ openacs-4/packages/acs-core-docs/www/install-openacs-keepalive.html 8 Nov 2017 09:42:11 -0000 1.26 @@ -1,69 +1,109 @@ -
The simplest way to start and stop and OpenACS site is to run the startup shell script provided, /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools/run
. This runs as a regular task, and logs to the logfile. To stop the site, kill the script.
A more stable way to run OpenACS is with a "keepalive" mechanism of some sort, so that whenever the server halts or is stopped for a reset, it restarts automatically. This is recommended for development and production servers.
The Reference Platform uses Daemontools to control AOLserver. A simpler method, using init
, is here.
Daemontools must already be installed. If not, install it.
Each service controlled by daemontools must have a +
The simplest way to start and stop and OpenACS site is to run the startup shell script provided, /var/lib/aolserver/
. This runs as a regular task, and logs to the logfile. To stop the site, kill the script.$OPENACS_SERVICE_NAME
/etc/daemontools/run
A more stable way to run OpenACS is with a "keepalive" mechanism of some sort, so that whenever the server halts or is stopped for a reset, it restarts automatically. This is recommended for development and production servers.
+The Reference Platform uses Daemontools to control AOLserver. A simpler method, using init
, is here.
Daemontools must already be installed. If not, install it.
+Each service controlled by daemontools must have a
directory in /service
. That
directory must have a file called
- run
. It works like this:
The init
program starts every
+ run
. It works like this:
The init
program starts every
time the computer is booted.
A line in init
's configuration
file, /etc/inittab
, tells init to
run, and to restart if necessary,
svscanboot
.
svscanboot
checks
the directory /service
- every few seconds.
If it sees a subdirectory there, it + every few seconds.
+If it sees a subdirectory there, it
looks for a file in the subdirectory called
- run
. If it finds a run file, it creates a supervise
process
supervise
executes the run script. Whenever the run script stops, supervise
executes it again. It also creates additional control files in the same directory.
Hence, the AOLserver
+ run
. If it finds a run file, it creates a supervise
process
supervise
executes the run script. Whenever the run script stops, supervise
executes it again. It also creates additional control files in the same directory.
Hence, the AOLserver
instance for your development server is started by the file
/service/$OPENACS_SERVICE_NAME/run
.
But we use a symlink to make it easier to add and remove
stuff from the /service
, so
the actual location is
- /var/lib/aolserver/$OPENACS_SERVICE_NAMEetc/daemontools/run
.
Daemontools creates additional files and directories to track status and
+ /var/lib/aolserver/
.$OPENACS_SERVICE_NAME
etc/daemontools/run
Daemontools creates additional files and directories to track status and
log. A daemontools directory is included in the OpenACS tarball at
- /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools
. To use it, first ill any existing AOLserver instances. As root, link the daemontools
directory into the /service
directory. Daemontools' svscan
process checks this directory every five seconds, and will quickly execute run
.
[$OPENACS_SERVICE_NAME etc]$killall nsd
+/var/lib/aolserver/
. To use it, first ill any existing AOLserver instances. As root, link the$OPENACS_SERVICE_NAME
/etc/daemontoolsdaemontools
directory into the/service
directory. Daemontools'svscan
process checks this directory every five seconds, and will quickly executerun
. + +[$OPENACS_SERVICE_NAME etc]$killall nsd
nsd: no process killed -[$OPENACS_SERVICE_NAME etc]$emacs /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools/run
+[$OPENACS_SERVICE_NAME etc]$emacs /var/lib/aolserver/
[$OPENACS_SERVICE_NAME etc]$$OPENACS_SERVICE_NAME
/etc/daemontools/runexit
-[root root]#ln -s /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/daemontools/ /service/$OPENACS_SERVICE_NAME
Verify that AOLserver is running.
[root root]#+ps -auxw | grep nsd
-$OPENACS_SERVICE_NAME 5562 14.4 6.2 22436 15952 ? S 11:55 0:04 /usr/local/aolserver/bin/nsd -it /var/lib/aolserver/$OPENACS_SERVICE_NAME/etc/config.tcl -u serve +[root root]#ln -s /var/lib/aolserver/
$OPENACS_SERVICE_NAME
/etc/daemontools/ /service/$OPENACS_SERVICE_NAME
Verify that AOLserver is running.
+[root root]#ps -auxw | grep nsd
+$OPENACS_SERVICE_NAME
5562 14.4 6.2 22436 15952 ? S 11:55 0:04 /usr/local/aolserver/bin/nsd -it /var/lib/aolserver/$OPENACS_SERVICE_NAME
/etc/config.tcl -u serve root 5582 0.0 0.2 3276 628 pts/0 S 11:55 0:00 grep nsd -[root root]#
The user $OPENACS_SERVICE_NAME can now control the service $OPENACS_SERVICE_NAME with these commands:
+[root root]# +
The user $OPENACS_SERVICE_NAME
can now control the service $OPENACS_SERVICE_NAME
with these commands:
- svc -d /service/$OPENACS_SERVICE_NAME
-
+ svc -d /service/
-
Bring the server down
$OPENACS_SERVICE_NAME
- svc -u /service/$OPENACS_SERVICE_NAME
-
+ svc -u /service/
-
Start the server up and leave it in keepalive mode.
$OPENACS_SERVICE_NAME
- svc -o /service/$OPENACS_SERVICE_NAME
-
+ svc -o /service/
-
Start the server up once. Do not restart it if it stops.
$OPENACS_SERVICE_NAME
- svc -t /service/$OPENACS_SERVICE_NAME
-
+ svc -t /service/
-
Stop and immediately restart the server.
$OPENACS_SERVICE_NAME
- svc -k /service/$OPENACS_SERVICE_NAME
-
+ svc -k /service/
-
Sends the server a KILL signal. This is like KILL -9. AOLserver
exits immediately. If svc -t fails to fully kill AOLserver, use
this option. This does not take the server out of keepalive mode, so it should still bounce back up immediately.
- $OPENACS_SERVICE_NAME
Install a script to automate the stopping and starting
- of AOLserver services via daemontools. You can then restart a service via restart-aolserver $OPENACS_SERVICE_NAME
[root root]# cp /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/acs-core-docs/www/files/restart-aolserver-daemontools.txt /usr/local/bin/restart-aolserver
+
Install a script to automate the stopping and starting
+ of AOLserver services via daemontools. You can then restart a service via restart-aolserver
$OPENACS_SERVICE_NAME
[root root]#cp /var/lib/aolserver/
[root root]#$OPENACS_SERVICE_NAME
/packages/acs-core-docs/www/files/restart-aolserver-daemontools.txt /usr/local/bin/restart-aolserverchmod 755 /usr/local/bin/restart-aolserver
-[root root]#
+[root root]# +
At this point, these commands will work only for the
- root
user. Grant permission for the web
group to use svc
commands on the $OPENACS_SERVICE_NAME server.
[root root]# /usr/local/bin/svgroup web /service/$OPENACS_SERVICE_NAME
-[root root]#
Verify that the controls work. You may want to tail -f /var/lib/aolserver/$OPENACS_SERVICE_NAME/log/$OPENACS_SERVICE_NAME-error.log
in another window, so you can see what happens when you type these commands.
-
+ root
user. Grant permission for the web
group to use svc
commands on the $OPENACS_SERVICE_NAME
server.
[root root]# /usr/local/bin/svgroup web /service/$OPENACS_SERVICE_NAME
+[root root]#
+ Verify that the controls work. You may want to tail -f /var/lib/aolserver/
in another window, so you can see what happens when you type these commands.
+ $OPENACS_SERVICE_NAME
/log/$OPENACS_SERVICE_NAME
-error.log
More information can be found on the AOLserver Daemontools page. -
Table 6.1. How it Works