On Friday, November 7, 2003, at 06:47 PM, Frank Barknecht wrote:
> Randall Randall hat gesagt: // Randall Randall wrote:
>> Writing the deamontools startup script is about three lines.
> Do you have some tips for setting up daemontools for Webware? I never
> used them, but I now installed them and the documentation is, well,
> sparse. I tried copying "AppServer" to "run" and ran "supervise
> Workdir" but that does not seem to be all that is needed. I explicitly
> crashed the server, and supervise tried to restart it failing with
> "error: (98, 'Address already in use')"
I'm not sure why it would do that, but what you did isn't what
I did. I made another directory which isn't under the Webware
workdir, and used that as my supervise directory. Using the
workdir as the supervise directory seems like it should work,
though, if you're using the right run script.
> It tried and tried and tried...
> So there must be more to it that just what I did...
Yeah, the run script could look something like what's between
========== begin run script for Webware =============
exec setuidgid yourusername /path/to/Launch.py ThreadedAppServer
========== end run script for Webware =============
The "setuidgid" program allows you to let your users run
Webware installs as themselves. If you want to run it as
root, you should be able to omit the "setuidgid yourusername"
The run file should NOT be writable by anyone but root, as
changing that line would allow the writer to run any program
as root! This is not just a hypothetical problem, by the way.
If you want logging, and probably you do, you should make a
directory in the same directory that your "run" script is in,
called "log", and in there have this:
========== begin run script for logging =============
exec setuidgid yourusername multilog t ./main
========== end run script for logging =============
Your supervise directory might then look like this, if
it's called "myapp":
randall@... testing $ ls -l myapp/*
-rwxr--r-- 1 root root 93 Nov 8 01:34 myapp/run
drwx------ 2 randall users 4096 Nov 8 01:40 main
-rwxr--r-- 1 root root 61 Nov 8 01:29 run
Note that daemontools will restart the appserver if it quits
for *any* reason, so the restart on changes thing works
normally even though you're not running the shell code that
checks the return code of the Launch.py script.
If you want to stop it for a while, as root do
svc -d /service/myapp/
assuming you called yours "myapp", which you probably won't. :)
svc -u /service/myapp
resumes normal services and will restart the appserver if it
stops for any reason.