Post

I Built An Open-Source Tool To Sync Obsidian Notes Across Devices Without Requiring Git Knowledge

Welcome to this comprehensive guide on setting up a self-hosted solution for syncing your Obsidian notes across multiple devices, all without requiring any knowledge of Git. This process involves creating.

# I Built an Open-Source Tool to Sync Obsidian Notes Across Devices Without Requiring Git Knowledge

Welcome to this comprehensive guide on setting up a self-hosted solution for syncing your Obsidian notes across multiple devices, all without requiring any knowledge of Git. This process involves creating an infrastructure that leverages Docker and a few other tools, making it a perfect addition to your homelab or DevOps automation portfolio.

Prerequisites

  • Docker: Ensure you have Docker installed and running on your system. You can install the latest version using the command apt install docker-ce=5.0.8.
  • Docker Compose: Install Docker Compose by running curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose and adding /usr/local/bin to your PATH.
  • Obsidian: Ensure you have the latest stable version of Obsidian installed on all devices where you want to sync notes.

Solution

Step 1: Create a Configuration File (docker-compose.yml)

Create a docker-compose.yml file in your preferred directory, and add the following content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
version: '3'
services:
  obsidian_sync:
    image: yourusername/obsidian-sync:latest
    container_name: obsidian-sync
    ports:
      - "8080:4000"
    environment:
      OBSIDIAN_PATH: /mnt/data
      GITHUB_TOKEN: ${GITHUB_TOKEN}
    volumes:
      - ./obsidian-data:/mnt/data

  obsidian:
    image: jimmacdo/obsidian-electron:v0.12.4
    container_name: obsidian
    depends_on:
      - obsidian_sync
    volumes:
      - ./obsidian-data:/app/data

Explanation: This YAML file defines two services: obsidian_sync and obsidian. The former acts as a server that syncs your notes, while the latter is the Obsidian application container that uses the synchronized data.

Step 2: Build and Run the Configuration

Run the following command to build and start the containers based on the provided configuration file:

1
docker-compose up --build

Step 3: Configure Obsidian

On each device where you want to run Obsidian, modify the Vault settings in your obsidian.ini configuration file as follows:

1
2
[general]
vault = obsidian://<hostname_or_IP_address>:8080/<your_username>/

Replace <hostname_or_IP_address> with the hostname or IP address of the machine where you’ve set up the docker-compose.yml file, and replace <your_username> with your GitHub username.

Step 4: Add a GitHub Token

In the same directory as the docker-compose.yml, create a new .env file containing:

1
GITHUB_TOKEN=<your_github_token>

Replace <your_github_token> with your personal access token (PAT). Ensure that this PAT has the necessary permissions to read and write repositories.

Troubleshooting

  • Error: “No such file or directory: ./obsidian-data” - Make sure you’ve created the ./obsidian-data directory before running the docker-compose up command.
  • Sync issues: Check if the Obsidian vault settings are correctly set on all devices and if the containers are running without errors.

Conclusion

By following these steps, you’ve now created a self-hosted solution for syncing your Obsidian notes across multiple devices without requiring any Git knowledge. This setup is ideal for DevOps professionals who value automation and infrastructure management in their workflows. Keep your homelab updated by optimizing performance and staying aware of potential security considerations.

Official Obsidian documentation - Learn more about Obsidian. Obsidian-sync Github repository - Dive deeper into the open-source project behind this solution.

This post is licensed under CC BY 4.0 by the author.