Using obsidian-remote

Recently, I discovered a new way to use obsidian in a VNC session and it has been a game changer for me. I know, I know, you might be thinking, "Why would I want to do that?" Well, let me tell you, the answer is simple - because it's awesome!

Let me give you a little background on how I stumbled upon this amazing discovery. As a #homelab enthusiast, I am always looking for ways to optimize my workflow and make things easier for myself. One of my latest projects was to sync my obsidian vault to a headless server. For those of you who are not familiar, a headless server is a computer without a monitor, keyboard, or mouse, and is usually controlled remotely.

Now, I am currently using Synology for my homelab and I didn't want to rely on another computer to sync my obsidian vault with it. That's when the idea struck me - why not run obsidian in a VNC session on my Synology? And let me tell you, it was a brilliant idea.

For those who are not familiar, VNC (Virtual Network Computing) is a graphical desktop sharing system that allows you to remotely control another computer. And the best part is, I could connect to my Synology over the web through Tailscale, making it even more convenient. If you don’t know what Tailscale is, oh boy, you are in for a treat. You can go check it out. I give you permission. ;-)

So, I did a little research and came across the obsidian-remote repo on GitHub. I made a few modifications to the files and voila, I was able to run obsidian in a VNC session on my Synology. It was like a dream come true for me. Now, I can access my obsidian vault from anywhere, anytime, without having to rely on another computer.

I am sure some of you might be wondering, "But how does this benefit me?" Well, let me tell you, the possibilities are endless. Whether you are a student, a writer, a researcher, or just someone who loves to organize their thoughts, obsidian in a VNC session can make your life so much easier. You can access your vault from any device, as long as you have an internet connection. No more worrying about forgetting important notes or files on a different computer. Obsidian Sync also provides version history for a year, allowing you to revert to previous versions of notes at any time. I should mention that I am not exposing any ports on the internet. Everything is through Tailscale. I'm using their free tier as a solo #homelab enthusiast.

Enough of the chit-chat, here is what I did. I modified a few files from the obsidian-remote repo.

git clone https://github.com/sytone/obsidian-remote

I changed the Dockerfile.

FROM ghcr.io/linuxserver/baseimage-kasmvnc:debianbookworm

# Update and install extra packages.
RUN echo "**** install packages ****" && \
    apt-get update && \
    apt-get install -y --no-install-recommends curl libgtk-3-0 libnotify4 libatspi2.0-0 libsecret-1-0 libnss3 desktop-file-utils fonts-noto-color-emoji git ssh-askpass && \
    apt-get autoclean && rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/*

# Set version label
ARG OBSIDIAN_VERSION=1.5.11

# Download and install Obsidian
RUN echo "**** download obsidian ****" && \
    curl --location --output obsidian.deb "https://github.com/obsidianmd/obsidian-releases/releases/download/v${OBSIDIAN_VERSION}/obsidian_${OBSIDIAN_VERSION}_amd64.deb" && \
    dpkg -i obsidian.deb

# Environment variables
ENV CUSTOM_PORT="8083" \
    CUSTOM_HTTPS_PORT="8443" \
    CUSTOM_USER="" \
    PASSWORD="" \
    SUBFOLDER="" \
    TITLE="Obsidian v${OBSIDIAN_VERSION}" \
    FM_HOME="/vaults"

# Add local files
COPY root/ /
EXPOSE 8083 8443
VOLUME ["/config","/vaults"]

# Define a healthcheck
HEALTHCHECK CMD curl --fail http://localhost:8083/ || exit 1

I also changed a few files in the /root directory to remove sudo in the menu.xml and autostart file. You might want to check your config folder in your docker-compose.yml to see it stuck. I did this a couple times. I remove one line in the startwm.sh that started a script called pulseaudio. I don’t need that so I didn’t really care. I could probably connect the audio to a machine but that’s not my use case.

I proceed to build it with the usual docker build . -t obsidian-remote. After building the container, I modified the docker-compose.yml to suit my need and came up with this one.

services:
  obsidian:
#    image: 'ghcr.io/sytone/obsidian-remote:latest'
    image: obsidian-remote:latest
    container_name: obsidian-remote
    restart: unless-stopped
    healthcheck:
      test: curl -f http://localhost:8080/ || exit 1
    ports:
      - 8083:8083
      - 8443:8443
    volumes:
      - /my/homes/vault:/vaults
      - ./config:/config
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Montreal
      - DOCKER_MODS=linuxserver/mods:universal-git
      - CUSTOM_PORT=8083
      - CUSTOM_HTTPS_PORT=8443
      - CUSTOM_USER=
      - PASSWORD=
      - SUBFOLDER

Everything seems to be working. I sync my vault to my Synology using Obsidian sync which I pay for. Pretty happy to be able to do this.

Find me on @benoitb@mas.to mastodon if you have any questions.