Find storage and AI servers on the tailnet, not only over mDNS
Ports CoreDesktop's 16e5a9c. 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>. Smoketest: 45-tailnet, with a stand-in tailscale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,7 @@ SANDBOX_CONF="$CONF_DIR/sandbox/base.json"
|
||||
CLAUDE_SETTINGS="$HOME/.claude/settings.json"
|
||||
OPENCODE_CONF="$HOME/.config/opencode/opencode.json"
|
||||
source "$CONNECTOR/configure.d/lib/mdns.sh"
|
||||
source "$CONNECTOR/configure.d/lib/tailnet.sh"
|
||||
source "$CONNECTOR/configure.d/lib/json.sh"
|
||||
|
||||
# Ports LLM servers listen on by default, and who uses each. All of them answer
|
||||
@@ -42,13 +43,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
|
||||
@@ -200,17 +201,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
|
||||
|
||||
Reference in New Issue
Block a user