feat: Continuous filesystem sync from CouchDB via systemd #1

Open
opened 2026-10-25 20:59:35 -07:00 by piotr · 0 comments
Owner

Overview

Implement the initial release for obsidian-livesync-fs: a headless sync daemon running as a systemd service that continuously synchronizes an Obsidian vault stored in CouchDB (via Obsidian LiveSync) down to the local filesystem.

Goals & Requirements

  • LiveSync Setup URI Integration: Support Obsidian LiveSync Setup URI (obsidian://setuplivesync?settings=...) containing CouchDB connection endpoints, authentication credentials, and E2EE parameters.
  • Systemd Configuration:
    • Secure credential injection using EnvironmentFile=/etc/obsidian-livesync/livesync.env (restricted to permissions 0600).
    • Support for modern systemd credentials via LoadCredential=setup_uri:....
    • Provide both system-level daemon (/etc/systemd/system/obsidian-livesync.service) and user-level unit (~/.config/systemd/user/obsidian-livesync.service).
    • Hardened systemd security policies (ProtectSystem=strict, ProtectHome=read-only, PrivateTmp=yes, NoNewPrivileges=yes).
  • Sync Engine:
    • Headless sync client (leveraging livesync-cli via container or native runtime).
    • Automatically initialize the local database cache and configuration on first startup if not already provisioned.
    • Run continuous daemon watching CouchDB changes (_changes?feed=continuous).
  • Resilience:
    • Auto-restart on network or process failures (Restart=always, RestartSec=10).
    • Health check / validation of target vault path before synchronization begins.

Acceptance Criteria

  • Systemd service file and runner wrapper provided.
  • Example configuration environment file and credential loading documented.
  • Successful initial setup and one-way/bi-directional sync of test markdown notes and attachments to filesystem.
  • Service automatically restarts on transient connection losses.
## Overview Implement the initial release for `obsidian-livesync-fs`: a headless sync daemon running as a `systemd` service that continuously synchronizes an Obsidian vault stored in CouchDB (via Obsidian LiveSync) down to the local filesystem. ## Goals & Requirements - **LiveSync Setup URI Integration**: Support Obsidian LiveSync Setup URI (`obsidian://setuplivesync?settings=...`) containing CouchDB connection endpoints, authentication credentials, and E2EE parameters. - **Systemd Configuration**: - Secure credential injection using `EnvironmentFile=/etc/obsidian-livesync/livesync.env` (restricted to permissions `0600`). - Support for modern `systemd` credentials via `LoadCredential=setup_uri:...`. - Provide both system-level daemon (`/etc/systemd/system/obsidian-livesync.service`) and user-level unit (`~/.config/systemd/user/obsidian-livesync.service`). - Hardened systemd security policies (`ProtectSystem=strict`, `ProtectHome=read-only`, `PrivateTmp=yes`, `NoNewPrivileges=yes`). - **Sync Engine**: - Headless sync client (leveraging `livesync-cli` via container or native runtime). - Automatically initialize the local database cache and configuration on first startup if not already provisioned. - Run continuous daemon watching CouchDB changes (`_changes?feed=continuous`). - **Resilience**: - Auto-restart on network or process failures (`Restart=always`, `RestartSec=10`). - Health check / validation of target vault path before synchronization begins. ## Acceptance Criteria - [ ] Systemd service file and runner wrapper provided. - [ ] Example configuration environment file and credential loading documented. - [ ] Successful initial setup and one-way/bi-directional sync of test markdown notes and attachments to filesystem. - [ ] Service automatically restarts on transient connection losses.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
piotr/obsidian-livesync-fs#1
No description provided.