[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Re: netsync via inetd / xinetd
From: |
graydon hoare |
Subject: |
[Monotone-devel] Re: netsync via inetd / xinetd |
Date: |
Tue, 06 Apr 2004 12:44:20 -0400 |
User-agent: |
Mozilla Thunderbird 0.5 (X11/20040208) |
Peter Simons wrote:
Has, by any chance, someone figured out how to run the
Monotone netsync server via inetd or xinetd? And is willing
to share the configuration file? :-)
I don't think this will work as well as you're hoping; inetd and xinetd
make 1 server process per connection. netsync service already
multiplexes connections in a single process. indeed, it will get a bit
confused if there are multiple writers. probably a lot of connections
will fail due to a file lock.
what I am doing instead is running 1 server process under daemontools.
this has the advantage of operating entirely in "non-administrative"
space (runs as a normal user in my home directory) and is pretty much
self contained. maybe I'll add this to the docs (or we could acquire a
wiki):
I have a directory in $HOME/netsync-server laid out like this:
bin/{monotone,supervise,svscan,svc,svok,multilog,tai64nlocal}
service/default-server/run
service/default-server/service.lua
service/default-server/keys.txt
service/default-server/log/run
service/default-server/log/main (an empty directory)
run-monotone-server.sh
follow-monotone-logs.sh
I put this in my crontab:
@reboot cd $HOME/netsync-server && ./run-monotone-server.sh
$ cat service/default-server/run
#!/bin/sh
COLLECTION=net.venge.monotone
HOSTNAME=`hostname -f`
RCFILE=service.lua
KEYS=keys.txt
DB=monotone.db
if [ ! -e $DB ]
then
monotone --db=$DB db init
monotone --db=$DB read <$KEYS
fi
exec monotone --db=$DB --rcfile=$RCFILE serve $HOSTNAME $COLLECTION 2>&1
$ cat service/default-server/log/run
#!/bin/sh
exec ./multilog t ./main
$ cat run-monotone-server.sh
#!/bin/sh
env - PATH=`pwd`/bin:/usr/bin:/bin svscan ./service &
$ cat follow-monotone-logs.sh
#!/bin/sh
tail -n 500 -f ./service/default-server/log/main/current \
| ./bin/tai64nlocal
the contents of keys.txt is a set of keys for people I want to
communicate in an authenticated manner off the bat. it'll absorb other
keys from these users as they sync.
the contents of service.lua defines the permissions and preferences for
this server. I'm not going to paste that in here, but it contains the
get_netsync_*_permitted() hooks, as well as the arc4 passphrase and the
hook to enable persistent passphrases.
-graydon