Card/caldav server setup for Sailfish device (in progress)

2018-05-24

Carddav and Caldav server setup compatible with Sailfish2 device.

What has been tested

  • Owncloud (prior to PHP7 compatibility)
  • Radicale
  • Davical
  • Baikal

Owncloud

Disclaimer The tested version was a version prior to the official PHP7 from Owncloud.
Result: works fine but as I didn't use the services from Owncloud (storage and such), I've decided to find a more lightweight solution.

Radicale

Result: This server writtend in python is easy to deploy (the easiest deployment I've found among card/caldav servers), works fine with Gnome Evolution, but I've never found out how to sync my contacts from or to my Sailfish device.

Davical

Partially tested, I did not manage to sync with my Sailfish device (maybe my fault).

Baikal

Written in PHP on top of Sabre/Dav, this server seems nice for now. Deployment is quite easy (even support SQLite3!).
It works on PHP7. Documentation is quite poor, but I managed to do a working setup from the github repo with my Sailfish device. Web frontend lacks of a vcard editor, but displays some useful stats (how many contacts synced for example).

Baikal setup on Debian 9.4 with SQLite3

As I need sync for only one user, my choice is to do a setup with SQLite3 which suits better m needs than an eavier database engine such as MariaDB.

Requirements

  • apache2
  • libapache2-mod-php7.0
  • php7
  • php7.0-sqlite3 (for sqlite only installation or php7.0-mysql if using mysql)
  • php7.0-mbstring
  • php7.0-xml

Installation

Install the requirements through your package-manager:

#> apt-get install apache2 libapache2-mod-php7.0 php7 php7.0-sqlite3 php7.0-mbstring php7.0-xml

Clone the latest version of Baikal on their official Github repository inside yout Apache DocumentRoot (e.g. /var/www/ ).
Note: at the moment of writing those lines, the latest Release is 0.4.6. The latest version in development is 0.5.0 according to the source files. This document uses the next to be 0.5.0 version.

While cloning the repository, have a look to the official documentation.

Configuration (for testing purposes only)

Important Note: DO NOT use this configuration for production purposes.
Now you need to configure yout Apache virtual host:

<VirtualHost *:80>
    DocumentRoot /var/www/baikal/html  
    ServerName dav.example.org  
    RewriteEngine On  
    RewriteRule /.well-known/carddav /dav.php [R,L]  
    RewriteRule /.well-known/caldav /dav.php [R,L]  
    <Directory "/var/www/baikal/html">
        Options None  
        Options +FollowSymlinks  
        AllowOverride All  
        Require all granted  
    </Directory>
</VirtualHost>

At the base of the installation directory (e.g. /var/www/baikal/ ), you need to have a server-writeable directory named Specific.

#> mkdir -p /var/www/baikal/Specific && chmod 777 /var/www/baikal/Specific

Then point your browser to the vhost and follow the instructions and that should be it.

Basic server configuration

Go to /admin and you will have something like this with some stats.
Note This is a test instance with already synced contacts.
Admin Pannel
In Users and ressources you can create your user for remote access.

Usage on Sailfish

Open the Settings, go to Accounts and add a CalDAV and CardDAV account.
Fill your accounts settings. Server address should be something like http://domain.tld/dav.php

Real-world deployment

SSL Certificate

First of all, you should have your own certificate from one of the big certificate authorities. If not, don't worry, Let's Encrypt is here.
Now you should install your certificate so Apache can use it for serving connections.

TO BE UPDATED