Welcome the company of trees

Calendar server


Revision History
Revision 0.12012-02-11FU
Initial version

In the quest to set up a server a solution calendaring and contacts became necessary. After comparing Apples calendarserver and Davical the choice came to calendarserver at the end. Both seemed OK, but calendarserver did not need a database (version 2.X), and was written in python. Davicals php and database would have required more maintenance and setup. Both had at the time valid debian packages. Now fast forward to 2012.

Debianizing calendarserver

The debian package for calendarserver does not seem to be maintained anymore. The need for a working carddav solution made me bite the bullet and try to upgrade my installation to the latest version. The initial work started with getting the trunk (using git svn).

Target was a squeeze server but to begin with the porting was done on sid. To try to find the correct dependencies, the run script and supporting scripts was the start. There were no proper dependency list on the calendarserver homepage.

Table 1. Calendarserver dependencies

After collecting the dependencies I tried to build a debian package. I first cloned the repsitory using git.

    svn clone --stdlayout

Then merge it into the master :

git merge remotes/trunk

Next was to generate a release to work with. To get a "pure" server package I ran

./setup.py sdist --dist-dir=../

following some of the instructions from the post Creating a .deb package from a python setup.py At first, as I use git the svnversion command fails. I created a small script to deal with that ~/bin/svnversion : #!/bin/bash REV=`git svn find-rev master` echo -n $REV This creates a tar.gz package that is almost usable. The version number is not what debian wants, and creating a versioned tree is not that easy. That is why the support/version.py exists. The dependency of this file is a bit problematic as support is not a part of the source package.

To get around the issues with version and a external non packaged reference to versions.py, I made a build.sh script, and applied some patches to my environment, builds a source package, unpacks it and adds the debian directory directory. Later it has to be adapted to take the svn branch and apply the patches via debian quilt. Once all is set up

dpkg-buildpackage -i -I

builds the package. Then install

sudo dpkg -i

Debian directory

I started out with a very basic debian directory, with an almost empty control file. Also the changelog is very crude. It first became clear that python 2.7 was needed so I set that as required python version for now.

Next step was to iterate and find out what dependencies existed and what problems existed with debian that might require patches. I did this by just testrunning the

sudo caldavd -X

directly in /usr/bin. Following is the list of the packages I installed (in brackets dependencies) : python-twisted-core (11.1.0-1) [ python-openssl (0.13-1) python-pam (0.4.2-12.3+b1) python-serial (2.5-2.1) python-zope.interface (3.6.1-1)? ] python-twisted-mail (11.1.0-1) [ python-twisted-names (11.1.0-1) ] python-twisted-web (11.1.0-1) python-dateutil (1.5-1)

      git svn clone http://svn.mulberrymail.com/repos/PyCalendar/branches/server pycalendar
      python ./setup.py sdist --dist-dir=../ --prune
      cd ..
      py2dsc pycalendar-2.0.tar.gz
      cd deb_dist/pycalendar-2.0
      dpkg-buildpackage -rfakeroot -uc -us
      sudo dpkg -i ../python-pycalendar_2.0-1_all.deb

python-pycalendar (2.0-1) python-pygresql (1:4.0-3) [ libpq5 (9.1.2-4) python-egenix-mxtools (3.2.1-1) python-egenix-mxdatetime (3.2.1-1) ] python-xattr (0.6.2-1) python-sqlparse (0.1.3-1) [ libjs-underscore (1.3.1-1) libjs-sphinxdoc (1.1.2+dfsg-5) ]

      mkdir /var/db/caldavd
      chown daemon.daemon /var/db/caldavd
      mkdir /var/log/caldavd

Now we reached the place where we have to configure postgres. First enable it in the caldav.plist and the set up Postgres postgresql-9.1 (9.1.2-4) [ postgresql-client-common (128) postgresql-client-9.1 (9.1.2-4) postgresql-common (128) ] Then it is time to set up the caldav user and database. This can also be done with the


. I made changes to the command to make it work with Debian, but still more improvments could be made. For testing I added the follwing /etc/postgresql/9.1/main/pg_hba.conf to make it work on debian. # TYPE DATABASE USER ADDRESS METHOD local caldav caldav trust This is currently highly insecure (calendars are readable by users on the system), but for now I have not created a better solution. Once I add a user caldav to the system I can use peer, limiting the access to the caldav user.

Once the database is installed we install memcached (1.4.7-0.1+b1) and that service will be started by caldavd so we stop it now.


. If it is running it will interfere with the calendarserver that starts it from within the server. Need to investigate if this behavior can be changed configured.