KnowHow DB
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Contacts/Calendar server with Radicale

Radicale is a CalDAV and CardDAV server.

Server setup

Docker

The radicale service will be run in a docker container using our reverse proxy.

Radicale doesn’t provide an image on dockerhub, but has a dockerfile on github, which we slightly adjust:

FROM python:3-alpine

ARG VERSION=master
VOLUME /var/lib/radicale
VOLUME /etc/radicale
EXPOSE 80
CMD ["radicale", "--config", "/etc/radicale/radicale.ini"]

RUN apk add --no-cache build-base ca-certificates openssl
RUN pip install --no-cache-dir "Radicale[bcrypt] @ https://github.com/Kozea/Radicale/archive/${VERSION}.tar.gz"
RUN apk del build-base

Next we’ll create a docker-compose.yml in the same folder as our dockerfile:

version: "3.9"

services:
    radicale:
        build: .
        networks: ["server"]
        restart: "always"
        labels:
            - "traefik.enable=true"
            - "traefik.http.routers.radicale.rule=Host(`radicale.<YOUR_DOMAIN>`)"
        volumes:
            - "./data/persistence:/var/lib/radicale"
            - "./data/config:/etc/radicale"

networks:
    server:
        external: true

In the docker-compose file we mounted two volumes data/persistence and data/config. Persistence is used to store calendar/contacts data for each user. We’ll use the config folder to configure radicale:

  1. Create a new file data/config/radicale.ini
    [server]
    # Bind all addresses
    hosts = 0.0.0.0:80
    
    [auth]
    type = htpasswd
    htpasswd_filename = /etc/radicale/users
    htpasswd_encryption = bcrypt
    [storage]
    filesystem_folder = /var/lib/radicale/collections
    [web]
    type = internal
    [rights]
    type = owner_only
    [logging]
    level = warning
    
  2. Setup users
    • Create a new file data/config/users and add each user like this, separated by linebreak:
      <USERNAME>:<BCRYPT_PASSOWRD_HASH>
    • To create a password hash with bcrypt use the following python script
      python3 -c 'import bcrypt; print(bcrypt.hashpw(b"<PLAIN_PASSWORD>", bcrypt.gensalt(rounds=15)).decode("ascii"))'
      

Now you should be able to access the webservice of radicale via browser (radicale.<YOUR_DOMAIN>) and login with the credentials from the users file. After creating a calendar and an address book you should see them listed with their urls, which are needed for client setup.

Collections

Client setup

  1. Install the extensions TbSync and Provider für CalDAV & CardDAV

  2. Click TbSync in the bottom right corner of thunderbird status panel and create a new account

    TbSync account setup

  3. Select manual configuration

  4. Fill in your credentials and the calendar/contacts urls from the radicale collections web ui.

After synchronizing you should now see your calender in lightning and your contacts in the address book.

  1. Install DAVx⁵ (Provider for cardDav/calDav)
  2. Add account and select “Login with URL and user name”
  3. Enter url for calendar collection and your credentials
  4. Repeat for contacts

You should now be able to select your calendar in the calendar app (e.g. Etar) and your contacts in the contacts app (e.g. Simple contacts).

With the app Birthday Adapter you can view your contacts birthdays in the calendar.

Sources