What is it?

Obsidian offers paid service Obsidian Sync. There are also third-party plugins, which allow similar functionality, but with self-hosted server. Among them is obsidian-livesync plugin.

This plugin allows one to sync their Obsidian vault among multiple devices.

It is not a backup tool! For that git repository on Forgejo instance will be used.

Setup

I use CouchDB setup running as an LXC container on my Proxmox instance, but it can be self-hosted as a Docker container, baremetal etc.

After setting it up, I have created a database obsidian-livesync, in Caddy I added reverse proxy config pointing to this server and ran the following script (edited from the GitHub version).

#!/usr/bin/env bash
export hostname=IPorURL
export username=adminUsername
export password=adminPassword

if [[ -z "$hostname" ]]; then
    echo "ERROR: Hostname missing"
    exit 1
fi
if [[ -z "$username" ]]; then
    echo "ERROR: Username missing"
    exit 1
fi

if [[ -z "$password" ]]; then
    echo "ERROR: Password missing"
    exit 1
fi

echo "-- Configuring CouchDB by REST APIs... -->"

until (curl -X POST "${hostname}/_cluster_setup" -H "Content-Type: application/json" -d "{\"action\":\"enable_single_node\",\"username\":\"${username}\",\"password\":\"${password}\",\"bind_address\":\"0.0.0.0\",\"port\":5984,\"singlenode\":true}" --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/chttpd/require_valid_user" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/chttpd_auth/require_valid_user" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/httpd/WWW-Authenticate" -H "Content-Type: application/json" -d '"Basic realm=\"couchdb\""' --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/httpd/enable_cors" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/chttpd/enable_cors" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/chttpd/max_http_request_size" -H "Content-Type: application/json" -d '"4294967296"' --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/couchdb/max_document_size" -H "Content-Type: application/json" -d '"50000000"' --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/cors/credentials" -H "Content-Type: application/json" -d '"true"' --user "${username}:${password}"); do sleep 5; done
until (curl -X PUT "${hostname}/_node/couchdb@127.0.0.1/_config/cors/origins" -H "Content-Type: application/json" -d '"app://obsidian.md,capacitor://localhost,http://localhost"' --user "${username}:${password}"); do sleep 5; done

echo "<-- Configuring CouchDB by REST APIs Done!"

Now, all I needed to do was install the plugin in Obsidian, and configure it with correct credentials. Then it replicated my vault without issues.