Skip to content

Self Hosting

Pummelchen edited this page Sep 18, 2026 · 13 revisions

Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Self-Hosting · Monitor · Testing · Troubleshooting · Project Tracker


What is deployed

Five SearXNG instances, one per machine, running natively under launchd (label local.mcps.searxng) — no container runtime is in the path. The cluster nodes serve the tailnet, so any machine may use any of them; the laptop binds loopback only. Each answers the JSON API and reads its engines without any vendor account.

Machine Address Runtime
node1 (this Mac) 127.0.0.1:8888, 100.66.125.48:8888 native launchd, bind 0.0.0.0
node2 100.97.158.87:8888 native launchd, bind 0.0.0.0
node3 100.114.69.128:8888 native launchd, bind 0.0.0.0
node4 100.80.144.76:8888 native launchd, bind 0.0.0.0
MacBook-AB 127.0.0.1:8888 native launchd, bind 127.0.0.1

This Mac was listed twice before — once as "this Mac" and once as "node1" — which made a five-machine fleet look like six.

Install one with:

deploy/install.sh --method native --port 8888 --bind 0.0.0.0   # a cluster node
deploy/install.sh --method native                              # loopback, for a laptop

Each instance runs natively under launchd, on the same listener the container path publishes. Native takes the VM out of the path — less memory, no container runtime, and no login-keychain dependency during install — so nothing that points at a node notices a difference.

Point the server at any one of them:

export SEARXNG_BASE_URL=http://100.66.125.48:8888

The container path remains, and its image is pinned by digest

The fleet runs native, but deploy/docker-compose.yml stays as the container alternative and pins searxng/searxng@sha256:e084201aa606fafce2151c8dc2844c9c3309025e90fbe7163b4f5e5183e474f0 instead of latest. It is the linux/arm64 image, so that file is arm64-only on purpose; upstream latest had already moved to a different digest. Nothing in the fleet runs it — deploy/provision-node.sh installs natively — so treat it as an option, not the deployment.

Provisioning a node

Each node's account matches its hostname — node1 on node1, and so on:

ssh node1@node1.local 'SUDO_PASSWORD=... bash -s' < deploy/provision-node.sh

The script is idempotent: re-running converges rather than duplicating. It is deliberately thin — sudo, Homebrew, git, and a Python the native build accepts — and then it fetches the repository and runs deploy/install.sh --method native --searxng-only. The install has one implementation, the one a workstation install uses, so provisioning cannot drift from what is deployed.

--searxng-only is what makes that work: a cluster node is search infrastructure, so it needs neither a Swift toolchain nor a published release, and the installer's mandatory-SearXNG gate still applies — a node gets the same answer a real query or fail verification a workstation does.

Options are environment variables, because the script arrives on stdin: SEARXNG_PORT, SEARXNG_BIND (default 0.0.0.0, since the nodes serve the tailnet), MCPS_REF, MCPS_REPO_DIR, and FORCE=1 to replace a running instance rather than adopt it. An instance that is already serving is adopted and verified, never rebuilt.

It reports the Tailscale address, a LAN fallback, or neither — never a hostname printed as if it were a URL.

This Mac is node1, and it runs native too

There is no separate container instance for the workstation any more: node1 is this machine, its SearXNG is the same native launchd service as every other node's, and it binds 0.0.0.0:8888 like the rest of the cluster. The container path in deploy/docker-compose.yml is unused here.

No SearXNG container runs on any machine, Docker Desktop is not running, and no com.mcpsearch.docker-autostart LaunchAgent is installed. The native service does not need Docker running at login, which is what such an agent would have existed for.

Traps worth knowing before touching another node

The first still applies to the native provisioner; the other three belong to the container path, which is no longer what the fleet runs but is still supported.

Symptom Real cause Handling
"brew: command not found" on a machine that has Homebrew An ssh command runs a non-login shell, so brew shellenv is never applied Check /opt/homebrew/bin/brew before concluding anything is missing — provision-node.sh does
brew install docker exits non-zero, yet installs fine It cannot symlink Docker Desktop completions into an /Applications/Docker.app that is absent Verify the binaries, not brew's exit status
docker: command not found after a successful install lima's docker.lima already occupies the name, so linking is skipped brew link --overwrite docker
Every pull fails: docker-credential-desktop: executable file not found A Docker Desktop credential helper that a non-interactive session cannot reach Use --method native, which needs no container runtime
A loaded launchd job reported as missing launchctl list | grep -q under pipefail: grep exits at the first match, SIGPIPEs launchctl, and the pipeline returns 141 Read all the input — grep … >/dev/null, not grep -q

Measured behaviour

Property Result
Instances healthy 5 of 5, all answering format=json
Engines enabled 15 per instance, identical configuration
Engines that contribute Google CSE (20) and Brave (20) everywhere
Provider latency node1 0.48 s, node3 0.98 s, this Mac 1.32 s per query
Resilience 25/25 queries with 0 failures alongside Tavily

Node instances are faster than the local one, because their VMs are otherwise idle.

Engine counts taken straight from each instance look identical (same 267 engines known, same 15 enabled), but what an instance actually contributes is not. On the Indonesian egress Brave answers and Bing does not; on the German egress both do. Treat the instance list as a pool of endpoints with different reach, not as interchangeable replicas — and read the table below as two separate questions, since a direct request and the same request made by SearXNG do not always agree.

--resolve-style pinning aside, there is no way to give the four nodes separate public IPv4 addresses while they remain on this LAN, and IPv6 cannot substitute because the engines that matter do not publish AAAA records.

Egress, and why an engine can fail for two different reasons

Each machine leaves the network by its own path. Nothing is routed through a cluster-wide exit node:

this Mac  -> 91.99.176.243   (Tailscale exit node "deltasona", Germany)
node1..4  -> 182.253.9.73    (one shared address, Indonesia; no exit node configured)

The nodes do hold distinct public IPv6 addresses and IPv6 egress works, but that buys nothing here: DuckDuckGo publishes no AAAA record at all, so every node reaches it over IPv4 from the same 182.253.9.73.

Measured per engine, requesting directly with a browser user agent:

Engine this Mac (Germany) node1 (Indonesia)
DuckDuckGo HTTP 200, real results HTTP 000 (name poisoned, see below)
Bing HTTP 200 HTTP 200
Brave HTTP 200 HTTP 200
Mojeek — HTTP 200, CAPTCHA page
Startpage HTTP 200 HTTP 200, challenge page

Going through SearXNG instead, on the same two egresses, gives a different answer again — which is the most useful thing to take away from this:

Through SearXNG this Mac (Germany) node1 (Indonesia)
DuckDuckGo captcha / SSL error unresponsive
Bing 10 results HTTP connection error, though curl to Bing succeeds
Brave 20 results 20 results
Google CSE 20 results 20 results

A SearXNG engine reporting failure therefore does not prove the network is blocked; it may be the engine's own request shape. Check directly before drawing conclusions.

So "DuckDuckGo is blocked" is really two unrelated faults, and only one of them is about the network path:

  1. The ISP redirects UDP/53 and answers with an RPZ block. dig html.duckduckgo.com returns rpz.biznet. with 202.169.44.80, an address that serves nothing — hence HTTP 000. Only other names are affected: www.bing.com and search.brave.com resolve normally.

    The block does not apply to every resolver. Queries to 8.8.8.8 and 1.1.1.1 appear to agree only because they never leave the ISP — only UDP/53 is redirected. The responder identifies itself, which is what settles it:

    dig @1.1.1.1 CH TXT id.server       # UDP/53 → "noc-dev"  (the ISP's Unbound 1.19.2)
    dig @1.1.1.1 +tcp CH TXT id.server  # TCP/53 → "cgk01"    (Cloudflare, Jakarta)
    dig @1.1.1.1 +tcp duckduckgo.com    # → 20.43.161.105, the real address

    TCP/53, DoT and DoH all return the true address, so this is fixable without leaving the LAN — and on this tailnet it is fixed. MagicDNS (100.100.100.100) is the system resolver on every machine, so one tailnet-level setting reaches all of them at once. The configuration now carries:

    {
      "nameservers": [
        {"address": "https://cloudflare-dns.com/dns-query", "useWithExitNode": true},
        {"address": "8.8.8.8",  "useWithExitNode": true},
        {"address": "8.8.4.4",  "useWithExitNode": true},
        {"address": "1.1.1.1",  "useWithExitNode": true},
        {"address": "1.0.0.1",  "useWithExitNode": true},
        {"address": "2001:4860:4860::8888", "useWithExitNode": true},
        {"address": "2001:4860:4860::8844", "useWithExitNode": true},
        {"address": "2606:4700:4700::1111", "useWithExitNode": true},
        {"address": "2606:4700:4700::1001", "useWithExitNode": true}
      ],
      "preferences": {"overrideLocalDNS": true, "magicDNS": true}
    }

    Cloudflare and Google are listed as whole entities — Tailscale groups a provider's addresses, so 8.8.8.8 alone would bring Google's four. They are additions to the DoH entry rather than a replacement, and all of them are upgraded to DoH by Tailscale, which is what keeps them clear of the UDP/53 redirect. POST /dns/configuration replaces the entire object, so the write above always carries the preferences too.

    Four things made it fiddly, and each is worth knowing before touching tailnet DNS again:

    • POST /dns/preferences replaces the object. Sending only overrideLocalDNS silently turned MagicDNS off — the response said so, and it was restored immediately, but it should not be possible to do by accident. Always send magicDNS alongside it.
    • GET /dns/preferences does not report overrideLocalDNS. It echoes only magicDNS, so a write that succeeded looks ignored. Read back /dns/configuration, which reports the whole thing — that is what finally confirmed the setting had applied.
    • /dns/nameservers takes flat strings and rejects useWithExitNode. The combined /dns/configuration endpoint is the one that accepts {address, useWithExitNode}. Without that flag, a device using an exit node ignores the tailnet nameserver entirely — which is exactly why one laptop stayed broken after the rest of the fleet was fixed.
    • macOS per-service DNS coexists with MagicDNS; it does not override it. An earlier version of this page claimed per-service DNS won, and that clearing it was what fixed a blocked machine. That was a misattribution, corrected by measurement. With all eight public resolvers set on every network service, scutil --dns still reports 100.100.100.100 as resolver #1 with 8.8.8.8 only as #2, and DuckDuckGo resolves on all five machines. The machine that looked broken was on an exit node and its new DNS configuration had not been applied yet — clearing its per-service DNS coincided with the configuration landing rather than causing it.

    Verified afterwards on all five machines: duckduckgo.com resolves to 20.43.161.105, and a forced provider=duckduckgo search returns real results on each.

    The eight public resolvers are also set in macOS itself, on every network service of all five machines, as an addition rather than a replacement:

    8.8.8.8  8.8.4.4  1.1.1.1  1.0.0.1
    2001:4860:4860::8888  2001:4860:4860::8844
    2606:4700:4700::1111  2606:4700:4700::1001
    

    MagicDNS stays primary, so they act as additional resolvers rather than a substitute. Note that they are only safe here because Tailscale upgrades public global nameservers to DoH automatically; queried directly over UDP/53 they return the ISP's block page for duckduckgo.com, which is exactly what the tailnet-level DoH entry avoids. networksetup refuses services it does not recognise (the virtual "EXO Thunderbolt" entries on node3 and node4), and Tailscale's own network service is deliberately left alone.

  2. SearXNG's DuckDuckGo engine is challenged even from a clean address. From this Mac's German egress — where a plain GET returns results — SearXNG still reports SearxEngineCaptchaException: CAPTCHA (wt-wt) and curl_cffi ... SSLError. Its engine drives DuckDuckGo through scripted form POSTs, which is what gets fingerprinted. This is a request-shape problem, not an IP-reputation problem.

Because fault 1 is DNS and not routing, it can be worked around without leaving the LAN — by the tailnet DoH nameserver above, which fixes every machine at once, or for a single command by pinning the real address. Verified from node1:

curl --resolve html.duckduckgo.com:443:40.114.177.156 \
     -A "$BROWSER_UA" 'https://html.duckduckgo.com/html/?q=swift'
# HTTP 200, 27 976 bytes, <title>swift at DuckDuckGo</title>

The container equivalent is a static mapping, which is node-local and does not touch /etc/resolv.conf:

    extra_hosts:
      - "html.duckduckgo.com:40.114.177.156"
      - "duckduckgo.com:40.114.177.156"

Note the trade-off: a hard-pinned address must be maintained, and fault 2 means the SearXNG engine may still be challenged even once the name resolves. Our own DuckDuckGo adapter does not have fault 2 — driven from a clean egress it returned 10 of 10 queries.

What this does not achieve

Nodes do not have independent egress IPs. All four sit behind one NAT and share a single address, so four instances behind it add redundancy and throughput, not reach. The original idea was that engines block by IP and separate instances would recover indexes lost from one address; the measurements above show the blocking that actually occurs here is name-based, so extra nodes were never going to help.

No independent index either. Every instance queries the same upstream engines, so this is aggregation, not a search index of our own. A genuine independent index needs continuous crawling and tens of terabytes; it is not what this is.

These instances have no authentication and no TLS. They are bound to the LAN and reached over Tailscale. Do not port-forward them.

Still open

  • node5 rejects key authentication, so it is unprovisioned.
  • The server supports one SEARXNG_BASE_URL at a time, so the extra instances give a choice of endpoint rather than parallel fan-out. Querying several in one search would need a change to provider selection.

Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker

Clone this wiki locally