Skip to content

Deploying SabreDAV

Introduction

SabreDAV is an open-source WebDAV, CardDAV, and CalDAV server written in PHP. It provides a standards-compliant foundation for file sharing, contact synchronization, and calendar management across devices and platforms. SabreDAV powers the synchronization backends of many popular projects including ownCloud and Nextcloud.

As a library-first project, SabreDAV offers flexibility for building custom DAV solutions while also functioning as a standalone server. Its modular architecture allows implementing only the features you need, from simple WebDAV file servers to full groupware solutions.

Key highlights of SabreDAV:

  • CardDAV Support: Sync contacts across all devices
  • CalDAV Support: Calendar synchronization with reminders
  • WebDAV: Standards-compliant file sharing
  • Lightweight: Minimal resource requirements
  • PHP-Based: Easy to deploy and customize
  • Modular Design: Use only what you need
  • Client Compatibility: Works with all major clients
  • Authentication: Flexible authentication backends
  • ACL Support: Access control lists for permissions
  • Scheduling: CalDAV scheduling and free/busy
  • Well-Documented: Extensive developer documentation

This guide walks through deploying SabreDAV on Klutch.sh using Docker, configuring CalDAV and CardDAV services, and connecting clients.

Why Deploy SabreDAV on Klutch.sh

Deploying SabreDAV on Klutch.sh provides several advantages for personal data sync:

Simplified Deployment: Klutch.sh automatically builds your SabreDAV configuration without complex setup.

Persistent Storage: Attach volumes for calendars, contacts, and configuration. Your data survives restarts.

HTTPS by Default: Essential for secure DAV synchronization with automatic SSL certificates.

GitHub Integration: Store configuration in version control for reproducible deployments.

Lightweight Hosting: SabreDAV’s minimal requirements make it cost-effective to host.

Always-On Sync: 24/7 availability ensures your devices stay synchronized.

Prerequisites

Before deploying SabreDAV on Klutch.sh, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your SabreDAV configuration
  • Basic familiarity with Docker and PHP
  • (Optional) SQLite, MySQL, or PostgreSQL database
  • (Optional) A custom domain for your SabreDAV server

Deploying SabreDAV on Klutch.sh

    Create Your Repository

    Create a new GitHub repository for your SabreDAV deployment. Add a Dockerfile:

    FROM php:8.2-apache
    RUN apt-get update && apt-get install -y \
    libsqlite3-dev \
    unzip \
    && docker-php-ext-install pdo pdo_sqlite \
    && rm -rf /var/lib/apt/lists/*
    RUN a2enmod rewrite
    WORKDIR /var/www/html
    RUN curl -L https://github.com/sabre-io/Baikal/releases/download/0.9.4/baikal-0.9.4.zip -o baikal.zip \
    && unzip baikal.zip \
    && mv baikal/* . \
    && rm -rf baikal baikal.zip \
    && chown -R www-data:www-data /var/www/html
    EXPOSE 80
    HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
    CMD curl -f http://localhost/ || exit 1

    Note: This uses Baikal, a popular SabreDAV-based server with a web interface.

    Push to GitHub

    Commit and push your Dockerfile to your GitHub repository.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project.

    Create a New App

    Within your project, create a new app. Connect your GitHub account and select your repository.

    Configure HTTP Traffic

    In the deployment settings:

    • Select HTTP as the traffic type
    • Set the internal port to 80

    Attach Persistent Volumes

    Add volumes for data and configuration:

    Mount PathRecommended SizePurpose
    /var/www/html/Specific1 GBDatabase and configuration
    /var/www/html/config100 MBConfiguration files

    Deploy Your Application

    Click Deploy to start the build process.

    Complete Setup Wizard

    Access your deployment and complete the web-based setup:

    1. Set admin password
    2. Configure database
    3. Create users

Initial Configuration

Admin Setup

Complete initial configuration:

  1. Access /admin/ on your deployment
  2. Set timezone and server settings
  3. Configure authentication
  4. Create user accounts

User Management

Create users and resources:

  1. Navigate to Users section
  2. Add new users with passwords
  3. Users can create their own calendars/address books
  4. Configure per-user settings

Database Options

SabreDAV supports multiple databases:

DatabaseUse Case
SQLiteSmall installations, easy setup
MySQLLarger deployments, better performance
PostgreSQLEnterprise features

CalDAV Configuration

Calendar Features

SabreDAV CalDAV provides:

  • Multiple calendars per user
  • Shared calendars
  • Calendar subscriptions
  • Event reminders (VALARM)
  • Recurring events
  • Free/busy queries

Calendar URLs

Access calendars at:

https://your-server/cal.php/calendars/username/calendar-name/

Sharing Calendars

Share calendars between users:

  1. Access calendar properties
  2. Add sharing recipients
  3. Set read or read-write access

CardDAV Configuration

Address Book Features

Contact synchronization includes:

  • Multiple address books
  • Contact groups
  • vCard 3.0 and 4.0 support
  • Contact photos
  • Shared address books

Address Book URLs

Access contacts at:

https://your-server/card.php/addressbooks/username/addressbook-name/

Client Configuration

iOS/macOS

Configure Apple devices:

  1. Go to Settings > Mail/Calendar/Contacts
  2. Add Account > Other
  3. Add CalDAV/CardDAV Account
  4. Enter server URL and credentials

Android

Use DAVx5 or similar:

  1. Install DAVx5 from Play Store
  2. Add account with server URL
  3. Select calendars and contacts to sync
  4. Configure sync frequency

Mozilla Thunderbird

Configure Thunderbird:

  1. Install TbSync and Provider for CalDAV/CardDAV
  2. Add new account
  3. Enter server details
  4. Select resources to sync

Microsoft Outlook

Use CalDAV Synchronizer:

  1. Install CalDAV Synchronizer add-in
  2. Configure server connection
  3. Map calendars and contacts
  4. Set sync options

WebDAV File Sharing

Enabling WebDAV

Configure file access:

$server = new \Sabre\DAV\Server($rootDirectory);
$server->addPlugin(new \Sabre\DAV\Browser\Plugin());

Mount as Network Drive

Access files as network drive:

  • Windows: Map network drive to DAV URL
  • macOS: Connect to Server (Finder)
  • Linux: Mount with davfs2

Authentication

Basic Auth

Simple password authentication:

$authBackend = new \Sabre\DAV\Auth\Backend\PDO($pdo);
$authPlugin = new \Sabre\DAV\Auth\Plugin($authBackend);
$server->addPlugin($authPlugin);

LDAP Integration

Connect to directory services:

$authBackend = new \Sabre\DAV\Auth\Backend\LDAP($ldapOptions);

Custom Authentication

Implement custom backends:

class MyAuth extends \Sabre\DAV\Auth\Backend\AbstractBasic {
public function validateUserPass($username, $password) {
// Custom validation logic
}
}

Access Control

ACL Configuration

Configure permissions:

$aclPlugin = new \Sabre\DAVACL\Plugin();
$server->addPlugin($aclPlugin);

Permission Types

Available permissions:

PermissionDescription
{DAV:}readRead access
{DAV:}writeWrite access
{DAV:}allFull control

Performance Optimization

Caching

Enable OpCode cache:

opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8

Database Optimization

For better performance:

  • Use MySQL/PostgreSQL for larger installations
  • Index frequently queried columns
  • Regular database maintenance

Backup and Recovery

Database Backup

Back up your data:

Terminal window
# SQLite
cp /path/to/db.sqlite /backup/
# MySQL
mysqldump -u user -p database > backup.sql

Export Data

Export calendars and contacts:

  • Export calendars as ICS
  • Export contacts as vCards
  • Back up complete database

Troubleshooting

Sync Failures

  • Verify URL format is correct
  • Check authentication credentials
  • Review server logs for errors
  • Test with curl or browser

Client Compatibility

  • Verify DAV protocol support
  • Check for client-specific issues
  • Test with reference clients
  • Review well-known URLs

Performance Issues

  • Check database performance
  • Review resource usage
  • Optimize queries
  • Consider caching

Additional Resources

Conclusion

Deploying SabreDAV on Klutch.sh provides a lightweight, standards-compliant solution for calendar and contact synchronization. With broad client support, flexible authentication, and a modular architecture, SabreDAV lets you take control of your personal data. Combined with Klutch.sh’s automatic HTTPS and persistent storage, you get a reliable sync server that works with all your devices.