feat(dev): docker-compose.yml als vollwertiges Dev-Setup
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 1m24s
All checks were successful
Build & Publish Docker Image / build-and-push (push) Successful in 1m24s
Bisher lief der Dev-SearXNG über ein direktes bind-mount von
./searxng:/etc/searxng, was ${…}-Platzhalter im settings.yml als Literal
übernommen hat (Brave-Key konnte so nicht getestet werden).
Jetzt spiegelt der Dev-Compose das Prod-Pattern:
- searxng-init-Container expandiert die Platzhalter per Python und
legt die gerenderte settings.yml auf ein named volume.
- searxng-Container mountet das volume statt bind.
- depends_on mit service_completed_successfully → sauberes Startup.
- Werte kommen aus .env (BRAVE_API_KEY, SEARXNG_SECRET); Default für
SEARXNG_SECRET bleibt compose-seitig gesetzt, damit man ohne .env
booten kann.
.env.example erweitert um BRAVE_API_KEY und SEARXNG_SECRET, mit kurzen
Kommentaren zu Beschaffung und Erzeugung.
Flow für einen Neu-Einsteiger:
cp .env.example .env # Key optional eintragen
docker compose up -d # bringt SearXNG hoch
npm run dev # startet die App lokal
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
14
.env.example
14
.env.example
@@ -1,3 +1,17 @@
|
|||||||
|
# Kopiere zu .env und trage deine Werte ein.
|
||||||
|
# .env ist per .gitignore ausgenommen — Secrets landen nie im Repo.
|
||||||
|
|
||||||
|
# Kochwas-App (nur relevant, wenn du die App lokal startest; die Compose-
|
||||||
|
# Setups setzen ihre eigenen Pfade im Container).
|
||||||
DATABASE_PATH=./data/kochwas.db
|
DATABASE_PATH=./data/kochwas.db
|
||||||
IMAGE_DIR=./data/images
|
IMAGE_DIR=./data/images
|
||||||
SEARXNG_URL=http://localhost:8888
|
SEARXNG_URL=http://localhost:8888
|
||||||
|
|
||||||
|
# Brave Search API-Key (https://api-dashboard.search.brave.com/).
|
||||||
|
# Leer lassen, wenn du ohne Brave testen willst — andere Engines laufen
|
||||||
|
# trotzdem. Fehlt der Key, antwortet die Brave-Engine nur mit 401.
|
||||||
|
BRAVE_API_KEY=
|
||||||
|
|
||||||
|
# SearXNG-Secret: beliebig lange Zufallskette. Für Prod mit
|
||||||
|
# `openssl rand -hex 32` generieren und in der Pi-.env ablegen.
|
||||||
|
SEARXNG_SECRET=dev-secret-change-me
|
||||||
|
|||||||
@@ -1,11 +1,47 @@
|
|||||||
|
# Dev-Setup: nur SearXNG läuft im Container; Kochwas selbst startest du
|
||||||
|
# lokal mit `npm run dev`. SEARXNG_URL=http://localhost:8888 wird von der
|
||||||
|
# App automatisch erkannt (oder via .env gesetzt).
|
||||||
|
#
|
||||||
|
# Starten:
|
||||||
|
# cp .env.example .env # einmalig, Werte anpassen
|
||||||
|
# docker compose up -d
|
||||||
|
# npm run dev
|
||||||
|
#
|
||||||
|
# Der Init-Container expandiert ${BRAVE_API_KEY} und ${SEARXNG_SECRET} aus
|
||||||
|
# der .env genau wie prod — damit testet man lokal mit dem gleichen Flow.
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
searxng-init:
|
||||||
|
image: searxng/searxng:latest
|
||||||
|
restart: 'no'
|
||||||
|
user: root
|
||||||
|
entrypoint:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
python3 -c "import os; open('/out/settings.yml','w').write(os.path.expandvars(open('/in/settings.yml').read()))"
|
||||||
|
volumes:
|
||||||
|
- ./searxng:/in:ro
|
||||||
|
- searxng-config:/out
|
||||||
|
environment:
|
||||||
|
- FORCE_OWNERSHIP=false
|
||||||
|
- BRAVE_API_KEY=${BRAVE_API_KEY:-}
|
||||||
|
- SEARXNG_SECRET=${SEARXNG_SECRET:-dev-secret-change-me}
|
||||||
|
|
||||||
searxng:
|
searxng:
|
||||||
image: searxng/searxng:latest
|
image: searxng/searxng:latest
|
||||||
ports:
|
ports:
|
||||||
- '8888:8080'
|
- '8888:8080'
|
||||||
volumes:
|
volumes:
|
||||||
- ./searxng:/etc/searxng
|
- searxng-config:/etc/searxng
|
||||||
environment:
|
environment:
|
||||||
- BASE_URL=http://localhost:8888/
|
- BASE_URL=http://localhost:8888/
|
||||||
- INSTANCE_NAME=kochwas-search-dev
|
- INSTANCE_NAME=kochwas-search-dev
|
||||||
|
depends_on:
|
||||||
|
searxng-init:
|
||||||
|
condition: service_completed_successfully
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
searxng-config:
|
||||||
|
|||||||
Reference in New Issue
Block a user