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
- Select HTTP as the traffic type
- Set the internal port to 80
- Set admin password
- Configure database
- Create users
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 1Note: 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:
Attach Persistent Volumes
Add volumes for data and configuration:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/var/www/html/Specific | 1 GB | Database and configuration |
/var/www/html/config | 100 MB | Configuration files |
Deploy Your Application
Click Deploy to start the build process.
Complete Setup Wizard
Access your deployment and complete the web-based setup:
Initial Configuration
Admin Setup
Complete initial configuration:
- Access
/admin/on your deployment - Set timezone and server settings
- Configure authentication
- Create user accounts
User Management
Create users and resources:
- Navigate to Users section
- Add new users with passwords
- Users can create their own calendars/address books
- Configure per-user settings
Database Options
SabreDAV supports multiple databases:
| Database | Use Case |
|---|---|
| SQLite | Small installations, easy setup |
| MySQL | Larger deployments, better performance |
| PostgreSQL | Enterprise 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:
- Access calendar properties
- Add sharing recipients
- 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:
- Go to Settings > Mail/Calendar/Contacts
- Add Account > Other
- Add CalDAV/CardDAV Account
- Enter server URL and credentials
Android
Use DAVx5 or similar:
- Install DAVx5 from Play Store
- Add account with server URL
- Select calendars and contacts to sync
- Configure sync frequency
Mozilla Thunderbird
Configure Thunderbird:
- Install TbSync and Provider for CalDAV/CardDAV
- Add new account
- Enter server details
- Select resources to sync
Microsoft Outlook
Use CalDAV Synchronizer:
- Install CalDAV Synchronizer add-in
- Configure server connection
- Map calendars and contacts
- 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:
| Permission | Description |
|---|---|
{DAV:}read | Read access |
{DAV:}write | Write access |
{DAV:}all | Full control |
Performance Optimization
Caching
Enable OpCode cache:
opcache.enable=1opcache.memory_consumption=128opcache.interned_strings_buffer=8Database 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:
# SQLitecp /path/to/db.sqlite /backup/
# MySQLmysqldump -u user -p database > backup.sqlExport 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
- SabreDAV Official Website
- SabreDAV Documentation
- SabreDAV GitHub Repository
- Baikal Documentation
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
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.