The Radicale CalDAV/CardDAV server as a Docker container.
Create the radicale data directory containing a minimal configuraion. We assume the directory /srv/radicale/data.
Minimal configuration /srv/radicale/data/config.ini:
[auth]
type = htpasswd
# note: that's a path inside the container
htpasswd_filename = /var/radicale/users
# encryption method used in the htpasswd file
htpasswd_encryption = bcrypt
[server]
hosts = 0.0.0.0:8000
[storage]
filesystem_folder = /var/radicale/collections
Run the docker image, and connect it to the HTTP port 80:
docker run -v /srv/radicale/data:/var/radicale -p80:8000 -n radicale xlrl/radicale
Create some users:
# Create a new htpasswd file with the user "user1"
docker exec -ti radicale htpasswd -B -c /var/radicale/users user1
New password:
Re-type new password:
# Add another user
docker exec -ti radicale htpasswd -B -c /var/radicale/users user2
New password:
Re-type new password:
Now point your web browser to the address of the docker server. You should be presented with the Radicale login.
To launch your container with docker-compose you can use this sample :
version: '3.8'
services:
radicale:
build: .
container_name: radicale
environment:
- GIT_REPOSITORY=https://user:[email protected]/user/repo
- GIT_USERNAME=username
- [email protected]
- RADICALE_USER=username
- RADICALE_PASS=userpassword
ports:
- "8000:8000"
volumes:
- /srv/radicale:/var/radicale
Environment variables :
Variable | Descriptions |
---|---|
GIT_REPOSITORY | Your git repo with your username or your password if it's a private repo |
GIT_USERNAME | Your name for the git signature |
GIT_EMAIL | Your mail for the git signature |
RADICALE_USER | Your radicale user |
RADICALE_PASS | The password for your user |
Version the changes to your radicale data your changes using GIT.
Create a .gitignore file in srv/radicale/data:
.Radicale.cache
.Radicale.lock
.Radicale.tmp-*
Configure the GIT hook in /srv/radicale/data/config.ini:
[storage]
filesystem_folder = /var/radicale/collections
hook = git add -A && (git diff --cached --quiet || git commit -m "Changes by "%(user)s)
Initialize the GIT repository:
docker@myhost ~ # cd /srv/radicale/data
docker@myhost /srv/radicale/data # git init
Initialized empty Git repository in /srv/radicale/data/.git/
docker@myhost /srv/radicale/data # git add .
docker@myhost /srv/radicale/data # git commit -m "Initial commit."
[master (root-commit) abcdefab] Initial commit.
5 files changed, 17 insertions(+)
create mode 100644 .gitignore
create mode 100644 config.ini
create mode 100644 users