[CalendarServer-users] Building for Mac OS X client
Steve Burling
srb at umich.edu
Mon Jul 13 18:37:31 PDT 2009
In hopes that this saves someone else some trouble...
I've been running CalendarServer in "developer" mode for about a year, but
I recently moved my server to a shiny new Mac Mini, and decided it was time
to do this "right", as directed in the "run" script. Here, as best as I
could keep track as I was doing it, is what I ended up doing to get this
working. This is much tided up -- there were a lot of fits and starts
while I was actually figuring things out.
(Some of these changes were because I wanted to run the server as the
calendar user, which doesn't have rights to write to /var/run, so I had to
move some files down a level.)
# A place to build the server...
mkdir /usr/local/caldavd
cd /usr/local/caldavd
# Check out the sources, see
<http://trac.calendarserver.org/wiki/Repository> for the svn command
# Build the server
cd /usr/local/caldavd/CalendarServer
./run -s
# Making the installation (below) doesn't copy memcached to /usr/local/bin,
# apparently assuming it can be found via the PATH, but that didn't work
# for me, so...
cp /usr/local/caldavd/memcached-1.2.6/memcached /usr/local/bin
# Make required changes to twistedcaldav/stdconfig.py -- see the notes
# at the end of this document, which detail the steps I went through to
# ultimately arrive at these changes.
# In particular:
# change references to /var/run/caldavd.xxx to
/var/run/caldavd/caldavd.xxx
# change references to /usr/share/caldavd/bin to /usr/local/bin, since
# that's where other things get installed
# update the entry for memcached so that it has the full path:
# /usr/local/bin/memcached
# Make the instalation
./run -i /tmp/caldavd
cd /tmp/caldavd
sudo chown -R calendar:calendar .
sudo pax -pe -rvw . /
# Move caldavd.plist to a more sensible (to me!) place
mkdir /etc/caldavd
mv
System/Library/Frameworks/Python.framework/Versions/2.5/caldavd/caldavd.plist
/etc/caldavd
# Get sample accounts.xml and sudoers.xml
cp /usr/local/caldavd/CalendarServer/conf/auth/accounts-test.xml
/etc/caldavd/accounts.xml
cp /usr/local/caldavd/CalendarServer/conf/sudoers.plist /etc/caldavd
chown -R calendar:calendar /etc/caldavd
chmod g+s /etc/caldavd
chmod -R g+w /etc/caldavd*
# Edit caldavd.plist, accounts.xml and sudoers.plist as appropriate.
# The changes to caldavd.plist were:
# ports for HTTP and HTTPS, and enabling HTTPS
# Adding the location of the server key and certificate (I made a
self-signed cert)
# changing bare references to /var/run to /var/run/caldavd
# changing the usergroup from daemon:daemon to calendar:calendar
# Pruned the heck out of accounts.xml
# Left sudoers.plist unchanged
# Make required directories
mkdir /Library/CalendarServer
chown calendar:calendar /Library/CalendarServer
chmod g+ws /Library/CalendarServer
mkdir /var/run/caldavd
chown calendar:calendar /var/run/caldavd
chmod g+ws /var/run/caldavd
mkdir /var/log/caldavd
chown calendar:calendar /var/log/caldavd
chmod g+ws /var/log/caldavd
# Try starting the server. Check /var/log/caldavd/error.log for problems.
# Rinse and repeat.
sudo -u calendar /usr/local/bin/caldavd -f /etc/caldavd/caldavd.plist
# Notes
#
# The first problem was that for some reason, we ended up in
/usr/local/caldavd/CalendarServer/calendarserver/tap/caldav.py, which gets
config info from
/usr/local/caldavd/CalendarServer/twistedcaldav/stdconfig.py, which has bad
references to files in /var/run, rather than /var/run/caldavd. Try fixing
those.
# It turns out that if you run /usr/local/bin/caldavd with cwd=/, then we
more properlly ended up in
/Library/Python/2.5/site-packages/calendarserver/tap/caldav.py, which
(presumably) gets config info from
/Library/Python/2.5/site-packages/twistedcaldav/stdconfig.py, which still
has bad references to files in /var/run, rather than /var/run/caldavd. Try
fixing those.
# /Library/Python/2.5/site-packages//twistedcaldav/stdconfig.py has
references to /usr/share/caldavd/bin. Change those to /usr/local/bin,
since that's where things get installed.
# /Library/Python/2.5/site-packages/twisted/internet/process.py at line 442
does an os.execvpe call that results in a "No such file or directory"
error, with no notation about the file name. Add some debugging code just
before line 395 to print out the value of the 'executable' variable, to try
to chase this down. (Actually, I subsequently discovered that Ithink there
was something in the log that had the missing file name, so that change was
unnecessary. Oh, well.)
# Looks like it's memcached, so copied binary from
/usr/local/caldavd/memcached-1.2.6/memcached to /usr/local/bin, and updated
reference in twistedcaldav/stdconfig.py to include path.
# Remove debugging code from
/Library/Python/2.5/site-packages/twisted/internet/process.py
# Ultimately, all the problems seemed to be with stdconfig.py, so I added
the step early in the process above to make these changes before doing the
install.
I also made a launchd file to start the server (and keep it running). Let
me know if you'd like a copy.
--
Steve Burling <mailto:srb at umich.edu>
University of Michigan, ICPSR Voice: +1 734 615.3779
330 Packard Street FAX: +1 734 647.8700
Ann Arbor, MI 48104-2910
More information about the calendarserver-users
mailing list