fix(docker): bake searxng settings.yml into custom image

This commit is contained in:
matevip 2026-04-24 23:25:03 +08:00
parent 7b038522aa
commit cfd9393184
3 changed files with 76 additions and 11 deletions

View File

@ -33,12 +33,13 @@ services:
# SearXNG 搜索引擎keyless 搜索 provider # SearXNG 搜索引擎keyless 搜索 provider
# #
# ⚠️ deploy/searxng/settings.yml is bind-mounted because the upstream image # The custom image at docker/searxng/ bakes in settings.yml so the sidecar
# ships with JSON format disabled and the anti-bot Limiter plugin enabled — # works out of the box (upstream image ships JSON disabled + Limiter enabled,
# both of which would silently break mateclaw's SearXNGSearchProvider. # both of which silently break mateclaw's SearXNGSearchProvider).
# Do NOT remove that bind mount. # No host bind-mount — edit docker/searxng/settings.yml and rebuild.
searxng: searxng:
image: searxng/searxng:latest build:
context: ./docker/searxng
container_name: mateclaw-searxng container_name: mateclaw-searxng
restart: unless-stopped restart: unless-stopped
environment: environment:
@ -46,11 +47,6 @@ services:
- SEARXNG_SECRET=${SEARXNG_SECRET:-mateclaw-dev-searxng-secret-change-me} - SEARXNG_SECRET=${SEARXNG_SECRET:-mateclaw-dev-searxng-secret-change-me}
- UWSGI_WORKERS=2 - UWSGI_WORKERS=2
- UWSGI_THREADS=4 - UWSGI_THREADS=4
volumes:
- searxng_data:/etc/searxng
# This override MUST be mounted AFTER the named volume so it shadows
# the image's default settings.yml (enables JSON, disables limiter).
- ./deploy/searxng/settings.yml:/etc/searxng/settings.yml:ro
ports: ports:
- "8088:8080" - "8088:8080"
healthcheck: healthcheck:
@ -103,4 +99,3 @@ services:
volumes: volumes:
mysql_data: mysql_data:
server_data: server_data:
searxng_data:

View File

@ -0,0 +1,9 @@
# Custom SearXNG image for MateClaw.
#
# Bakes our settings.yml into /etc/searxng/settings.yml so the sidecar works
# out of the box with no host bind-mount. The upstream image ships JSON output
# disabled and the Limiter plugin enabled — both silently break mateclaw's
# SearXNGSearchProvider, so this override is required.
FROM searxng/searxng:latest
COPY settings.yml /etc/searxng/settings.yml

View File

@ -0,0 +1,61 @@
# SearXNG config for MateClaw's bundled search sidecar.
#
# Two things differ from the upstream default:
# 1. JSON output format is enabled — mateclaw's SearXNGSearchProvider
# queries /search?format=json and fails silently without this.
# 2. The anti-bot Limiter plugin is disabled — it otherwise rejects
# server-side HTTP calls (no JS, no cookies) with HTTP 429.
#
# This file is baked into the custom image via docker/searxng/Dockerfile —
# do NOT bind-mount it from the host (prior host bind-mount broke deploys
# where the host directory did not exist and Docker auto-created an empty
# dir over the path).
#
# See https://docs.searxng.org/admin/settings/ for all knobs.
use_default_settings: true
general:
# Cosmetic only; shown in the UI title.
instance_name: "MateClaw Search"
# Keep this private — no outbound metrics.
donation_url: false
contact_url: false
enable_metrics: false
search:
safe_search: 0
autocomplete: ""
default_lang: "auto"
formats:
- html
- json # REQUIRED for mateclaw integration
server:
# Override the default dev secret; docker-compose passes SEARXNG_SECRET in.
secret_key: "${SEARXNG_SECRET:-please-change-me-to-a-random-32-char-string}"
# Trust Docker's internal network — the reverse-proxy / rate-limit plugin
# uses this to know the caller's real IP.
limiter: false
image_proxy: false
# Bind address matches the container default.
bind_address: "0.0.0.0"
port: 8080
ui:
static_use_hash: true
# The default engine list is huge; keep a tight set of reliable ones.
engines:
- name: duckduckgo
disabled: false
- name: bing
disabled: false
- name: brave
disabled: false
- name: wikipedia
disabled: false
- name: google
disabled: false
- name: startpage
disabled: false