Add always-on SearXNG edge service

This commit is contained in:
juvenal.diaz 2026-12-04 08:59:51 -06:00
parent 47688b8e21
commit 3b845fe85a
27 changed files with 466 additions and 4 deletions

View File

@ -96,6 +96,14 @@
<td><a href="https://lab2025.duckdns.org/git/">https://lab2025.duckdns.org/git/</a></td>
<td><code>infra/gitea/README.md</code></td>
</tr>
<tr>
<td>SearXNG</td>
<td>debian (control-plane, 192.168.100.73)</td>
<td>Docker Compose / jeannie deploy-searxng</td>
<td><a href="http://192.168.100.73:8888/">http://192.168.100.73:8888/</a></td>
<td><a href="https://search.lab2025.duckdns.org/">https://search.lab2025.duckdns.org/</a></td>
<td><code>infra/searxng/README.md</code></td>
</tr>
<tr>
<td>GitOps mirror</td>
<td>debian (control-plane, 192.168.100.73)</td>

View File

@ -16,19 +16,21 @@ locals {
homepage_server_name = "homepage.${var.server_name}"
oidc_server_name = "auth.${var.server_name}"
jellyfin_server_name = "jellyfin.${var.server_name}"
searxng_server_name = "search.${var.server_name}"
heimdall_backend_host = var.heimdall_backend_host != "" ? var.heimdall_backend_host : var.gitea_backend_host
homepage_backend_host = var.homepage_backend_host != "" ? var.homepage_backend_host : var.gitea_backend_host
oidc_backend_host = (
var.oidc_backend_host != "" ? var.oidc_backend_host : var.gitea_backend_host
)
jellyfin_backend_host = var.jellyfin_backend_host != "" ? var.jellyfin_backend_host : var.gitea_backend_host
searxng_backend_host = var.searxng_backend_host != "" ? var.searxng_backend_host : var.gitea_backend_host
jeannie_api_server_name = "api.${var.server_name}"
office_server_name = var.office_server_name
office_onlyoffice_server_name = var.office_onlyoffice_server_name
matrix_server_names = var.matrix_enabled ? [var.matrix_server_name, var.element_server_name] : []
monitoring_names = var.monitoring_backend_host != "" ? ["grafana.${var.server_name}", "prometheus.${var.server_name}", "alertmanager.${var.server_name}"] : []
server_names = distinct(concat([var.server_name, local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], local.matrix_server_names, var.additional_server_names))
main_server_names = [for name in local.server_names : name if !contains([local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], name) && !contains(local.matrix_server_names, name) && !contains(local.monitoring_names, name)]
server_names = distinct(concat([var.server_name, local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], local.matrix_server_names, var.additional_server_names))
main_server_names = [for name in local.server_names : name if !contains([local.heimdall_server_name, local.homepage_server_name, local.oidc_server_name, local.jellyfin_server_name, local.searxng_server_name, local.jeannie_api_server_name, local.office_server_name, local.office_onlyoffice_server_name], name) && !contains(local.matrix_server_names, name) && !contains(local.monitoring_names, name)]
default_conf = templatefile("${path.module}/templates/default.conf.tftpl", {
server_name = var.server_name
monitoring_backend_host = var.monitoring_backend_host
@ -51,6 +53,9 @@ locals {
jellyfin_server_name = local.jellyfin_server_name
jellyfin_backend_host = local.jellyfin_backend_host
jellyfin_backend_port = tostring(var.jellyfin_backend_port)
searxng_server_name = local.searxng_server_name
searxng_backend_host = local.searxng_backend_host
searxng_backend_port = tostring(var.searxng_backend_port)
jeannie_api_server_name = local.jeannie_api_server_name
jeannie_api_backend_host = var.jeannie_api_backend_host
jeannie_api_backend_port = tostring(var.jeannie_api_backend_port)
@ -113,6 +118,8 @@ resource "null_resource" "edge_services" {
oidc_port = tostring(var.oidc_backend_port)
jellyfin_host = local.jellyfin_backend_host
jellyfin_port = tostring(var.jellyfin_backend_port)
searxng_host = local.searxng_backend_host
searxng_port = tostring(var.searxng_backend_port)
jeannie_api_host = var.jeannie_api_backend_host
jeannie_api_port = tostring(var.jeannie_api_backend_port)
office_host = var.office_backend_host
@ -240,6 +247,8 @@ oidc_host="${self.triggers.oidc_host}"
oidc_port="${self.triggers.oidc_port}"
jellyfin_host="${self.triggers.jellyfin_host}"
jellyfin_port="${self.triggers.jellyfin_port}"
searxng_host="${self.triggers.searxng_host}"
searxng_port="${self.triggers.searxng_port}"
jeannie_api_host="${self.triggers.jeannie_api_host}"
jeannie_api_port="${self.triggers.jeannie_api_port}"
enable_letsencrypt="${self.triggers.enable_letsencrypt}"
@ -343,6 +352,11 @@ if ! curl -sS --connect-timeout 10 "http://$jellyfin_host:$jellyfin_port/" >/dev
echo "Check the Debian Jellyfin container and published port before testing the public hostname." >&2
fi
if ! curl -fsS --connect-timeout 10 "http://$searxng_host:$searxng_port/healthz" >/dev/null; then
echo "Warning: cannot reach SearXNG backend http://$searxng_host:$searxng_port/healthz from the edge host." >&2
echo "Run ./jeannie deploy-searxng on Debian before testing the public hostname." >&2
fi
if ! curl -sS --connect-timeout 10 -o /dev/null -w '%%{http_code}' "http://$jeannie_api_host:$jeannie_api_port/v1/health" | grep -Eq '^(200|401)$'; then
echo "Warning: cannot reach Jeannie API backend http://$jeannie_api_host:$jeannie_api_port/v1/health from the edge host." >&2
echo "Check the Debian Jeannie API service before testing the public hostname." >&2

View File

@ -44,6 +44,7 @@ error_log /var/log/nginx/crowdsec-error.log warn;
limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
limit_req_zone $binary_remote_addr zone=jeannie_api:10m rate=5r/s;
limit_req_zone $binary_remote_addr zone=searxng_search:10m rate=30r/m;
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=static_assets:10m max_size=100m inactive=24h;
proxy_cache_path /var/cache/nginx_dynamic levels=1:2 keys_zone=dynamic_content:5m max_size=50m inactive=1h;
@ -115,7 +116,7 @@ server {
server {
listen 80;
server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name} ${jellyfin_server_name} ${jeannie_api_server_name} ${office_server_name} ${office_onlyoffice_server_name};
server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name} ${jellyfin_server_name} ${searxng_server_name} ${jeannie_api_server_name} ${office_server_name} ${office_onlyoffice_server_name};
location ^~ /.well-known/acme-challenge/ {
root /var/www/certbot;
@ -128,6 +129,71 @@ server_name ${heimdall_server_name} ${homepage_server_name} ${oidc_server_name}
}
}
server {
listen 443 ssl;
http2 on;
server_name ${searxng_server_name};
ssl_certificate /etc/nginx/certs/current.crt;
ssl_certificate_key /etc/nginx/certs/current.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache shared:homelab_ssl:10m;
ssl_session_timeout 1d;
if ($blocked_uris) { return 403; }
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy no-referrer;
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()";
location = /edge-health {
access_log off;
return 204;
}
location = /healthz {
proxy_pass http://${searxng_backend_host}:${searxng_backend_port}/healthz;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
access_log off;
}
location = /search {
limit_req zone=searxng_search burst=10 nodelay;
proxy_pass http://${searxng_backend_host}:${searxng_backend_port};
proxy_http_version 1.1;
proxy_buffering off;
proxy_read_timeout 60s;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header CF-Connecting-IP $http_cf_connecting_ip;
add_header Cache-Control "no-store";
}
location / {
limit_req zone=one burst=20 nodelay;
proxy_pass http://${searxng_backend_host}:${searxng_backend_port};
proxy_http_version 1.1;
proxy_buffering off;
proxy_read_timeout 60s;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header CF-Connecting-IP $http_cf_connecting_ip;
add_header Cache-Control "no-store";
}
}
server {
listen 443 ssl;
http2 on;

View File

@ -225,6 +225,16 @@ variable "jellyfin_backend_port" {
default = 8096
}
variable "searxng_backend_host" {
type = string
default = ""
}
variable "searxng_backend_port" {
type = number
default = 8888
}
variable "jeannie_api_backend_host" {
type = string
default = ""

View File

@ -52,7 +52,8 @@ var allowedCommands = map[string]bool{
"apps": true, "website-translation-model": true,
"website-ollama-listen": true, "ollama-setup": true,
"deploy-gitea": true, "deploy-api": true, "deploy-heimdall": true,
"deploy-dex": true, "deploy-matrix": true, "deploy-ai-stack": true,
"deploy-searxng": true,
"deploy-dex": true, "deploy-matrix": true, "deploy-ai-stack": true,
"deploy-office": true,
"deploy-ai-tools": true, "deploy-omniroute": true, "deploy-hermes": true,
"rpi-services": true, "host-bootstrap": true, "bootstrap-gitea-repo": true, "repo-sync": true, "backup-gitea": true, "hermes-connect": true,

View File

@ -175,6 +175,12 @@ func TestOCICommandIsRemotelyEnabled(t *testing.T) {
}
}
func TestSearxngDeployCommandIsRemotelyEnabled(t *testing.T) {
if !allowedCommands["deploy-searxng"] {
t.Fatal("deploy-searxng must be exposed through the remote API")
}
}
func TestPublicJeannieCommandsAreRemotelyEnabled(t *testing.T) {
data, err := os.ReadFile(filepath.Join("..", "..", "jeannie"))
if err != nil {

View File

@ -334,6 +334,20 @@ is `/data/homelab-heimdall/data/config`, and the local HTTP port is `8082`.
Dashboard links are seeded from `infra/heimdall/links.json` by a sidecar
container that upserts repo-managed tiles without deleting manually added ones.
## SearXNG
SearXNG is an independent Debian-hosted Docker Compose stack, not a Kubernetes
workload. `./jeannie deploy-searxng` installs SearXNG with a private
Valkey service at `/data/homelab-searxng`, preserves its generated secret, and
waits for the local health endpoint. `./jeannie up` includes the same
deploy in its independent host-services stage.
The OCI edge publishes `https://search.lab2025.duckdns.org/` and reaches port
`8888` on Debian over Tailscale. Both the edge and SearXNG apply request limits;
the JSON result format remains enabled for later homelab AI-tool integration.
Run the service deploy before `./jeannie edge apply` when reconciling
the route separately.
The Debian bare repo remains the GitOps mirror:
```text

View File

@ -263,6 +263,9 @@ needed.
`deploy-heimdall`
: Deploy the external Heimdall Docker Compose dashboard on the Debian host.
`deploy-searxng`
: Deploy the external SearXNG and Valkey Docker Compose stack on the Debian host.
`rpi-services`
: Deploy Pi-hole, Unbound, and Uptime Kuma on the Raspberry Pi.
@ -604,6 +607,18 @@ missing. Default is to fail and ask for host bootstrap.
: Allow `deploy-heimdall` to install Docker through `get.docker.com` when Docker
is missing. Default is to fail and ask for host bootstrap.
`LAB_SEARXNG_DEPLOY=false`
: Skip the Debian-hosted SearXNG Compose deploy during `up`.
`LAB_SEARXNG_INSTALL_DIR`
: Install root for SearXNG. Defaults to `/data/homelab-searxng`.
`LAB_SEARXNG_HTTP_PORT`
: Local SearXNG HTTP port. Defaults to `8888`.
`LAB_SEARXNG_INSTALL_DOCKER=true`
: Allow `deploy-searxng` to install Docker when it is missing. Default is to fail.
`LAB_RPI_INSTALL_DOCKER=true`
: Allow `rpi-services` to install Docker through `get.docker.com` on the
Raspberry Pi when Docker is missing. Default is to fail.

View File

@ -22,6 +22,7 @@ Update `homelab.yml`, then run `scripts/render-service-catalog`.
| Demo Apps | Kubernetes | Argo CD / apps/demos-static | [local](http://192.168.100.240/demo-apps/) | [public](https://demos.lab2025.duckdns.org/) | `apps/demos-static/` |
| Service Catalog | Kubernetes | Generated from homelab.yml | [local](http://192.168.100.240/demo-apps/homelab-catalog/) | [public](https://demos.lab2025.duckdns.org/homelab-catalog/) | `docs/service-catalog.md` |
| Gitea | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-gitea | [local](http://192.168.100.73:3000/) | [public](https://lab2025.duckdns.org/git/) | `infra/gitea/README.md` |
| SearXNG | debian (control-plane, 192.168.100.73) | Docker Compose / jeannie deploy-searxng | [local](http://192.168.100.73:8888/) | [public](https://search.lab2025.duckdns.org/) | `infra/searxng/README.md` |
| GitOps mirror | debian (control-plane, 192.168.100.73) | Bare Git repository | `/home/jv/git-server/my-homelab-configs.git` | [public](ssh://jv@192.168.100.73/home/jv/git-server/my-homelab-configs.git) | `README.md#gitops-and-gitea-actions` |
| Container Registry | debian (control-plane, 192.168.100.73) | Argo CD / apps/container-registry | [local](http://192.168.100.73:30500/v2/_catalog) | | `apps/container-registry/` |
| Traefik | Kubernetes | OpenTofu / bootstrap/platform | [local](http://192.168.100.240/) | [public](https://lab2025.duckdns.org) | `README.md#loadbalancer-services` |

View File

@ -334,6 +334,20 @@ is `/data/homelab-heimdall/data/config`, and the local HTTP port is `8082`.
Dashboard links are seeded from `infra/heimdall/links.json` by a sidecar
container that upserts repo-managed tiles without deleting manually added ones.
## SearXNG
SearXNG is an independent Debian-hosted Docker Compose stack, not a Kubernetes
workload. `./{{ main_script }} deploy-searxng` installs SearXNG with a private
Valkey service at `/data/homelab-searxng`, preserves its generated secret, and
waits for the local health endpoint. `./{{ main_script }} up` includes the same
deploy in its independent host-services stage.
The OCI edge publishes `https://search.lab2025.duckdns.org/` and reaches port
`8888` on Debian over Tailscale. Both the edge and SearXNG apply request limits;
the JSON result format remains enabled for later homelab AI-tool integration.
Run the service deploy before `./{{ main_script }} edge apply` when reconciling
the route separately.
The Debian bare repo remains the GitOps mirror:
```text

View File

@ -30,6 +30,7 @@ domain:
- suwayomi.lab2025.duckdns.org
- maintainerr.lab2025.duckdns.org
- api.lab2025.duckdns.org
- search.lab2025.duckdns.org
network:
lan_cidr: 192.168.100.0/24
@ -190,6 +191,11 @@ services:
host: debian
http_port: 8787
public_url: https://api.lab2025.duckdns.org/
searxng:
host: debian
install_dir: /data/homelab-searxng
http_port: 8888
public_url: https://search.lab2025.duckdns.org/
gitops_mirror:
host: debian
path: /home/jv/git-server/my-homelab-configs.git

View File

@ -15,6 +15,10 @@
href: "https://heimdall.lab2025.duckdns.org/"
description: "Homelab service dashboard"
icon: "heimdall.png"
- SearXNG:
href: "https://search.lab2025.duckdns.org/"
description: "Privacy-respecting homelab metasearch"
icon: "mdi-magnify"
- Service Catalog:
href: "https://demos.lab2025.duckdns.org/homelab-catalog/"
description: "Generated host, service, route, and runbook map from homelab.yml"

View File

@ -97,6 +97,13 @@
"colour": "#334155",
"class": "Api"
},
{
"title": "SearXNG",
"url": "https://search.lab2025.duckdns.org/",
"description": "Privacy-respecting homelab metasearch",
"colour": "#22a699",
"class": "SearXNG"
},
{
"title": "Service Catalog",
"url": "https://demos.lab2025.duckdns.org/homelab-catalog/",

20
infra/searxng/README.md Normal file
View File

@ -0,0 +1,20 @@
# SearXNG
Jeannie deploys SearXNG and Valkey as an independent Docker Compose stack on
the Debian services host. It is deliberately outside Kubernetes, so cluster
maintenance does not interrupt search. The OCI edge reaches the Debian service
over Tailscale and publishes `https://search.lab2025.duckdns.org/`.
The stack enables HTML and JSON results, SearXNG's Valkey-backed limiter, image
proxying, container resource limits, and a second request limit at the OCI edge.
The generated secret remains in `/data/homelab-searxng/.env` and is never
written to Git.
Deploy the stack and then reconcile the edge certificate and route:
```sh
./jeannie deploy-searxng
./jeannie edge apply
```
The full `./jeannie up` pipeline performs both operations in the correct order.

View File

@ -0,0 +1,56 @@
name: homelab-searxng
services:
searxng:
image: ${SEARXNG_IMAGE:-docker.io/searxng/searxng:2026.12.3-44427d4a8}
container_name: ${SEARXNG_CONTAINER_NAME:-homelab-searxng}
restart: unless-stopped
depends_on:
valkey:
condition: service_healthy
env_file:
- .env
ports:
- "${SEARXNG_BIND_IP:-0.0.0.0}:${SEARXNG_HTTP_PORT:-8888}:8080/tcp"
volumes:
- ./config:/etc/searxng:ro
- searxng-cache:/var/cache/searxng
security_opt:
- no-new-privileges:true
mem_limit: 768m
pids_limit: 256
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/healthz', timeout=3)"]
interval: 30s
timeout: 5s
retries: 5
start_period: 30s
networks:
- searxng
valkey:
image: ${VALKEY_IMAGE:-docker.io/valkey/valkey:9-alpine}
container_name: ${VALKEY_CONTAINER_NAME:-homelab-searxng-valkey}
restart: unless-stopped
command: valkey-server --save 300 1 --save 60 1000 --loglevel warning
volumes:
- searxng-valkey:/data
security_opt:
- no-new-privileges:true
mem_limit: 128m
pids_limit: 64
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 15s
timeout: 3s
retries: 5
networks:
- searxng
networks:
searxng:
name: homelab-searxng
volumes:
searxng-cache:
searxng-valkey:

View File

@ -0,0 +1,8 @@
[botdetection]
trusted_proxies = [
"127.0.0.0/8",
"172.16.0.0/12",
]
[botdetection.ip_limit]
link_token = false

View File

@ -0,0 +1,34 @@
use_default_settings: true
general:
debug: false
instance_name: "Juvenal's Homelab Search"
search:
safe_search: 0
autocomplete: ""
formats:
- html
- json
server:
limiter: true
public_instance: false
image_proxy: true
method: GET
default_http_headers:
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Robots-Tag: noindex, nofollow
Referrer-Policy: no-referrer
ui:
static_use_hash: true
query_in_title: false
valkey:
url: valkey://valkey:6379/0
outgoing:
request_timeout: 6.0
max_request_timeout: 15.0

View File

@ -79,6 +79,7 @@ Build And Bootstrap
deploy-gitea Deploy the Debian-hosted Gitea container.
deploy-api Deploy the Temporal-backed Jeannie API on Debian.
deploy-heimdall Deploy the Debian-hosted Heimdall dashboard.
deploy-searxng Deploy Debian-hosted SearXNG and Valkey.
deploy-dex Deploy the Debian-hosted Dex SSO stack.
monitoring {plan|migrate|apply|refresh|exporters|status|validate} Manage Debian monitoring; preserve cluster discovery and Dex.
deploy-office Deploy Nextcloud + ONLYOFFICE online office.
@ -696,6 +697,10 @@ case "${1:-}" in
record_change_journal "deploy-heimdall" "$@"
deploy_heimdall
;;
deploy-searxng)
record_change_journal "deploy-searxng" "$@"
deploy_searxng
;;
deploy-dex)
record_change_journal "deploy-dex" "$@"
deploy_dex

View File

@ -2458,6 +2458,7 @@ status_report() {
fi
status_compose_stack "gitea" "/data/homelab-gitea"
status_compose_stack "heimdall" "${LAB_HEIMDALL_INSTALL_DIR:-/data/homelab-heimdall}"
status_compose_stack "searxng" "${LAB_SEARXNG_INSTALL_DIR:-/data/homelab-searxng}"
status_compose_stack "dex" "${LAB_DEX_INSTALL_DIR:-/data/homelab-dex}"
status_compose_stack "arr-stack" "${REPO_ROOT}/infra/arr-stack"
@ -2477,6 +2478,7 @@ status_report() {
status_http "website public" "${LAB_PUBLIC_URL:?LAB_PUBLIC_URL is required from homelab.yml}/"
status_http "gitea public" "${LAB_GITEA_ROOT_URL:-${LAB_PUBLIC_URL:?LAB_PUBLIC_URL is required from homelab.yml}/git/}"
status_http "heimdall public" "${LAB_HEIMDALL_PUBLIC_URL:-https://heimdall.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}"
status_http "searxng public" "${LAB_SEARXNG_PUBLIC_URL:-https://search.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}"
status_http "dex public" "${LAB_DEX_PUBLIC_URL:-https://auth.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}"
status_http "gitea local" "http://127.0.0.1:${LAB_GITEA_HTTP_PORT:-3000}/"
status_http "heimdall local" "http://127.0.0.1:${LAB_HEIMDALL_HTTP_PORT:-8082}/"
@ -3107,6 +3109,7 @@ doctor_homelab() {
report_ui_check fail "Debian Services" "Gitea container" "./jeannie deploy-gitea" "" "" status_container_running "${GITEA_CONTAINER_NAME:-homelab-gitea}" || failures=$((failures + 1))
report_ui_check fail "Debian Services" "Gitea local HTTP" "./jeannie deploy-gitea" "" "" status_http_ok "http://127.0.0.1:${LAB_GITEA_HTTP_PORT:-3000}/" || failures=$((failures + 1))
report_ui_check fail "Debian Services" "Dex local HTTP" "./jeannie deploy-dex" "" "" status_dex_local_ok || failures=$((failures + 1))
report_ui_check fail "Debian Services" "SearXNG local HTTP" "./jeannie deploy-searxng" "" "" status_http_ok "http://127.0.0.1:${LAB_SEARXNG_HTTP_PORT:-8888}/healthz" || failures=$((failures + 1))
report_ui_check warn "Debian Services" "Ollama API" "./jeannie ollama-setup" "" "" status_ollama_local_ok
report_ui_check warn "Debian Services" "Gitea runner service" "./jeannie install-gitea-runner" "" "" check_systemd_active homelab-gitea-runner
@ -3121,6 +3124,7 @@ doctor_homelab() {
report_ui_check fail "Edge/Public" "Argo CD public URL" "./jeannie platform" "" "" status_http_reachable "https://argocd.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/" || failures=$((failures + 1))
report_ui_check fail "Edge/Public" "Demos public URL" "./jeannie apps" "" "" status_http_ok "https://demos.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/" || failures=$((failures + 1))
report_ui_check fail "Edge/Public" "Dex public URL" "./jeannie deploy-dex" "" "" status_http_reachable "${LAB_DEX_PUBLIC_URL:-https://auth.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" || failures=$((failures + 1))
report_ui_check fail "Edge/Public" "SearXNG public URL" "./jeannie deploy-searxng && ./jeannie edge apply" "" "" status_http_ok "${LAB_SEARXNG_PUBLIC_URL:-https://search.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}" || failures=$((failures + 1))
report_ui_check warn "Operations" "Backup freshness" "./jeannie backup" "" "" backup_status
report_ui_check warn "Operations" "Disk usage" "df -h / /data" "" "" status_disk_pressure
@ -3154,8 +3158,10 @@ doctor_homelab() {
status_systemd_units docker tailscaled homelab-gitea-runner
status_compose_stack "gitea" "/data/homelab-gitea"
status_compose_stack "dex" "${LAB_DEX_INSTALL_DIR:-/data/homelab-dex}"
status_compose_stack "searxng" "${LAB_SEARXNG_INSTALL_DIR:-/data/homelab-searxng}"
status_http "gitea local" "http://127.0.0.1:${LAB_GITEA_HTTP_PORT:-3000}/"
status_http "dex local" "http://127.0.0.1:${LAB_DEX_HTTP_PORT:-5556}/healthz"
status_http "searxng local" "http://127.0.0.1:${LAB_SEARXNG_HTTP_PORT:-8888}/healthz"
status_http "ollama" "${LAB_OLLAMA_URL:-http://${LAB_DEBIAN_LAN_IP:-192.168.100.73}:11434}/api/tags"
status_section "Edge And Public URLs"
@ -3166,6 +3172,7 @@ doctor_homelab() {
status_http "argocd public" "https://argocd.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/"
status_http "demos public" "https://demos.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/"
status_http "dex public" "${LAB_DEX_PUBLIC_URL:-https://auth.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}"
status_http "searxng public" "${LAB_SEARXNG_PUBLIC_URL:-https://search.${LAB_DOMAIN:?LAB_DOMAIN is required from homelab.yml}/}"
status_section "Operations"
backup_status || true

View File

@ -67,6 +67,9 @@ mapping = {
"services.jellyfin.http_port": "LAB_JELLYFIN_HTTP_PORT",
"services.jellyfin.public_url": "LAB_JELLYFIN_PUBLIC_URL",
"services.jeannie_api.http_port": "LAB_JEANNIE_API_BACKEND_PORT",
"services.searxng.install_dir": "LAB_SEARXNG_INSTALL_DIR",
"services.searxng.http_port": "LAB_SEARXNG_HTTP_PORT",
"services.searxng.public_url": "LAB_SEARXNG_PUBLIC_URL",
"services.local_registry.endpoint": "LAB_REGISTRY_ENDPOINT",
"services.ollama.url": "LAB_OLLAMA_URL",
"services.ollama.bind_address": "LAB_OLLAMA_BIND_ADDRESS",
@ -231,6 +234,7 @@ for service_name, env_name in [
("homepage", "LAB_HOMEPAGE_BACKEND_HOST"),
("dex", "LAB_DEX_BACKEND_HOST"),
("jellyfin", "LAB_JELLYFIN_BACKEND_HOST"),
("searxng", "LAB_SEARXNG_BACKEND_HOST"),
]:
service_lan = service_host_value(service_name, "lan_ip") or services_host_lan
service_tailscale = service_host_value(service_name, "tailscale_ip") or services_host_tailscale
@ -340,6 +344,8 @@ export_homelab_inventory_tf_vars() {
export_if_unset TF_VAR_gitea_auth_source_name "${LAB_GITEA_DEX_SOURCE_NAME:-dex}"
export_if_unset TF_VAR_jellyfin_backend_host "${LAB_JELLYFIN_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}"
export_if_unset TF_VAR_jellyfin_backend_port "${LAB_JELLYFIN_HTTP_PORT:-}"
export_if_unset TF_VAR_searxng_backend_host "${LAB_SEARXNG_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-}}"
export_if_unset TF_VAR_searxng_backend_port "${LAB_SEARXNG_HTTP_PORT:-8888}"
export_if_unset TF_VAR_office_server_name "${LAB_OFFICE_PUBLIC_HOST:-office.${LAB_DOMAIN:-lab2025.duckdns.org}}"
export_if_unset TF_VAR_office_backend_host "${LAB_OFFICE_BACKEND_HOST:-${LAB_DEBIAN_TAILSCALE_IP:-${LAB_DEBIAN_LAN_IP:-}}}"
export_if_unset TF_VAR_office_backend_port "${LAB_OFFICE_HTTP_PORT:-8090}"

View File

@ -5453,6 +5453,99 @@ ENV_EOT
echo "Homepage is reachable at http://127.0.0.1:${homepage_http_port}/ and ${homepage_public_url%/}/."
}
deploy_searxng() {
local mode="${LAB_SEARXNG_DEPLOY:-true}"
local install_dir="${LAB_SEARXNG_INSTALL_DIR:-/data/homelab-searxng}"
local http_port="${LAB_SEARXNG_HTTP_PORT:-8888}"
local bind_ip="${LAB_SEARXNG_BIND_IP:-0.0.0.0}"
local public_url="${LAB_SEARXNG_PUBLIC_URL:-https://search.${LAB_DOMAIN:-lab2025.duckdns.org}/}"
local image="${SEARXNG_IMAGE:-docker.io/searxng/searxng:2026.12.3-44427d4a8}"
local valkey_image="${VALKEY_IMAGE:-docker.io/valkey/valkey:9-alpine}"
local container_name="${SEARXNG_CONTAINER_NAME:-homelab-searxng}"
local valkey_container_name="${VALKEY_CONTAINER_NAME:-homelab-searxng-valkey}"
local source_dir="${REPO_ROOT}/infra/searxng"
local install_docker="${LAB_SEARXNG_INSTALL_DOCKER:-false}"
local secret=""
local elapsed=0
local value_name
local value
require_debian_server "deploy-searxng"
if disabled_value "${mode}"; then
return 0
fi
for value_name in install_dir http_port bind_ip public_url image valkey_image container_name valkey_container_name install_docker; do
value="${!value_name}"
if [[ "${value}" == *$'\n'* ]]; then
echo "${value_name} cannot contain a newline." >&2
return 1
fi
done
if ! [[ "${http_port}" =~ ^[0-9]+$ ]] || ((http_port < 1 || http_port > 65535)); then
echo "LAB_SEARXNG_HTTP_PORT must be a valid TCP port." >&2
return 1
fi
if [[ ! -s "${source_dir}/docker-compose.yml" || ! -s "${source_dir}/settings.yml" || ! -s "${source_dir}/limiter.toml" ]]; then
echo "Missing SearXNG source files in ${source_dir}." >&2
return 1
fi
ensure_local_docker_compose "SEARXNG" "${install_docker}"
repair_local_docker_iptables
sudo mkdir -p "${install_dir}/config"
sudo cp "${source_dir}/docker-compose.yml" "${install_dir}/docker-compose.yml"
sudo cp "${source_dir}/settings.yml" "${install_dir}/config/settings.yml"
sudo cp "${source_dir}/limiter.toml" "${install_dir}/config/limiter.toml"
sudo chmod 0644 "${install_dir}/docker-compose.yml" "${install_dir}/config/settings.yml" "${install_dir}/config/limiter.toml"
if sudo test -s "${install_dir}/.env"; then
secret="$(sudo sed -n 's/^SEARXNG_SECRET=//p' "${install_dir}/.env" | head -n 1)"
fi
if ! [[ "${secret}" =~ ^[[:xdigit:]]{64}$ ]]; then
secret="$(openssl rand -hex 32)"
fi
umask 077
printf '%s\n' \
"SEARXNG_IMAGE=${image}" \
"VALKEY_IMAGE=${valkey_image}" \
"SEARXNG_CONTAINER_NAME=${container_name}" \
"VALKEY_CONTAINER_NAME=${valkey_container_name}" \
"SEARXNG_BIND_IP=${bind_ip}" \
"SEARXNG_HTTP_PORT=${http_port}" \
"SEARXNG_PORT=8080" \
"SEARXNG_BASE_URL=${public_url%/}/" \
"SEARXNG_SECRET=${secret}" \
"SEARXNG_LIMITER=true" \
"SEARXNG_PUBLIC_INSTANCE=false" \
"SEARXNG_IMAGE_PROXY=true" \
"SEARXNG_VALKEY_URL=valkey://valkey:6379/0" |
sudo tee "${install_dir}/.env" >/dev/null
sudo chmod 0600 "${install_dir}/.env"
(
cd "${install_dir}"
sudo docker compose pull
sudo docker compose up -d --remove-orphans
sudo docker compose ps
)
until curl -fsS --connect-timeout 5 "http://127.0.0.1:${http_port}/healthz" >/dev/null; do
if ((elapsed >= 180)); then
echo "Timed out waiting for SearXNG on http://127.0.0.1:${http_port}/healthz" >&2
(cd "${install_dir}" && sudo docker compose ps && sudo docker compose logs --tail=160) >&2 || true
return 1
fi
sleep 5
elapsed=$((elapsed + 5))
done
echo "SearXNG is healthy at http://127.0.0.1:${http_port}/ and will be published at ${public_url%/}/ by the edge stage."
}
deploy_matrix() {
local mode="${LAB_MATRIX_DEPLOY:-true}"
local install_dir="${LAB_MATRIX_INSTALL_DIR:-/home/jv/matrix-server}"
@ -8881,6 +8974,11 @@ spec = {
"title": "Heimdall deploy",
"command": [jeannie, "__up-task", "heimdall-deploy"],
},
{
"id": "searxng-deploy",
"title": "SearXNG deploy",
"command": [jeannie, "__up-task", "searxng-deploy"],
},
{
"id": "dex-deploy",
"title": "Dex deploy",
@ -8962,6 +9060,9 @@ up_task() {
heimdall-deploy)
deploy_heimdall
;;
searxng-deploy)
deploy_searxng
;;
dex-deploy)
deploy_dex
;;

View File

@ -50,6 +50,7 @@ HOST_METADATA = {
"suwayomi": ("Suwayomi", "Manga server and scraper engine", "#8b5cf6", "Suwayomi"),
"maintainerr": ("Maintainerr", "Media list maintenance automation", "#14b8a6", "Maintainerr"),
"flaresolverr": ("FlareSolverr", "Browser challenge solver service for ARR automation", "#64748b", "FlareSolverr"),
"search": ("SearXNG", "Privacy-respecting homelab metasearch", "#22a699", "SearXNG"),
}

View File

@ -20,6 +20,7 @@ SERVICE_GROUPS = {
"Homepage": "Public",
"Heimdall": "Public",
"Service Catalog": "Public",
"SearXNG": "Public",
"Gitea": "Platform",
"Argo CD": "Platform",
"Grafana": "Platform",
@ -63,6 +64,7 @@ ICON_MAP = {
"Homepage": "homepage.png",
"Heimdall": "heimdall.png",
"Service Catalog": "mdi-map",
"SearXNG": "mdi-magnify",
"Gitea": "gitea.png",
"Argo CD": "argocd.png",
"Grafana": "grafana.png",

View File

@ -128,6 +128,14 @@ def service_rows(values: dict[str, object]) -> list[dict[str, str]]:
"public": value(values, "services.gitea.root_url"),
"docs": "infra/gitea/README.md",
},
{
"name": "SearXNG",
"host": value(values, "services.searxng.host", "debian"),
"managed_by": "Docker Compose / jeannie deploy-searxng",
"local": f"http://{debian_ip}:{value(values, 'services.searxng.http_port', '8888')}/",
"public": value(values, "services.searxng.public_url", f"https://search.{domain}/"),
"docs": "infra/searxng/README.md",
},
{
"name": "GitOps mirror",
"host": value(values, "services.gitops_mirror.host", "debian"),

View File

@ -133,6 +133,7 @@ validate_unit_tests() {
python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_monitoring_loki.py'
python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_monitoring_debian.py'
python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_monitoring_readiness.py'
python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_searxng_pipeline.py'
python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_doctor_k3s_storage.py'
python3 -m unittest discover -s "${REPO_ROOT}/tests/jeannie" -p 'test_holmes_evidence.py'
if [[ -x "${LAB_HOLMES_ADAPTER_PYTHON:-/home/jv/.local/share/pipx/venvs/holmesgpt/bin/python}" ]]; then

View File

@ -70,12 +70,14 @@ else:
"hosts.oci_edge.public_ip",
"services.gitea.root_url",
"services.heimdall.public_url",
"services.searxng.public_url",
"services.local_registry.endpoint",
"services.traefik.load_balancer_ip",
):
require(path)
require("pimox.default_worker_count", None)
require("services.heimdall.http_port", None)
require("services.searxng.http_port", None)
subdomains = require("domain.subdomains", list)
if isinstance(subdomains, list):
@ -165,6 +167,8 @@ required_paths = %w[
services.gitea.root_url
services.heimdall.http_port
services.heimdall.public_url
services.searxng.http_port
services.searxng.public_url
services.local_registry.endpoint
services.traefik.load_balancer_ip
pimox.default_worker_count

View File

@ -0,0 +1,43 @@
#!/usr/bin/env python3
import pathlib
import unittest
ROOT = pathlib.Path(__file__).resolve().parents[2]
class SearxngPipelineTests(unittest.TestCase):
def test_compose_has_isolated_valkey_and_resource_limits(self):
compose = (ROOT / "infra/searxng/docker-compose.yml").read_text(encoding="utf-8")
self.assertIn("name: homelab-searxng", compose)
self.assertIn("valkey:", compose)
self.assertIn("mem_limit: 768m", compose)
self.assertIn("searxng:2026.12.3-44427d4a8", compose)
self.assertNotIn("valkey/valkey:latest", compose)
def test_settings_enable_limiter_and_json(self):
settings = (ROOT / "infra/searxng/settings.yml").read_text(encoding="utf-8")
self.assertIn("limiter: true", settings)
self.assertIn("url: valkey://valkey:6379/0", settings)
self.assertIn("- json", settings)
def test_edge_has_dedicated_route_not_generic_backend(self):
main = (ROOT / "bootstrap/edge/main.tf").read_text(encoding="utf-8")
nginx = (ROOT / "bootstrap/edge/templates/default.conf.tftpl").read_text(encoding="utf-8")
self.assertIn('searxng_server_name = "search.${var.server_name}"', main)
self.assertIn("server_name ${searxng_server_name};", nginx)
self.assertIn("zone=searxng_search", nginx)
self.assertIn("proxy_pass http://${searxng_backend_host}:${searxng_backend_port}", nginx)
def test_pipeline_preserves_secret_and_checks_health(self):
pipeline = (ROOT / "lib/jeannie/pipeline.sh").read_text(encoding="utf-8")
self.assertIn("deploy_searxng()", pipeline)
self.assertIn('"id": "searxng-deploy"', pipeline)
self.assertIn("SEARXNG_SECRET=//p", pipeline)
self.assertIn('openssl rand -hex 32', pipeline)
self.assertIn('${http_port}/healthz', pipeline)
if __name__ == "__main__":
unittest.main()