Obsidian Webtop + CouchDB — Disaster Recovery Guide
This document covers how to rebuild the Obsidian webtop + CouchDB sync stack from scratch after a drive failure or other data loss on /mnt/data. It assumes:
- The Proxmox VM itself is intact
cloudflaredis still running and its config at/etc/cloudflared/config.ymlsurvived (it lives outside/mnt/data, so it usually does)- Only the data/config directories under
/mnt/dataand the containers built on them were lost - Docker and Docker Compose are already installed on the host
If cloudflared itself did not survive (config missing, service won’t start), see the “If the tunnel itself is gone” section near the bottom before doing anything else — nothing here will be reachable publicly until that’s fixed.
1. Confirm the tunnel is alive and check existing ingress rules
Before touching anything else, check whether Cloudflare Tunnel is still routing traffic — this determines whether you need to touch Cloudflare at all, or just rebuild containers on the ports it already expects.
sudo systemctl status cloudflared
cat /etc/cloudflared/config.yml
ls /etc/cloudflared/If the service is active (running) and config.yml lists your expected hostnames (e.g. sync.midascloud.net, vault-<slug>.midascloud.net), you do not need to touch Cloudflare at all. Just recreate the containers on the same local ports named in that ingress: list, and the tunnel will pick them back up automatically.
Example of what a healthy ingress block looks like:
tunnel: <tunnel-id>
credentials-file: /home/<user>/.cloudflared/<tunnel-id>.json
ingress:
- hostname: midascloud.net
service: http://localhost:8080
- hostname: files.midascloud.net
service: http://localhost:8081
- hostname: sync.midascloud.net
service: http://localhost:5984
- hostname: vault-<slug>.midascloud.net
service: http://localhost:3010
- hostname: books.midascloud.net
service: http://localhost:3012
- hostname: wy3d.midascloud.net
service: http://localhost:8096
- service: http_status:404Note the vault-<slug> naming convention — each user’s webtop gets a randomly-generated subdomain slug, not a predictable name based on their username. Write down which slug maps to which user somewhere durable (not just in your head) — this file is a reasonable place, or a small table in your admin notes.
2. Recreate the directory structure
Drive failure wipes /mnt/data, which means all bind-mount targets for these containers need to exist again as real directories before docker compose up will succeed. Docker will not auto-create a file that’s supposed to be bind-mounted (only directories) — see Section 5 for what happens if you get this wrong.
mkdir -p /mnt/data/obsidian-webtop/<username>/config
mkdir -p /mnt/data/obsidian-couchdb
mkdir -p /mnt/data/obsidian-couchdb-configRepeat the first line for every user who had a webtop container — each user gets their own config subdirectory under obsidian-webtop/.
3. Recreate CouchDB’s local.ini
This is the one file that Docker Compose does not regenerate for you — it’s a bind-mounted config file, not part of the CouchDB image, so if the drive died, this file is genuinely gone and must be rewritten by hand.
nano /mnt/data/obsidian-couchdb-config/local.iniMinimal working config for Obsidian LiveSync compatibility:
[couchdb]
single_node=true
max_document_size = 50000000
[chttpd]
enable_cors = true
require_valid_user = true
[cors]
origins = app://obsidian.md, capacitor://localhost, http://localhost
credentials = true
headers = accept, authorization, content-type, origin, referer
methods = GET, PUT, POST, HEAD, DELETE
max_age = 3600
[chttpd_auth]
require_valid_user = true
[httpd]
WWW-Authenticate = Basic realm="couchdb"Notes / things to double-check against your actual working setup, since this is a reasonable default rather than a guaranteed exact match:
[cors] origins— if LiveSync fails to connect with a CORS-shaped error after rebuilding, this is the first place to look. Consider narrowingoriginsto your actual domain(s) rather than the generic Obsidian app schemes above, if you know exactly what you used before.- If you ever get a working
local.iniagain in the future, back it up somewhere outside/mnt/data(a git repo, a notes app, anywhere off this specific drive) so this reconstruction step is never needed again.
4. Bring the containers up
From each stack’s directory (adjust paths to match your actual layout):
cd ~/obsidian-webtop-stack
docker compose up -d
cd ~/couchdb-stack
docker compose up -dReference compose files, for what each stack should look like:
obsidian-webtop-stack/docker-compose.yml (one block per user, ports incrementing e.g. 3010, 3011, …):
services:
obsidian-<username>:
image: lscr.io/linuxserver/obsidian:latest
container_name: obsidian-<username>
security_opt:
- seccomp:unconfined
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
volumes:
- /mnt/data/obsidian-webtop/<username>/config:/config
shm_size: "1gb"
ports:
- "<port>:3000"
restart: unless-stoppedcouchdb-stack/docker-compose.yml (single shared instance, all users’ databases live inside it):
services:
couchdb:
image: couchdb:3
container_name: couchdb
restart: unless-stopped
ports:
- "5984:5984"
volumes:
- /mnt/data/obsidian-couchdb:/opt/couchdb/data
- /mnt/data/obsidian-couchdb-config/local.ini:/opt/couchdb/etc/local.ini
environment:
COUCHDB_USER: <admin-username>
COUCHDB_PASSWORD: <admin-password>5. Verify both containers are healthy
docker psConfirm couchdb and each obsidian-<username> container show Up.
curl http://localhost:5984-
If CouchDB never started at all and you see an error like:
Error response from daemon: ... mount src=.../local.ini ... not a directory: Are you trying to mount a directory onto a file (or vice-versa)?this means
local.inidoesn’t exist as an actual file yet — go back to Section 3. -
If CouchDB is up and healthy, an unauthenticated request correctly returns:
{"error":"unauthorized","reason":"Authentication required."}This is expected and is a good sign — it means
require_valid_user = truefromlocal.iniis being read and enforced correctly. It is not a failure. -
To confirm full health, authenticate:
curl http://<admin-username>:<admin-password>@localhost:5984/Should return
{"couchdb":"Welcome", ...}.
curl http://localhost:3010Should return HTML (the webtop’s login page). Repeat for each user’s assigned port.
Finally, confirm the public URLs work through the tunnel:
https://sync.midascloud.net
https://vault-<slug>.midascloud.net
6. Recreate each user’s CouchDB database + scoped user account
Each Obsidian vault needs its own CouchDB database, and — for real security, not just convenience — its own non-admin CouchDB user scoped to only that database. Do not have every vault’s LiveSync config authenticate as the CouchDB admin account; if any one webtop container is ever compromised, an admin credential leaks access to every user’s data, not just that one vault.
6a. Create the database
curl -X PUT http://<admin-username>:<admin-password>@localhost:5984/<username>-vaultExpected response: {"ok":true}
(This can also be done via Fauxton — https://sync.midascloud.net/_utils → Databases → Create Database — but curl is faster and exactly reproducible, which matters more here than UI convenience.)
6b. Create a non-admin CouchDB user
curl -X PUT http://<admin-username>:<admin-password>@localhost:5984/_users/org.couchdb.user:<username> \
-H "Content-Type: application/json" \
-d '{
"name": "<username>",
"password": "<a-real-generated-password>",
"roles": [],
"type": "user"
}'Web UI equivalent, if you’d rather use Fauxton for this step:
- Go to
https://sync.midascloud.net/_utils - Databases → open
_users - Click “Create Document”
- Fauxton pre-fills a random UUID as
_id— delete this entirely. The_idmust follow the exact patternorg.couchdb.user:<username>, matching thenamefield, or CouchDB will reject it as an invalid user document. - Replace the whole document body with the JSON shown above and save.
- CouchDB hashes the plaintext
passwordautomatically on save — you do not need to hash it yourself.
6c. Restrict the database to that user only
curl -X PUT http://<admin-username>:<admin-password>@localhost:5984/<username>-vault/_security \
-H "Content-Type: application/json" \
-d '{
"members": {
"names": ["<username>"],
"roles": []
}
}'Note: a CouchDB database with an empty _security document is accessible to any valid user (or possibly anonymous, depending on server config) — setting this members list is the step that actually locks the database down to just this one person.
Web UI equivalent: open the <username>-vault database in Fauxton, look for a “Permissions” tab/option within that database’s view, and set the members list there. (Fauxton’s user-management UI is inconsistent across CouchDB 3.x builds — if you don’t see a clean permissions screen, the curl command above is the reliable fallback.)
7. Configure Obsidian LiveSync plugin
Inside the user’s webtop (https://vault-<slug>.midascloud.net), open the LiveSync plugin settings and enter:
| Field | Value |
|---|---|
| URL | https://sync.midascloud.net |
| Username | the non-admin username from step 6b (not the CouchDB admin account) |
| Password | the password set in step 6b |
| Database Name | <username>-vault (exact case match to what was created in step 6a) |
Click the connection test button before saving — do not save an unverified config, since a broken profile will silently fail to sync later rather than erroring immediately.
Reading test failures:
- CORS error (check the webtop’s embedded browser dev console) → revisit the
[cors]section oflocal.iniin Section 3; theoriginslist may need to match your actual domain more precisely. The “Use Internal API” checkbox in the LiveSync settings is a legitimate workaround if CORS keeps failing — it routes through Obsidian’s internal request API instead of the browser’s fetch, sidestepping CORS enforcement entirely (with the caveat that it’s non-standard and could break in future Obsidian versions). - 401 Unauthorized → double-check username/password match exactly what was set in step 6b.
- 404 / database not found → check for a typo or case mismatch between the database name here and what was created in step 6a.
8. Approve the user in the portal
Once the vault is confirmed syncing, run the admin CLI to mark the user approved and record their vault link:
cd ~/backEndPortalCodingEnvironment/.../Back-End
node adminCLI.jsFollow the prompts: approve the user, paste in https://vault-<slug>.midascloud.net as their vault link.
If the tunnel itself is gone
If systemctl status cloudflared shows the service failed, or /etc/cloudflared/ is missing/empty, the tunnel itself needs to be recreated — this is a bigger job than anything above, since every subdomain’s DNS routing depends on it.
cloudflared tunnel login
cloudflared tunnel create <tunnel-name>Then rebuild /etc/cloudflared/config.yml from scratch using the reference ingress block in Section 1 (adjusting hostnames/ports to match what’s actually running), and re-route DNS for each hostname:
cloudflared tunnel route dns <tunnel-name> midascloud.net
cloudflared tunnel route dns <tunnel-name> sync.midascloud.net
cloudflared tunnel route dns <tunnel-name> vault-<slug>.midascloud.net
# ...repeat for every hostname in the ingress listRestart the service once config is in place:
sudo systemctl restart cloudflared
sudo systemctl status cloudflaredQuick reference checklist
-
cloudflaredservice still running, ingress rules intact - Recreated
/mnt/data/obsidian-webtop/<user>/configper user - Recreated
/mnt/data/obsidian-couchdband/mnt/data/obsidian-couchdb-config - Rewrote
local.ini -
docker compose up -dfor both stacks - Verified
docker psshows both containers healthy - Verified
curl localhost:5984andcurl localhost:<webtop-port>respond - Verified public URLs load through the tunnel
- Created CouchDB database for the vault
- Created scoped non-admin CouchDB user (not using shared admin credentials)
- Set
_securityon the vault database to restrict to that user - Confirmed LiveSync connects and actually syncs a test note
- Ran
adminCLI.jsto mark user approved with vault link