Calendar server
2012-02-11
Revision History | ||
---|---|---|
Revision 0.1 | 2012-02-11 | FU |
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.
Software | calendarserver | squeeze | wheezy | sid | debian |
---|---|---|---|---|---|
python | 2.7.1 | 2.6.6-3+squeeze6 | 2.7.2-10 | 2.7.2-10 | python |
libevent | 1.4.13-stable | 1.4.13-stable-1 | - | - | libevent-1.4-2 |
libevent | 1.4.13-stable | - | 2.0.16-stable-1 | 2.0.16-stable-1 | libevent-2.0-5 |
memcached | 1.4.5 | 1.4.5-1 | 1.4.7-0.1+b1 | 1.4.7-0.1+b1 | memcached |
postgres | 9.0.3 | 8.4.10-0squeeze1 | 9.1+128 | 9.1+128 | postgresql |
openldap | 2.4.25 | 2.4.23-7.2 | 2.4.28-1.1 | 2.4.28-1.1 | slapd |
setuptools | 0.6c11 | 0.6.14-4 | 0.6.24-1 | 0.6.24-1 | python-setuptools |
zope.interface | 3.3.0 | 3.5.3-1+b1 | 3.6.1-1 | 3.6.1-1 | python-zope.interface |
pyxml | 0.8.4 | - | - | - | python-xml->python |
pyopenssl | 0.10 | 0.10-1 | 0.13-1 | 0.13-1 | python-openssl |
PyKerberos | - | 1.1+svn4895-1+b1 | 1.1+svn4895-1+b2 | 1.1+svn4895-1+b2 | python-kerberos |
PyOpenDirectory | - | - | - | - | - |
xattr | 0.6.1 | 0.4-5+squeeze1 | 0.6.2-1 | 0.6.2-1 | python-xattr |
cx_Oracle | 5.1 | - | - | - | - |
PyGreSQL | 4.0 | 1:4.0-2+b1 | 1:4.0-3 | 1:4.0-3 | python-pygresql |
twisted | 11.0.0 | 10.1.0-3 | 11.1.0-1 | 11.1.0-1 | python-twisted |
python-dateutil | 1.5 | 1.4.1-3 | 1.5-1 | 1.5-1 | python-dateutil |
python-ldap | 2.3.13 | 2.3.11-1 | 2.3.13-1 | 2.3.13-1 | python-ldap |
pycalendar | r188 | - | - | - | - |
sqlparse | 0.1.2 | - | 0.1.3-1 | 0.1.3-1 | python-sqlparse |
pyflakes | 0.4.0 | 0.4.0-1 | 0.5.0-1 | 0.5.0-1 | pyflakes |
CalDAVClientLibrary | trunk | - | - | - | - |
CalDAVTester | trunk | - | - | - | - |
pytz | 2011g | 2010b-1 | 2011h-1 | 2011h-1 | python-tz |
pydoctor | 0.3 | 0.3-1 | 0.3+bzr567-1 | 0.3+bzr567-1 | python-pydoctor |
After collecting the dependencies I tried to build a debian package. I first cloned the repsitory using git.
git
svn clone --stdlayout
http://svn.macosforge.org/repository/calendarserver/CalendarServer
Then merge it into the master :
git merge remotes/trunk
master
Next was to generate a release to work with. To get a "pure" server package I ran
./setup.py sdist --dist-dir=../
--prune
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
-rfakeroot
builds the package. Then install
sudo dpkg -i
../calendarserver_4.1-SVNVERSION_all.deb
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
-L
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
calendarserver_bootstrap_database
.
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.
/etc/init.d/memcached
stop
. 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.