Skip to content

About

Automates mounting shared NFS cache exports across macOS and Linux clients over Tailscale, VPN, or LAN.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cache Mounts (NFS over VPN or LAN)

Automates mounting shared NFS cache exports across macOS and Linux clients over Tailscale, VPN, or LAN.

release platform License Discord

Source · Systems map · Documentation

Configure mounts

How it fits together

The host mounts shared NFS cache directories and exposes them to local tools; the cache server remains a separate trusted machine.

flowchart LR
  NFS[Trusted NFS server] --> Host[macOS or Linux host mounts]
  Host --> Apps[Docker, Ollama and package tools]
  Hub[Optional Hub status view] -. reads configuration .-> Host
Loading

Features

Feature What it provides
Shared cache mounts Expose Docker, Ollama, npm and Hugging Face caches over trusted NFS.
Host integration Use launchd on macOS or fstab/systemd mount paths on Linux.
Hub visibility Provide configuration that Hub can display while the host performs mounts.

Configure the cache server

Create a local config file before running the scripts:

cp ./cache-mounts.conf.example ./cache-mounts.conf

Set at least:

  • CACHE_SERVER: hostname or IP reachable on your VPN/LAN
  • CACHE_NAMES: caches to mount, separated by spaces or commas (defaults to docker ollama npm huggingface)
  • CACHE_EXPORT_BASE: export root on the server (defaults to /srv/cache)

You can also override individual exports or mount points with variables such as:

  • CACHE_EXPORT_DOCKER
  • CACHE_EXPORT_HUGGINGFACE
  • CACHE_MOUNT_HUGGINGFACE

Default cache layout

  • Exports: /srv/cache/<name>
  • Linux mounts: /mnt/cache/<name>
  • macOS mounts: /Volumes/cache-<name>

Out of the box, the example config covers:

  • Docker caches
  • Ollama models
  • npm caches
  • Hugging Face caches

macOS

One-time install (creates launchd job for auto-mount)

./scripts/macos_install.sh

The launchd job re-runs macos_mount.sh every 5 minutes as your user. Because the mount script calls sudo, unattended re-mounts only work if your user has passwordless sudo for mount/mkdir; otherwise use the manual mount commands.

Manual mount

./scripts/macos_mount.sh

Manual unmount

./scripts/macos_unmount.sh

Linux

One-time install (adds /etc/fstab entries with _netdev and mounts now)

./scripts/linux_install.sh

Manual mount

./scripts/linux_mount.sh

Manual unmount

./scripts/linux_unmount.sh

Notes

  • Requires NFS client packages:
    • macOS: built-in
    • Ubuntu/Debian: sudo apt-get install -y nfs-common
  • All scripts read cache-mounts.conf from the repo root if present (regardless of the directory you run them from). Set CACHE_MOUNTS_CONFIG=/path/to/conf to use a different file, or export the same variables in your shell.
  • Linux install writes the resolved server/export paths into /etc/fstab; rerun it after changing the config.

Hub container (status page)

The CI Hub marketplace app ci-tools-cache-mounts runs ghcr.io/companionintelligence/ci-tools-cache-mounts (built from the Dockerfile in this repo). It serves only the static status/reference page in status/ — the actual NFS mounts are configured host-side with the scripts above; a container cannot create host mounts. Treat the container as an install confirmation plus quick-reference card.

Configuration reference

Variable Default Purpose
CACHE_SERVER Set in cache-mounts.conf Hostname/IP for the NFS server
CACHE_NAMES docker ollama npm huggingface Shares to mount
CACHE_EXPORT_BASE /srv/cache Server-side export root
macOS mount /Volumes/cache-<name> Client mount path
Linux mount /mnt/cache/<name> Client mount path
flowchart LR
  Clients[macOS and Linux clients] --> VPN[Trusted LAN or Tailscale]
  VPN --> NFS[NFS cache server]
  NFS --> Shares[docker / ollama / npm / huggingface]
  Shares --> Tools[Docker, Ollama, npm, Hugging Face]
Loading

NFS exports should be restricted to the trusted VPN range or explicit client IPs. macOS unattended mounts need the documented mount permissions; Linux uses _netdev entries and requires an NFS client package. The Hub status app is informational—the mount operation runs on the host. See operations and troubleshooting.

About

Automates mounting shared NFS cache exports across macOS and Linux clients over Tailscale, VPN, or LAN.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages