Replacing Baïkal with Radicale

I was becoming unhappy with Baïkal, my contact and calendar sync server: a growing number of clients was unable to use it, so I started to look for alternatives. This time I wanted something plain text based.


Probably one of the most attacked - as in argument - pages on the indieweb wiki 1 is the database-antipattern entry 2 ; it's one of those with which nearly all of us disagrees when they first come in contact with it.

Let me quote it:

The database antipattern is the use of a database for primary long-term storage of posts and other personal content (like on an indieweb site), and is an anti-pattern due to the additional maintenance costs, uninspectability, platform-dependence, and long-term fragility of databases and their storage files, as documented with specific examples below.

The important part is in bold: database as primary, long term storage. For syncing my contacts I've been using:

  • Baïkal 3 as server
  • DAVDroid 4 on my phone
  • Evolution 5 and Thunderbird 6 on desktop
  • Rainloop 7 as webmail

All of these can sync contacts, some calendars as well, all through the abomination called DAV, but all of them are storing these in some kind of database, mostly SQLite. SQLite is an ideal storage - for cache and for fast in-app lookups, but not for long term. If you've ever tried to import dumps from MySQL to SQLite or the other way around it quickly becomes visible why that antipattern entry was written.

So I decided to look for an alternative which would store my contacts in actual vcf and ics files. For the record, Baïkal has the actual VCF text in the database, so it's not much more than a regular file storage.

A quick search revealed a Python implementation, called Radicale 8 . Although it mentions that it has a backend, called multifilesystem , which uses per contact files, unfortunately I could not get that one running. So I'm running it with filesystem backend, which uses a single, merged file per resource.

It wasn't hard to get it running, and the documentation works fine as well, so if you want something that stores your contacts and calendars in plain text (well, ICS and VCF, not the most readable format, but it's text), radicale is out there, use it.

radicale.conf

[server]
hosts = 127.0.0.1:5232
daemon = True
pid = /tmp/radicale.pid
ssl = False
base_prefix = /radicale/
realm = Radicale - Password Required

[encoding]
request = utf-8
stock = utf-8

[well-known]
caldav = '/home/radicale/%(user)s/caldav/'
carddav = '/home/radicale/%(user)s/carddav/'

[auth]
type = IMAP

imap_hostname = my.imap.server
imap_port = 993
imap_ssl = True

[git]
committer = Peter Molnar <hello@petermolnar.eu>


[rights]
type = owner_only

[storage]
type = filesystem

filesystem_folder = /home/radicale/db

[logging]
config = /home/radicale/radicale_logging.conf


[headers]
#Access-Control-Allow-Origin = *

radicale_logging.conf

[loggers]
keys = root

[handlers]
keys = console,file

[formatters]
keys = simple,full

[logger_root]
level = WARNING
handlers = console,file

[handler_console]
class = StreamHandler
level = INFO
args = (sys.stdout,)
formatter = simple

[handler_file]
class = FileHandler
args = ('/home/radicale/log',)
formatter = full

[formatter_simple]
format = %(message)s

[formatter_full]
format = %(asctime)s - %(levelname)s: %(message)s

radicale_nginx.conf

location /radicale {
    try_files $uri @radicale;
}

location /.well-known/carddav {
    try_files $uri @radicale;
}

location /.well-known/caldav {
    try_files $uri @radicale;
}

location @radicale {      
    proxy_set_header Proxy "";
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header Proxy-Connection "";
  proxy_ignore_client_abort on;
  proxy_pass http://127.0.0.1:5232;
}

  1. http://indieweb.org/

  2. http://indieweb.org/database-antipattern

  3. http://sabre.io/baikal/

  4. https://davdroid.bitfire.at/

  5. https://wiki.gnome.org/Apps/Evolution/

  6. https://www.mozilla.org/en-GB/thunderbird/

  7. http://www.rainloop.net/

  8. http://radicale.org/