Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:ARCANGEL0 EVA ensure local searxng running

From Leeroopedia
Knowledge Sources
Domains Containers, Infrastructure
Last Updated 2026-10-29 14:00 GMT

Overview

Concrete tool for ensuring a previously-configured SearXNG container is running after a host reboot, with automatic start and readiness probing, provided by the Mitsu SearXNG service module.

Description

The ensure_local_searxng_running function checks if a managed local SearXNG container is running:

  1. Skip if not managed: If `settings["managed_local"]` is not True, returns immediately.
  2. Validate settings: Checks that the saved runtime and container_name are present and valid.
  3. Check Docker availability: Verifies the Docker binary is still on PATH.

4 Check container state: Uses `docker container inspect` to determine if the container is running, stopped, or missing. 5 Start if stopped: Runs `docker start <container_name>` if the container is stopped. 6 Probe readiness: Polls the JSON API endpoint for up to 45 seconds (1.5s intervals).

Usage

  • Before web search: Called by `_search_one` in the search engine module before querying SearXNG to ensure it's running.
  • Session startup: Called when a session starts and SearXNG is configured.

Code Reference

Source Location

  • Repository: Mitsu
  • File: services/searxng.py

Signature

def ensure_local_searxng_running(settings: dict[str, object]) -> None: ...

Import

from mitsu.services.searxng import ensure_local_searxng_running

I/O Contract

Inputs

Name Type Required Description
settings dict[str, object] Yes Saved SearXNG config with managed_local, container_runtime, container_name, base_url

Outputs

Name Type Description
returns None Raises SearXNGSetupError if the container cannot be started or probed

Usage Examples

Ensure SearXNG is Running

from mitsu.services.searxng import ensure_local_searxng_running

settings = {
    "managed_local": True,
    "container_runtime": "docker",
    "container_name": "mitsu-searxng-8888",
    "base_url": "http://127.0.0.1:8888",
}

try:
    ensure_local_searxng_running(settings)
    print("SearXNG is ready.")
except SearXNGSetupError as error:
    print(f"SearXNG setup error: {error}")

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment