Files
baikal-sync/README.md
T

2.3 KiB

Baïkal Calendar Sync

An incremental CalDAV sync service that keeps your Baïkal calendar in sync with an Outlook ICS feed — with zero downtime and near-instant sync times.

Features

  • Incremental Delta Sync: Only adds, updates, or deletes events that actually changed
  • Zero Downtime: Adds/updates events before deleting removed ones — calendar never goes empty
  • Smart Change Detection: ETag check first, SHA-256 fallback. Skips sync when nothing changed
  • Stable Event Hashing: Ignores volatile fields (DTSTAMP, LAST-MODIFIED) to avoid false updates
  • Automatic Backoff: Exponential retry on failures (1m, 2m, 4m... max 30m)
  • Health Endpoint: Built-in /health and /metrics (Prometheus-compatible) on port 8081
  • Graceful Shutdown: SIGTERM/SIGINT handlers finish current sync before exiting
  • Docker Ready: Includes Dockerfile, docker-compose.yml, and HEALTHCHECK

Prerequisites

  • Docker & Docker Compose installed
  • An existing Baïkal instance
  • An Outlook ICS link

Configuration (Environment Variables)

Variable Description Default
ICS_URL The public ICS URL of your Outlook calendar. Required
BAIKAL_URL The URL to your Baïkal calendar. Required
BAIKAL_USER Your Baïkal username. Required
BAIKAL_PASS Your Baïkal password. Required
SYNC_FREQUENCY How often to sync in minutes. 5
CALENDAR_ID Optional calendar ID to match against.

Quick Start

  1. Clone or download this repository.

  2. Create a .env file (optional but recommended):

    ICS_URL="https://outlook.office365.com/owa/calendar/your-calendar.ics"
    BAIKAL_URL="https://your-baikal.com/dav.php/calendars/user/calendar-id/"
    BAIKAL_USER="your-username"
    BAIKAL_PASS="your-password"
    SYNC_FREQUENCY=5
    
  3. Run with Docker Compose:

    docker compose up -d
    
  4. Check Logs:

    docker compose logs -f baikal-sync
    
  5. Check Health:

    curl http://localhost:8081/health
    curl http://localhost:8081/metrics
    

Building & Publishing

  1. Build:

    docker build -t lagortinez/baikal-sync:latest .
    
  2. Push:

    docker push lagortinez/baikal-sync:latest