dsh-searxng-search: A Local, Key-Free Web Search Plugin

In the DeepSeek Harness (DSH) web_search ecosystem, using official or third-party hosted APIs typically requires an API Key or an MCP relay, which introduces latency and privacy concerns. The dsh-searxng-search plugin provides localized, keyless search capabilities for DSH via a self-hosted SearXNG instance.

Plugin Introduction

  • Name: dsh-searxng-search
  • Author: anthony1x6000
  • License: MIT
  • Core Positioning: Keyless web_search for DeepSeek Harness via a self-hosted SearXNG instance
  • Maintainer: Maintained via GitHub, included in the community directory

Core Features

The plugin provides the following capabilities:

  1. Keyless Search: Bypasses API Key restrictions by searching directly through a local SearXNG instance.
  2. Lightweight Provider: Acts as the ctx.web provider for searxng-local.
  3. On-demand Startup: Uses podman to start containers on demand, eliminating the need for a resident service.
  4. Zero-build: Build artifacts (lib/) are committed, so no build commands need to be run when installing from Git.
  5. Isolated Running: Containers are launched in an independent systemd scope to prevent port forwarding failures caused by restarting dsh-web.

Installation and Activation

Before installing the plugin, ensure that podman is installed on the system (this is a system-level dependency, not within the scope of pnpm).

  1. Install Podman (Example for Ubuntu):
    sudo apt update && sudo apt install -y podman
  1. Install Plugin Layer:
    Add the plugin to the web profile:
    dsh plugin --profile web add "github:anthony1x6000/dsh-searxng-search#main"
  1. Verify Configuration:
    Check if the configuration is effective without starting the service:
    dsh --profile web --dump-config | grep -B 1 -A 4 searxng
  1. Apply Changes:
    Restart dsh web to load the new bundle layer:
    # The restart command is typically
    dsh web restart

Configuration Options

The plugin is controlled via environment variables or configuration lines. The default values are as follows:

Environment Variable / Field Default Value Meaning
SEARXNG_BASE_URL / baseURL http://127.0.0.1:8888 Base address of the SearXNG service; /search is automatically appended to the search interface.
SEARXNG_CONTAINER / containerName searxng Name of the container to be started on demand.
SEARXNG_CLI / containerCLI podman Container runtime command; docker is supported as a fallback.
SEARXNG_START_TIMEOUT_MS / startTimeoutMs 60000 Timeout for container startup and readiness during each search (milliseconds).
SEARXNG_AUTO_CREATE / autoCreate true Whether to automatically create the container if it does not exist; set to 0 or false to only start it.
SEARXNG_IMAGE / image docker.io/searxng/searxng:latest Image to pull during the first creation.
SEARXNG_PORT / port 8888 Port mapped from the container to the host.
SEARXNG_DETACH / detach true Whether to launch the container using a systemd scope to isolate the cgroup.

Working Principle and Notes

Container Launch Scope Mechanism

By default, the podman command inherits the caller’s cgroup. If run directly, restarting the dsh-web service will clean up the container and its processes (such as conmon and pasta) due to the default KillMode=control-group, resulting in port forwarding interruption.

This plugin wraps the container launch command in a temporary scope using systemd-run --user --scope. The scope is a sibling to dsh-web, so restarting DSH does not affect the running container, but port mapping is managed by the scope. Status can be viewed via systemctl --user status dsh-searxng-searxng.scope.

Auto-create and Limitations

  • First Search: The container is created during the first search, taking approximately 1-2 minutes (for image pulling).
  • Subsequent Searches: The container is started on demand.
  • Loopback Only: Autostart only supports localhost, 127.0.0.1, and ::1. Remote addresses will fail immediately.
  • Redirect Limitations: redirect: 'error' is enabled in the SearXNG configuration, so the plugin does not handle redirects.

Local Development

If you need to modify the plugin code for development:

  1. Clone the repository and install dependencies:
    pnpm install && pnpm build
  1. Install using a local link path:
    dsh plugin --profile web add link:/path/to/dsh-searxng-search

Summary

dsh-searxng-search addresses the need for keyless, fast search in local environments for DSH developers. Through the systemd scope mechanism, it elegantly handles the conflict between container lifecycle and DSH process restarts.

  • GitHub: https://github.com/anthony1x6000/dsh-searxng-search
  • Community Directory: https://www.skillhub.cn/plugins/anthony1x6000/dsh-searxng-search
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye