Find storage and AI servers on the tailnet, not only over mDNS
shellcheck / shellcheck (push) Failing after 18s

configure storage and configure ai-servers now also ask the other online
computers on the Core's tailnet, so a laptop away from home still finds the
MiniServer and the LLM box. A machine found both ways is listed once, by its
tailnet name, and tailnet servers mount at /mnt/<short name>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 14:30:38 -07:00
co-authored by Claude Opus 5.5
parent 7e80d37986
commit 16e5a9c79d
5 changed files with 220 additions and 26 deletions
+13 -7
View File
@@ -14,6 +14,7 @@ SANDBOX_CONF="$HOME/.config/coredesktop/sandbox/base.json"
CLAUDE_SETTINGS="$HOME/.claude/settings.json"
OPENCODE_CONF="$HOME/.config/opencode/opencode.json"
source "$COREDESKTOP/configure.d/lib/mdns.sh"
source "$COREDESKTOP/configure.d/lib/tailnet.sh"
source "$COREDESKTOP/configure.d/lib/json.sh"
# Ports LLM servers listen on by default, and who uses each. All of them answer
@@ -22,7 +23,7 @@ LLM_PORTS=(11434 1234 8080 8000)
declare -A LLM_PORT_NAMES=([11434]=Ollama [1234]="LM Studio" [8080]=llama.cpp [8000]=vLLM)
is_installed() {
command -v avahi-browse
command -v avahi-browse || command -v tailscale
}
is_configured() {
@@ -45,13 +46,13 @@ server_kind() {
fi
}
# The LLM servers on the network: "host:port|models" per line. mDNS finds the
# machines, but LLM servers don't announce themselves on it, so each machine
# is asked on the usual ports.
# The LLM servers on the network: "host:port|models" per line. mDNS and the
# tailnet find the machines, but LLM servers don't announce themselves, so
# each machine is asked on the usual ports.
find_servers() {
local dir host port
dir="$(mktemp -d)" || return 1
for host in $(mdns_hosts); do
for host in $(with_tailnet_hosts "$(mdns_hosts)"); do
for port in "${LLM_PORTS[@]}"; do
(server_models "$host:$port" | wc -l > "$dir/$host:$port") &
done
@@ -203,17 +204,22 @@ remove_server() {
# Find servers on the network and add the one you choose
find_and_add() {
local servers server models choice i
echo "Looking for LLM servers on your network..."
if tailnet_joined; then
echo "Looking for LLM servers on your network and the Core's (Tailscale)..."
else
echo "Looking for LLM servers on your network..."
fi
mapfile -t servers < <(find_servers)
if [ ${#servers[@]} -eq 0 ]; then
echo "No LLM servers found. A server has to accept connections from other machines:"
echo "in Ollama's settings, turn on \"Expose Ollama to the network\" (or set OLLAMA_HOST=0.0.0.0);"
echo "in LM Studio, turn on \"Serve on Local Network\". Or enter its address instead."
tailnet_joined || echo "To find the Core's servers away from home too, run: configure tailscale"
return 0
fi
for i in "${!servers[@]}"; do
IFS='|' read -r server models <<< "${servers[$i]}"
printf ' %2d) %-28s %s, %s models\n' $((i + 1)) "$server" "$(server_kind "$server")" "$models"
printf ' %2d) %-36s %s, %s models\n' $((i + 1)) "$server" "$(server_kind "$server")" "$models"
done
read -rp "Which server? " choice
if ! [[ "$choice" =~ ^[0-9]+$ ]] || (( choice < 1 || choice > ${#servers[@]} )); then