Raja's Exocortex

Joplin Sync Using Nginx WebDAV

Joplin can sync note across devices using multiple methods. Webdav is the lightest and easiest sync method.

This method users nginx webdav to offer a quick and lightweight sync service for Joplin clients. The dgraziotin/nginx-webdav-nononsense docker container is available for both x64 and arm64 architectures.

Steps:

  1. Use the below docker-compose.yaml file to start the a customised nginx webdav instance.
  2. Add user accounts in config/nginx/htpasswd using the standard apache htpasswd utils. Only these users will be permitted to use the webdav instance. Anonymous access and user account auto provisioning is fully blocked.
  3. Use the custom-cont-init.d/40-user-dir script so multiple users can use the same nginx webdav instance.

๐Ÿ’ก it is to always recommended use the end-to-end encryption (E2EE) feature of Joplin during syncing to any external server. This ensures that the notes stored in the webdav server are encrypted by the client and even if the server is compromised sensitive notes are not accessible in clear text.

docker-compose.yaml

# Filename: docker-compose.yaml
#
# Host custom nginx webdav instance for Joplin clients to sync via webdav.
# Multiple users can sync using this single webdav instance using 40-user-dir below.
# Deploy behind traefik
#
# Configurable parameters:
#    CLIENT_MAX_BODY_SIZE: limit max file size

name: webdav-example-com

services:
  webdav:
    image: dgraziotin/nginx-webdav-nononsense
    container_name: webdav.example.com
    restart: always

    environment:
      - PUID=1000
      - PGID=1000
      - CLIENT_MAX_BODY_SIZE=20M

    volumes:
      - ./data:/data
      - ./config:/config
      - ./custom-cont-init.d:/custom-cont-init.d

    labels:
      - com.centurylinklabs.watchtower.enable=true
      - traefik.enable=true
      - traefik.http.routers.webdav.rule=Host(`webdav.example.com`)
      - traefik.http.routers.webdav.tls=true
      - traefik.http.routers.webdav.tls.certresolver=lets-encrypt

40-user-dir

#!/usr/bin/bash
# Filename: custom-cont-init.d/40-user-dir
# Ensure to chmod 755 custom-cont-init.d/40-user-dir
# Setup individual document root based on the logged in user

echo "change root from /data to /data/\$remote_user"
sed -i 's%/data"%/data/$remote_user"%g' /etc/nginx/nginx.conf