159 lines
3.9 KiB
Markdown
159 lines
3.9 KiB
Markdown
---
|
|
publish: true
|
|
permalink: /sh/garden/livesync
|
|
title: Self-hosted LiveSync
|
|
created: 2026-02-05T09:58:59.620-07:00
|
|
modified: 2026-02-05T12:21:13.920-07:00
|
|
tags:
|
|
- self_hosting
|
|
- obsidian
|
|
- sync
|
|
cssclasses: ""
|
|
---
|
|
|
|
Self-hosted LiveSync is a community plugin for [[20-29 HOBBYS/22 SELF HOSTING/22.11 DIGITAL GARDEN/Obsidian]] that enables real-time synchronization across devices using CouchDB or object storage.
|
|
|
|
## Features
|
|
|
|
- **Real-time sync** — Changes sync immediately
|
|
- **Conflict resolution** — Automatic merging of simple conflicts
|
|
- **End-to-end encryption** — Data encrypted before leaving device
|
|
- **Self-hosted** — Your data on your server
|
|
- **Multi-platform** — Works on all Obsidian platforms (desktop, mobile)
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Device A (Obsidian) ←→ CouchDB Server ←→ Device B (Obsidian)
|
|
```
|
|
|
|
All devices sync to a central CouchDB instance. Changes propagate in real-time.
|
|
|
|
## Server Setup (CouchDB)
|
|
|
|
### Docker (Recommended)
|
|
|
|
```yaml
|
|
# docker-compose.yml
|
|
version: "3"
|
|
services:
|
|
couchdb:
|
|
image: couchdb:latest
|
|
restart: always
|
|
ports:
|
|
- "5984:5984"
|
|
environment:
|
|
- COUCHDB_USER=admin
|
|
- COUCHDB_PASSWORD=your-secure-password
|
|
volumes:
|
|
- ./couchdb-data:/opt/couchdb/data
|
|
```
|
|
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
### Configure CouchDB
|
|
|
|
Access Fauxton UI at `http://server:5984/_utils`
|
|
|
|
1. Create a database for your vault (e.g., `obsidian-vault`)
|
|
2. Configure CORS if accessing from different domains
|
|
|
|
### CORS Setup
|
|
|
|
In Fauxton → Configuration → CORS:
|
|
- Enable CORS
|
|
- Set origins to `app://obsidian.md` and your domain
|
|
|
|
Or via curl:
|
|
```bash
|
|
curl -X PUT http://admin:password@localhost:5984/_node/_local/_config/httpd/enable_cors -d '"true"'
|
|
curl -X PUT http://admin:password@localhost:5984/_node/_local/_config/cors/origins -d '"app://obsidian.md"'
|
|
curl -X PUT http://admin:password@localhost:5984/_node/_local/_config/cors/credentials -d '"true"'
|
|
curl -X PUT http://admin:password@localhost:5984/_node/_local/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
|
|
curl -X PUT http://admin:password@localhost:5984/_node/_local/_config/cors/headers -d '"accept, authorization, content-type, origin, referer"'
|
|
```
|
|
|
|
## Plugin Setup
|
|
|
|
1. Install **Self-hosted LiveSync** from Obsidian Community Plugins
|
|
2. Open plugin settings
|
|
3. Configure connection:
|
|
- URI: `https://couchdb.example.com`
|
|
- Username: your CouchDB user
|
|
- Password: your CouchDB password
|
|
- Database: `obsidian-vault`
|
|
4. Set up encryption passphrase (all devices must use same passphrase)
|
|
5. Test connection
|
|
6. Enable sync
|
|
|
|
## Sync Modes
|
|
|
|
| Mode | Description |
|
|
|------|-------------|
|
|
| LiveSync | Real-time sync (uses more bandwidth) |
|
|
| Periodic | Sync at intervals |
|
|
| On file save | Sync when files change |
|
|
|
|
## Customization Sync
|
|
|
|
Sync settings, themes, plugins across devices:
|
|
|
|
Settings → Customization Sync → Enable
|
|
|
|
Select what to sync:
|
|
- Settings files
|
|
- Snippets
|
|
- Themes
|
|
- Plugins (careful with this)
|
|
|
|
## Encryption
|
|
|
|
Always enable end-to-end encryption:
|
|
|
|
1. Settings → Encryption → Enable
|
|
2. Set passphrase (same on all devices)
|
|
3. All data is encrypted before upload
|
|
|
|
## Troubleshooting
|
|
|
|
### Sync not working
|
|
|
|
```bash
|
|
# Check CouchDB is running
|
|
curl http://localhost:5984
|
|
|
|
# Check database exists
|
|
curl http://admin:password@localhost:5984/obsidian-vault
|
|
```
|
|
|
|
### Conflicts
|
|
|
|
Plugin shows conflict indicator. Open note to resolve:
|
|
- View both versions
|
|
- Choose or merge manually
|
|
- Conflicts auto-resolve if possible
|
|
|
|
### Rebuild database
|
|
|
|
If sync gets corrupted:
|
|
1. Disable sync on all devices
|
|
2. Delete database in CouchDB
|
|
3. Re-create database
|
|
4. Rebuild from primary device
|
|
5. Re-enable on other devices
|
|
|
|
## Alternatives to CouchDB
|
|
|
|
LiveSync also supports:
|
|
- MinIO (S3-compatible)
|
|
- Cloudflare R2
|
|
- AWS S3
|
|
- WebRTC (peer-to-peer, experimental)
|
|
|
|
## Resources
|
|
|
|
- GitHub: https://github.com/vrtmrz/obsidian-livesync
|
|
- Docs: https://github.com/vrtmrz/obsidian-livesync/blob/main/docs/
|