obsidian #8

Merged
kevinheyer merged 4 commits from obsidian into main 2025-03-24 20:15:16 +00:00
5 changed files with 116 additions and 5 deletions
Showing only changes of commit 58579c67ab - Show all commits

View file

@ -0,0 +1,82 @@
# Obsidian LiveSync with CouchDB
This configuration sets up a **CouchDB** container for **Obsidian LiveSync** with **Traefik** as a reverse proxy.
## Prerequisites
- Docker & Docker-Compose
- Traefik as a reverse proxy
- A configured `.env` file with the required environment variables
## Environment Variables
Copy `.env-example` to `.env` and adjust the values accordingly.
## `local.ini` Configuration
Modify the file `data/local.ini`:
```ini
[admins]
admin = <SECRET_PASSWORD>
```
## Starting the Container
Run the following command to start the container:
```sh
docker-compose up -d
```
## Testing the CouchDB Connection
1. **Via Browser (Fauxton UI):**
```
http://your.domain.com/_utils/
```
2. **Using cURL:**
```sh
curl -u ${OBSIDIAN_COUCHDB_USER}:${OBSIDIAN_COUCHDB_PASSWORD} http://your.domain.com:5984/
```
## Configuration of Endpoint Device using the LiveSync Plugin
One final step is needed to complete the setup: configuring the LiveSync plugin on any Obsidian client that will be part of the data synchronization process.
Installing the plugin inside Obsidian is simple:
1. Go to the plugin section.
2. Search for the **Self-hosted LiveSync** plugin.
3. Install and enable the plugin.
Once installed, the plugin needs to be configured. There is a quick wizard on the [GitHub page](https://github.com/vrtmrz/obsidian-livesync) of the plugin that describes the process in detail.
### Configuring the Remote Database
The most important step is setting up the **Remote Database configuration**. This is the actual Docker container, which should be accessible over an HTTP or HTTPS address, depending on the setup.
![Remote Database Configuration](https://github.com/vrtmrz/obsidian-livesync/raw/main/images/quick_setup_3.png)
As shown in the image above, the **URI** parameter should point to the CouchDB container. The example shows a local address and the default database port. If using a reverse proxy, replace this with an HTTPS URL.
- **Username and Password**: These are the credentials defined in the `docker-compose` file.
- **Database Name**: This is a user-defined name. If the database does not exist, Obsidian will create one automatically.
### Enabling End-to-End Encryption
E2E encryption of the database is supported and recommended. Be sure to configure this for additional security.
![Encryption Configuration](https://github.com/vrtmrz/obsidian-livesync/raw/main/images/quick_setup_4.png)
### Finalizing the Setup
This configuration must be repeated on all devices that will participate in synchronization. Any changes on one device will be automatically pushed to the CouchDB sync database and then forwarded to all other connected Obsidian clients.
If everything is working correctly, a sync status icon should appear in the upper right corner of the Obsidian app.
This setup provides a fast and stable self-hosted Obsidian sync solution. However, keep in mind that maintenance, plugin updates, and LiveSync Docker container updates are the responsibility of the end user.

View file

@ -0,0 +1,26 @@
[couchdb]
single_node=true
max_document_size = 50000000
[chttpd]
require_valid_user = true
max_http_request_size = 4294967296
enable_cors = true
[chttpd_auth]
require_valid_user = true
authentication_redirect = /_utils/session.html
[httpd]
WWW-Authenticate = Basic realm="couchdb"
bind_address = 0.0.0.0
[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
[admins]
admin = <SECRET_PASSWORD>

View file

@ -15,12 +15,15 @@ services:
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.obsidian-livesync.rule=Host(`${OBSIDIAN_DOMAIN}`)"
- "traefik.http.routers.obsidian-livesync.entrypoints=websecure"
- "traefik.http.routers.obsidian-livesync.service=obsidian-livesync"
- "traefik.http.routers.obsidian-livesync.entrypoints=http"
- "traefik.http.routers.obsidian-livesync.rule=Host(`${OBSIDIAN_DOMAIN:?error}`)"
- "traefik.http.middlewares.obsidian-livesync-https-redirect.redirectscheme.scheme=https"
- "traefik.http.routers.obsidian-livesync.middlewares=obsidian-livesync-https-redirect"
- "traefik.http.routers.obsidian-livesync-secure.entrypoints=https"
- "traefik.http.routers.obsidian-livesync-secure.rule=Host(`${OBSIDIAN_DOMAIN:?error}`)"
- "traefik.http.routers.obsidian-livesync-secure.tls=true"
- "traefik.http.routers.obsidian-livesync-secure.service=obsidian-livesync"
- "traefik.http.services.obsidian-livesync.loadbalancer.server.port=5984"
- "traefik.http.routers.obsidian-livesync.tls=true"
- "traefik.http.routers.obsidian-livesync.middlewares=obsidiancors"
# The part needed for CORS to work on Traefik 2.x starts here
- "traefik.http.middlewares.obsidiancors.headers.accesscontrolallowmethods=GET,PUT,POST,HEAD,DELETE"
- "traefik.http.middlewares.obsidiancors.headers.accesscontrolallowheaders=accept,authorization,content-type,origin,referer"