Skip to content

Fix Docker networking between Node server and SearXNG#8

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-searxng-api-endpoint
Draft

Fix Docker networking between Node server and SearXNG#8
Copilot wants to merge 3 commits intomainfrom
copilot/fix-searxng-api-endpoint

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Node server running in Docker cannot reach SearXNG via localhost:8888localhost resolves to the container itself, not the host. Causes ECONNREFUSED, AbortError, and /healthz timeouts.

Changes

  • docker-compose.yml: Add server service with SEARXNG_URL=http://searxng:8080 (internal DNS + internal port), shared macai-net bridge network, depends_on ordering. Fix SEARXNG_BASE_URL to match.
  • Dockerfile: New — node:20-alpine single-stage build for the server.
  • server.js: Replace single 3s startup health check with 5-attempt retry loop (5s timeout, 3s backoff). Handles Docker cold-start race where SearXNG isn't ready yet. Breaks immediately on HTTP errors (reachable but unhealthy) vs retrying only on connection failures.
  • README.md: Document both modes and env vars.

Networking model

Deployment SEARXNG_URL Why
Both in Compose http://searxng:8080 Docker internal DNS, no port mapping needed
Server on host http://localhost:8888 Default; uses published port 8888→8080

The Compose file sets SEARXNG_URL explicitly for the container case; the server.js default (localhost:8888) covers host-mode with no config needed.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • searxng
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node -e import('./server.js').catch(() => {}); (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@codesandbox
Copy link

codesandbox bot commented Mar 3, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copilot AI and others added 2 commits March 3, 2026 00:08
…c, and Dockerfile

- docker-compose.yml: Add Node.js server service with SEARXNG_URL=http://searxng:8080,
  shared macai-net bridge network, depends_on for startup ordering, and fix
  SEARXNG_BASE_URL to use internal Docker hostname
- Dockerfile: Add multi-stage build for the Node.js server
- server.js: Replace single 3s startup health check with 5-attempt retry loop
  (5s timeout each, 3s delay between) to handle Docker cold-start timing
- README.md: Document Docker and host-mode usage, environment variables

Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
Co-authored-by: sriail <225764385+sriail@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix SearXNG API endpoint configuration for Node.js server Fix Docker networking between Node server and SearXNG Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants