Docker Compose
Below is the docker compose file just to get CouchDB up and running:
version: "3.8"
services:
couchdb-obsidian-livesync:
container_name: obsidian-livesync #shortened name
image: couchdb:3.3.3
environment:
- PUID=99
- PGID=100
- UMASK=0022
- TZ=Asia/Ho_Chi_Minh
- COUCHDB_USER=obsidian_user # optionally change me
- COUCHDB_PASSWORD=obsidian_password # definitely change me
volumes:
- ./data:/opt/couchdb/data
- ./etc/local.d:/opt/couchdb/etc/local.d
- ./log:/opt/couchdb/var/log/couchdb # Added log volume
ports:
- "5984:5984"
restart: unless-stopped
labels:
- net.unraid.docker.webui=http://[IP]:[PORT:5984]/_utils # This might need to be manually adjusted for the web UI
- net.unraid.docker.icon=https://couchdb.apache.org/image/[email protected]
- net.unraid.docker.shell=bash
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5984/_up"] # Healthcheck for CouchDB
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
CouchDB – Initial Configuration
-
Go to the CouchDB admin page by going here: http://10.10.10.13:5984/_utils make sure to use your server’s IP address.
-
Login using the credentials you set in the Docker compose file.
-
Click on the
<->icon on the top left, it will expand the menu from simple icons to icons with text which will make following this guide easier. -
Click on
Setupon the left menu. -
Click on
Configure as Single Nodeand enter the same credentials from the Docker compose file into theSpecify your Admin credentialsfields. -
Leave everything else the same and click
Configure Node.
CouchDB – Verify Installation
-
Let’s verify the CouchDB installation by clicking
Verifyon the left menu. -
Click
Verify Installationand if everything is good, a popup banner should popup sayingSuccess! Your CouchDB installation is working. Time to Relax.along with 6 check marks next to each item in the table.
CouchDB – Create Database
-
Click on the
Databaseson the left menu. -
Click on
Create Databaseon the top right. -
Under
Database Nameenterobsidiandb, or whatever you like. Advice: if you intend to use this setup for multiple users, each user will need their own database, so I recommend naming the database to include the user’s first name like:obsidiandb_johnorobsidiandb_janejust to make it easier in the future. -
Under
PartitioningselectNon-partitioned - recommended for most workloads. Once the database is created, you should be redirected to the new database’s config page. You don’t have to do anything here.
CouchDB – Configuration
-
Click on
Configurationon the left main menu. The following 9 config entries are what the script was intended to do automatically but I wanted to do it manually. Click on+ Add Optionon the top right for each entry: -
Section:
chttpdName:require_valid_userValue:true -
Section:
chttpd_authName:require_valid_userValue:true -
Section:
httpdName:WWW-AuthenticateValue:Basic realm="couchdb" -
Section:
httpdName:enable_corsValue:true -
Section:
chttpdName:enable_corsValue:true -
Section:
chttpdName:max_http_request_sizeValue:4294967296 -
Section:
couchdbName:max_document_sizeValue:50000000 -
Section:
corsName:credentialsValue:true -
Section:
corsName:originsValue: `app://obsidian.md,capacitor://localhost,http://localhost
Obsidian – Windows 11 Client
-
Download and install the Windows 11 Obsidian client from here.
-
Once installed, open Obsidian.
-
Next to
Create new vaultclick theCreatebutton next. -
In the
Vault namefield, name your Vault whatever you like, I simply named mineVault. You can think of a vault as a "master folder" that contains all your folders and notes. Some users have different vaults for different aspects of their lives, such asWorkorPersonalbut I keep everything under one vault for ease of use. -
Next setting is
Location, clickBrowse. This is where your vault will be locally saved. I created anObsidianfolder in theDocumentsfolder but you can put it anywhere you like. -
Click
Createand Obsidian should open up to your newly created vault with 3 window panes. Next step is to setup the LiveSync plugin.
Obsidian – LiveSync Plugin
-
Click on
optionsbutton (sprocket icon) on the bottom left area. -
Click
Community pluginsand click on theTurn on community pluginsbutton after reading the risk disclosure. -
Next to
Community pluginsclick on theBrowsebutton. -
Search for
Self-hosted LiveSync. -
Only 1 plugin should show up and that’s the one by
voratamoroz, click on it. -
Click the
Installbutton and let it install. -
Click the
Enablebutton. -
Click
Open setting dialogbutton. -
Click
Optionsbutton. -
Under
Settings for Self-hosted LiveSync.you should see a row of 8 buttons, click on the 4th button with the 🛰️ satellite icon. -
This is where we will enter the self-hosted CouchDB details. Next to
Remote Typemake sureCouchDBis selected from the drop down menu. -
In the
URIfield type http://10.10.10.13:5984 make sure to change to your server IP and port. (Open the container online with HAProxy) -
In the
Usernamefield typeosidian_useror whatever you used in the docker compose. -
Same for
Passwordfield. -
In the
Database namefield typeobsidiandbor whatever you named your database earlier in CouchDB. -
Click the
Testbutton to test the connection to the CouchDB database. Assuming everything is working properly a text popup should sayConnected to obsidiandb successfully. -
Click the
Checkbutton to confirm the database was configured properly, there should be a purple checkmark next to each line item. If not, there should be aFixbutton next to the item that you can click for it to either create or correct for you, but I prefer to manually do it myself. -
Assuming everything is good up to this point, click the
Applybutton next toApply Settings. -
Optional but recommended: scroll down to the
End-to-end encryptionand toggle it on and set a passphrase. Please remember this passphrase as all your other devices must have matching passphrases for it to be able to decrypt your notes. Click the red buttonJust apply. -
On the top menu, under
Settings for Self-hosted LiveSync.you should see a row of 8 buttons, click on the 5th button with the 🔄 refresh icon. -
Next to
Sync modeselectLiveSyncfrom the drop down menu. -
You can close the
settingswindows out, on the top right of the notes you should seeSync: zZzwhich means everything is working properly and the sync is in standby mode until you start typing something. -
Repeat the above instructions for all other devices.
Reverse Proxy
I highly recommend putting this behind at least a reverse proxy, I use Nginx Proxy Manager in conjunction with Cloudflare Tunnels. You will definitely need to if you plan on using mobile devices as they require HTTPS.
