Run the containers with the systemd configuration, 1:1
The containers now read the unchanged .env of the matching systemd instance (/home/llmadmin/mindnet_dev/.env, /home/llmadmin/mindnet/.env) and use the same Qdrant, Ollama, vault and collection prefix, so both can be compared side by side. Only container-specific values are overridden: host service addresses (host.docker.internal instead of 127.0.0.1) and the read-only vault. - deploy/appenv.py derives the vault mount and prefix from that .env and rejects application keys in the container-only file. - Remove the separate dev Qdrant, the synthetic test vault and the import step. - UI binds 0.0.0.0 like systemd; API stays loopback by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
eae30775e3
commit
6cdad8b046
20 files changed
+373
-415
No files matched your search
+2
-1
@@ -62,4 +62,5 @@ COPY .gitea/workflows/ .gitea/workflows/
|
||||
USER mindnet:mindnet
|
||||
ENTRYPOINT []
|
||||
CMD ["python", "-m", "pytest", "-q", "-p", "no:cacheprovider", \
|
||||
"tests/test_container_preflight.py", "tests/test_container_connectivity.py"]
|
||||
"tests/test_container_preflight.py", "tests/test_container_connectivity.py", \
|
||||
"tests/test_container_appenv.py"]
|
||||
@@ -0,0 +1,96 @@
|
||||
"""
|
||||
FILE: deploy/appenv.py
|
||||
DESCRIPTION: Liest die unveränderte .env der systemd-Instanz und leitet daraus ab, was
|
||||
Compose für denselben Betrieb im Container braucht:
|
||||
- Vault: Host-Pfad und Einhängepunkt so, dass MINDNET_VAULT_ROOT der .env im
|
||||
Container auf dasselbe Verzeichnis zeigt (relativ -> unter /app, wie unter
|
||||
dem WorkingDirectory der systemd-Unit)
|
||||
- erwartetes Collection-Präfix für den Smoke-Test
|
||||
Prüft außerdem, dass die Container-Datei nur Container-Angaben enthält und
|
||||
damit keine Anwendungskonfiguration überschreibt.
|
||||
Nur Standardbibliothek (läuft direkt auf dem Runner).
|
||||
VERSION: 1.0.0
|
||||
STATUS: Active
|
||||
USAGE: appenv.py <systemd.env> <container.env> -> Shell-Zuweisungen auf stdout
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import posixpath
|
||||
import shlex
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Einzige Schlüssel, die die Container-Datei setzen darf.
|
||||
CONTAINER_KEYS = {
|
||||
"MINDNET_API_PORT", "MINDNET_API_BIND", "MINDNET_UI_PORT", "MINDNET_UI_BIND",
|
||||
"MINDNET_API_MEM_LIMIT", "MINDNET_UI_MEM_LIMIT", "MINDNET_ALLOW_CLOUD_EGRESS",
|
||||
"MINDNET_VAULT_SENTINEL",
|
||||
}
|
||||
APP_WORKDIR = "/app"
|
||||
DEFAULT_VAULT_ROOT = "./vault_master" # Default aus app/config.py
|
||||
DEFAULT_PREFIX = "mindnet" # Default aus app/config.py
|
||||
|
||||
|
||||
class AppEnvError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
def parse(path: str) -> dict[str, str]:
|
||||
"""Einfacher dotenv-Parser (KEY=VALUE, optional 'export', Quotes, Kommentare)."""
|
||||
values = {}
|
||||
for raw in Path(path).read_text(encoding="utf-8").splitlines():
|
||||
line = raw.strip()
|
||||
if not line or line.startswith("#") or "=" not in line:
|
||||
continue
|
||||
if line.startswith("export "):
|
||||
line = line[len("export "):].lstrip()
|
||||
key, value = (part.strip() for part in line.split("=", 1))
|
||||
if len(value) >= 2 and value[0] in "\"'" and value[-1] == value[0]:
|
||||
value = value[1:-1]
|
||||
elif " #" in value:
|
||||
value = value.split(" #", 1)[0].rstrip()
|
||||
values[key] = value
|
||||
return values
|
||||
|
||||
|
||||
def vault_mount(app_env_path: str, values: dict[str, str]) -> tuple[str, str]:
|
||||
root = values.get("MINDNET_VAULT_ROOT") or DEFAULT_VAULT_ROOT
|
||||
if posixpath.isabs(root):
|
||||
return posixpath.normpath(root), posixpath.normpath(root)
|
||||
# systemd startet im Ordner der .env (WorkingDirectory), der Container in /app.
|
||||
host_dir = posixpath.dirname(Path(app_env_path).as_posix())
|
||||
return posixpath.normpath(posixpath.join(host_dir, root)), posixpath.normpath(posixpath.join(APP_WORKDIR, root))
|
||||
|
||||
|
||||
def derive(app_env_path: str, container_env_path: str) -> dict[str, str]:
|
||||
extra = sorted(set(parse(container_env_path)) - CONTAINER_KEYS)
|
||||
if extra:
|
||||
raise AppEnvError(
|
||||
f"{container_env_path} darf nur Container-Angaben enthalten; "
|
||||
f"Anwendungswerte gehören in {app_env_path}: {', '.join(extra)}"
|
||||
)
|
||||
values = parse(app_env_path)
|
||||
host, target = vault_mount(app_env_path, values)
|
||||
return {
|
||||
"MINDNET_VAULT_HOST_PATH": host,
|
||||
"MINDNET_VAULT_TARGET": target,
|
||||
"MINDNET_EXPECTED_PREFIX": values.get("COLLECTION_PREFIX") or DEFAULT_PREFIX,
|
||||
}
|
||||
|
||||
|
||||
def main(argv: list[str]) -> int:
|
||||
if len(argv) != 3:
|
||||
print("Aufruf: appenv.py <systemd.env> <container.env>", file=sys.stderr)
|
||||
return 2
|
||||
try:
|
||||
derived = derive(argv[1], argv[2])
|
||||
except (OSError, AppEnvError) as e:
|
||||
print(f"appenv: {e}", file=sys.stderr)
|
||||
return 1
|
||||
for key, value in derived.items():
|
||||
print(f"{key}={shlex.quote(value)}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
+23
-39
@@ -1,11 +1,11 @@
|
||||
# Mindnet ENTWICKLUNG als Container: isoliert von Produktion.
|
||||
# Mindnet ENTWICKLUNG als Container: dieselbe Anwendung mit derselben Konfiguration
|
||||
# wie die systemd-Dev-Instanz (8002/8502), parallel auf 8012/8512 zum Vergleich.
|
||||
#
|
||||
# docker compose -f deploy/compose.dev.yml --env-file deploy/env/dev.env up -d --wait
|
||||
#
|
||||
# - Eigene Qdrant-Instanz mit eigenem Volume (Prod-Qdrant wird nie angesprochen).
|
||||
# - Vault: nur Testdaten, nur lesend.
|
||||
# - Ollama ist ein gemeinsamer Host-Dienst (Embeddings).
|
||||
# - Andere Ports und anderer Compose-Projektname als Prod.
|
||||
# Gestartet über deploy/deploy.sh dev. Zwei Dateien, beide nur auf dem Host:
|
||||
# - MINDNET_APP_ENV_FILE: die unveränderte .env der systemd-Dev-Instanz
|
||||
# - MINDNET_ENV_FILE: nur Container-Angaben (Ports, Bind-Adressen, Freigaben)
|
||||
# Fest überschrieben wird nur, was im Container anders lauten muss: die Adressen
|
||||
# der Host-Dienste (statt 127.0.0.1). Vault-Pfad und Präfix kommen aus der .env.
|
||||
|
||||
name: mindnet-dev
|
||||
|
||||
@@ -15,7 +15,9 @@ x-hardening: &hardening
|
||||
context: ..
|
||||
dockerfile: deploy/Dockerfile
|
||||
target: runtime
|
||||
env_file: ["${MINDNET_ENV_FILE:-env/dev.env}"]
|
||||
env_file:
|
||||
- ${MINDNET_APP_ENV_FILE:?MINDNET_APP_ENV_FILE auf die .env der systemd-Dev-Instanz setzen}
|
||||
- ${MINDNET_ENV_FILE:-env/dev.env}
|
||||
read_only: true
|
||||
tmpfs: ["/tmp:size=64m,mode=1777"]
|
||||
cap_drop: [ALL]
|
||||
@@ -29,54 +31,36 @@ x-hardening: &hardening
|
||||
options: {max-size: "10m", max-file: "3"}
|
||||
networks: [mindnet-dev]
|
||||
|
||||
x-fixed-env: &fixed-env
|
||||
# Container-bedingte Werte; haben Vorrang vor beiden env-Dateien.
|
||||
x-container-env: &container-env
|
||||
MINDNET_ENV: dev
|
||||
COLLECTION_PREFIX: mindnet_dev
|
||||
QDRANT_URL: http://qdrant:6333
|
||||
QDRANT_URL: http://host.docker.internal:6333
|
||||
MINDNET_OLLAMA_URL: http://host.docker.internal:11434
|
||||
VECTOR_DIM: "768"
|
||||
MINDNET_EXPECTED_VECTOR_DIM: "768"
|
||||
MINDNET_EXPECTED_EMBEDDING_MODEL: nomic-embed-text
|
||||
MINDNET_VAULT_ROOT: /vault
|
||||
MINDNET_VAULT_READONLY: "true"
|
||||
MINDNET_VOCAB_PATH: /vault/_system/dictionary/edge_vocabulary.md
|
||||
MINDNET_SCHEMA_PATH: /vault/_system/dictionary/graph_schema.md
|
||||
|
||||
services:
|
||||
qdrant:
|
||||
image: qdrant/qdrant:v1.16.2@sha256:dab6de32f7b2cc599985a7c764db3e8b062f70508fb85ca074aa856f829bf335
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
QDRANT__TELEMETRY_DISABLED: "true"
|
||||
volumes:
|
||||
- qdrant:/qdrant/storage
|
||||
# Standardmäßig nicht veröffentlicht; zum Debuggen optional lokal am Host.
|
||||
ports: ["127.0.0.1:${MINDNET_DEV_QDRANT_PORT:-6343}:6333"]
|
||||
healthcheck:
|
||||
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/6333"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
networks: [mindnet-dev]
|
||||
|
||||
api:
|
||||
<<: *hardening
|
||||
command: ["api"]
|
||||
environment:
|
||||
<<: *fixed-env
|
||||
<<: *container-env
|
||||
volumes:
|
||||
# Derselbe Vault wie systemd-Dev, eingehängt dort, wo MINDNET_VAULT_ROOT hinzeigt.
|
||||
# Nur lesend, solange beide Instanzen parallel laufen.
|
||||
- type: bind
|
||||
source: ${MINDNET_VAULT_HOST_PATH:?MINDNET_VAULT_HOST_PATH auf ein Testdaten-Verzeichnis setzen}
|
||||
target: /vault
|
||||
source: ${MINDNET_VAULT_HOST_PATH:?wird von deploy/deploy.sh aus der .env abgeleitet}
|
||||
target: ${MINDNET_VAULT_TARGET:?wird von deploy/deploy.sh aus der .env abgeleitet}
|
||||
read_only: true
|
||||
bind:
|
||||
create_host_path: false
|
||||
propagation: rslave
|
||||
- logs:/app/logs
|
||||
- data:/app/data
|
||||
ports: ["127.0.0.1:${MINDNET_API_PORT:-8012}:8000"]
|
||||
ports: ["${MINDNET_API_BIND:-127.0.0.1}:${MINDNET_API_PORT:-8012}:8000"]
|
||||
mem_limit: ${MINDNET_API_MEM_LIMIT:-2g}
|
||||
depends_on:
|
||||
qdrant: {condition: service_healthy}
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "/opt/mindnet/healthcheck.py", "api"]
|
||||
interval: 30s
|
||||
@@ -88,12 +72,13 @@ services:
|
||||
<<: *hardening
|
||||
command: ["ui"]
|
||||
environment:
|
||||
<<: *fixed-env
|
||||
<<: *container-env
|
||||
MINDNET_VAULT_REQUIRED: "false"
|
||||
MINDNET_API_URL: http://api:8000
|
||||
volumes:
|
||||
- data:/app/data:ro
|
||||
ports: ["${MINDNET_UI_BIND:-127.0.0.1}:${MINDNET_UI_PORT:-8512}:8501"]
|
||||
# Wie systemd (STREAMLIT_SERVER_ADDRESS=0.0.0.0): im LAN erreichbar.
|
||||
ports: ["${MINDNET_UI_BIND:-0.0.0.0}:${MINDNET_UI_PORT:-8512}:8501"]
|
||||
mem_limit: ${MINDNET_UI_MEM_LIMIT:-1g}
|
||||
depends_on:
|
||||
api: {condition: service_healthy}
|
||||
@@ -105,7 +90,6 @@ services:
|
||||
start_period: 30s
|
||||
|
||||
volumes:
|
||||
qdrant:
|
||||
logs:
|
||||
data:
|
||||
|
||||
|
||||
+26
-23
@@ -1,23 +1,25 @@
|
||||
# Mindnet PRODUKTION als Container (Vorbereitung, noch NICHT aktiv).
|
||||
# Mindnet PRODUKTION als Container (Vorlage, noch NICHT aktiv): dieselbe Anwendung
|
||||
# mit derselben Konfiguration wie die systemd-Prod-Instanz (8001/8501), parallel auf
|
||||
# 8011/8511 zum Vergleich. Umschaltung erst mit Freigabe (Gate G5).
|
||||
#
|
||||
# docker compose -f deploy/compose.prod.yml --env-file deploy/env/prod.env up -d --wait
|
||||
#
|
||||
# Grenzen dieses Stands (siehe docs/04_Operations/04_docker_deployment.md):
|
||||
# - Nutzt die bestehende produktive Qdrant-Instanz auf dem Host, startet KEINE eigene.
|
||||
# - Vault ist zwingend schreibgeschützt, bis R2 (Pfad-Traversal in /ingest/save) behoben ist.
|
||||
# - Ollama ist ein gemeinsamer Host-Dienst (Embeddings), kein Teil dieses Stacks.
|
||||
# - Ports weichen bewusst von den systemd-Diensten (8001/8501) ab, damit nichts kollidiert.
|
||||
# - Start auf llm-node erfordert eine gesonderte Freigabe.
|
||||
# Gestartet über deploy/deploy.sh prod. Zwei Dateien, beide nur auf dem Host:
|
||||
# - MINDNET_APP_ENV_FILE: die unveränderte .env der systemd-Prod-Instanz
|
||||
# - MINDNET_ENV_FILE: nur Container-Angaben (Ports, Bind-Adressen, Freigaben)
|
||||
# Fest überschrieben wird nur, was im Container anders lauten muss: die Adressen
|
||||
# der Host-Dienste (statt 127.0.0.1). Vault-Pfad und Präfix kommen aus der .env.
|
||||
# Vault nur lesend, bis R2 (Pfadsicherheit beim Speichern) behoben ist.
|
||||
|
||||
name: mindnet-prod
|
||||
|
||||
x-hardening: &hardening
|
||||
image: mindnet:${MINDNET_IMAGE_TAG:?MINDNET_IMAGE_TAG setzen (z. B. Git-SHA)}
|
||||
image: mindnet:${MINDNET_IMAGE_TAG:?MINDNET_IMAGE_TAG setzen (z. B. prod-<commit>)}
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: deploy/Dockerfile
|
||||
target: runtime
|
||||
env_file: ["${MINDNET_ENV_FILE:-env/prod.env}"]
|
||||
env_file:
|
||||
- ${MINDNET_APP_ENV_FILE:?MINDNET_APP_ENV_FILE auf die .env der systemd-Prod-Instanz setzen}
|
||||
- ${MINDNET_ENV_FILE:-env/prod.env}
|
||||
read_only: true
|
||||
tmpfs: ["/tmp:size=64m,mode=1777"]
|
||||
cap_drop: [ALL]
|
||||
@@ -31,35 +33,35 @@ x-hardening: &hardening
|
||||
options: {max-size: "10m", max-file: "3"}
|
||||
networks: [mindnet-prod]
|
||||
|
||||
# Werte, die nicht per env-Datei überschrieben werden dürfen.
|
||||
x-fixed-env: &fixed-env
|
||||
# Container-bedingte Werte; haben Vorrang vor beiden env-Dateien.
|
||||
x-container-env: &container-env
|
||||
MINDNET_ENV: prod
|
||||
QDRANT_URL: http://host.docker.internal:6333
|
||||
MINDNET_OLLAMA_URL: http://host.docker.internal:11434
|
||||
VECTOR_DIM: "768"
|
||||
MINDNET_EXPECTED_VECTOR_DIM: "768"
|
||||
MINDNET_EXPECTED_EMBEDDING_MODEL: nomic-embed-text
|
||||
MINDNET_VAULT_ROOT: /vault
|
||||
MINDNET_VAULT_READONLY: "true"
|
||||
MINDNET_VOCAB_PATH: /vault/_system/dictionary/edge_vocabulary.md
|
||||
MINDNET_SCHEMA_PATH: /vault/_system/dictionary/graph_schema.md
|
||||
|
||||
services:
|
||||
api:
|
||||
<<: *hardening
|
||||
command: ["api"]
|
||||
environment:
|
||||
<<: *fixed-env
|
||||
<<: *container-env
|
||||
volumes:
|
||||
# Derselbe Vault wie systemd-Prod, eingehängt dort, wo MINDNET_VAULT_ROOT hinzeigt.
|
||||
# Nur lesend, solange beide Instanzen parallel laufen.
|
||||
- type: bind
|
||||
source: ${MINDNET_VAULT_HOST_PATH:?MINDNET_VAULT_HOST_PATH setzen (NAS-Mount auf dem Host)}
|
||||
target: /vault
|
||||
source: ${MINDNET_VAULT_HOST_PATH:?wird von deploy/deploy.sh aus der .env abgeleitet}
|
||||
target: ${MINDNET_VAULT_TARGET:?wird von deploy/deploy.sh aus der .env abgeleitet}
|
||||
read_only: true
|
||||
bind:
|
||||
create_host_path: false
|
||||
propagation: rslave
|
||||
- logs:/app/logs
|
||||
- data:/app/data
|
||||
# API ohne Authentisierung: nur lokal am Host veröffentlichen.
|
||||
ports: ["127.0.0.1:${MINDNET_API_PORT:-8011}:8000"]
|
||||
ports: ["${MINDNET_API_BIND:-127.0.0.1}:${MINDNET_API_PORT:-8011}:8000"]
|
||||
mem_limit: ${MINDNET_API_MEM_LIMIT:-2g}
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "/opt/mindnet/healthcheck.py", "api"]
|
||||
@@ -72,12 +74,13 @@ services:
|
||||
<<: *hardening
|
||||
command: ["ui"]
|
||||
environment:
|
||||
<<: *fixed-env
|
||||
<<: *container-env
|
||||
MINDNET_VAULT_REQUIRED: "false"
|
||||
MINDNET_API_URL: http://api:8000
|
||||
volumes:
|
||||
- data:/app/data:ro
|
||||
ports: ["${MINDNET_UI_BIND:-127.0.0.1}:${MINDNET_UI_PORT:-8511}:8501"]
|
||||
# Wie systemd (STREAMLIT_SERVER_ADDRESS=0.0.0.0): im LAN erreichbar.
|
||||
ports: ["${MINDNET_UI_BIND:-0.0.0.0}:${MINDNET_UI_PORT:-8511}:8501"]
|
||||
mem_limit: ${MINDNET_UI_MEM_LIMIT:-1g}
|
||||
depends_on:
|
||||
api: {condition: service_healthy}
|
||||
|
||||
+22
-19
@@ -2,7 +2,10 @@
|
||||
# Baut, prüft und startet einen Mindnet-Container-Stack. Genutzt von den
|
||||
# Gitea-Workflows (develop -> dev, main -> prod) und für manuelle Deploys.
|
||||
#
|
||||
# MINDNET_ENV_FILE=/home/llmadmin/docker/mindnet-dev/dev.env deploy/deploy.sh dev
|
||||
# MINDNET_APP_ENV_FILE=/home/llmadmin/mindnet_dev/.env # MINDNET_ENV_FILE=/home/llmadmin/docker/mindnet-dev/container.env deploy/deploy.sh dev
|
||||
#
|
||||
# MINDNET_APP_ENV_FILE ist die unveränderte .env der systemd-Instanz (gleiche Konfiguration),
|
||||
# MINDNET_ENV_FILE enthält nur Container-Angaben (deploy/env/<env>.env.example).
|
||||
#
|
||||
# Ablauf (jeder Schritt bricht ab, bevor der laufende Stack angefasst wird):
|
||||
# 1. Container-Tests im Test-Image, ohne Netzwerk (blockierend)
|
||||
@@ -12,7 +15,7 @@
|
||||
# 5. up --wait (Healthchecks), danach smoke.py über die veröffentlichten Ports
|
||||
# 6. Prod: bei Fehler Rückkehr zum letzten erfolgreichen Tag
|
||||
#
|
||||
# Die env-Datei liegt auf dem Host außerhalb von Git; in ihrem Verzeichnis
|
||||
# Beide Dateien liegen auf dem Host außerhalb von Git; im Verzeichnis der Container-Datei
|
||||
# merkt sich das Skript den letzten erfolgreichen Image-Tag (last_good_tag).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
@@ -22,24 +25,24 @@ case "$ENV" in
|
||||
dev|prod) ;;
|
||||
*) echo "Aufruf: deploy/deploy.sh dev|prod" >&2; exit 2 ;;
|
||||
esac
|
||||
: "${MINDNET_ENV_FILE:?MINDNET_ENV_FILE auf die env-Datei des Hosts setzen}"
|
||||
[ -f "$MINDNET_ENV_FILE" ] || { echo "env-Datei fehlt: $MINDNET_ENV_FILE" >&2; exit 1; }
|
||||
export MINDNET_ENV_FILE
|
||||
: "${MINDNET_APP_ENV_FILE:?MINDNET_APP_ENV_FILE auf die .env der systemd-Instanz setzen}"
|
||||
: "${MINDNET_ENV_FILE:?MINDNET_ENV_FILE auf die Container-Datei des Hosts setzen}"
|
||||
for f in "$MINDNET_APP_ENV_FILE" "$MINDNET_ENV_FILE"; do
|
||||
[ -f "$f" ] || { echo "env-Datei fehlt: $f" >&2; exit 1; }
|
||||
done
|
||||
export MINDNET_APP_ENV_FILE MINDNET_ENV_FILE
|
||||
|
||||
# Vault-Mount und Präfix aus der systemd-.env ableiten (gleiches Verzeichnis wie heute).
|
||||
DERIVED="$(python3 deploy/appenv.py "$MINDNET_APP_ENV_FILE" "$MINDNET_ENV_FILE")"
|
||||
eval "$DERIVED"
|
||||
export MINDNET_VAULT_HOST_PATH MINDNET_VAULT_TARGET
|
||||
PREFIX="$MINDNET_EXPECTED_PREFIX"
|
||||
echo "$DERIVED"
|
||||
|
||||
SHA="$(git rev-parse --short=12 HEAD)"
|
||||
export MINDNET_IMAGE_TAG="$ENV-$SHA"
|
||||
LAST_GOOD="$(dirname "$MINDNET_ENV_FILE")/last_good_tag"
|
||||
|
||||
if [ "$ENV" = dev ]; then
|
||||
PREFIX=mindnet_dev
|
||||
RUN_DEPS=() # startet die eigene Dev-Qdrant für den Preflight mit
|
||||
SMOKE_ARGS=()
|
||||
else
|
||||
PREFIX="$(sed -n 's/^COLLECTION_PREFIX=//p' "$MINDNET_ENV_FILE" | tail -n 1)"
|
||||
RUN_DEPS=(--no-deps) # Prod hat keine eigene Qdrant
|
||||
SMOKE_ARGS=(--require-data)
|
||||
fi
|
||||
|
||||
dc() { docker compose -f "deploy/compose.$ENV.yml" --env-file "$MINDNET_ENV_FILE" "$@"; }
|
||||
step() { printf '\n=== %s\n' "$*"; }
|
||||
show_logs() { dc ps || true; dc logs --tail 150 api ui || true; }
|
||||
@@ -47,7 +50,7 @@ published() { dc port "$1" "$2" | head -n 1 | sed 's/^0\.0\.0\.0:/127.0.0.1:/';
|
||||
|
||||
smoke() {
|
||||
python3 deploy/smoke.py --api "http://$(published api 8000)" --ui "http://$(published ui 8501)" \
|
||||
--prefix "$PREFIX" "${SMOKE_ARGS[@]}"
|
||||
--prefix "$PREFIX" --require-data
|
||||
}
|
||||
|
||||
step "1/5 Container-Tests (ohne Netzwerk)"
|
||||
@@ -65,10 +68,10 @@ step "3/5 Image bauen ($MINDNET_IMAGE_TAG)"
|
||||
dc build api ui
|
||||
|
||||
step "4/5 Preflight mit Erreichbarkeit (nur lesend)"
|
||||
dc run --rm "${RUN_DEPS[@]}" api preflight --live
|
||||
dc run --rm --no-deps api preflight --live
|
||||
|
||||
step "5/5 Start ($MINDNET_IMAGE_TAG) und Smoke"
|
||||
if dc up -d --wait --no-build && smoke; then
|
||||
if dc up -d --wait --no-build --remove-orphans && smoke; then
|
||||
echo "$MINDNET_IMAGE_TAG" > "$LAST_GOOD"
|
||||
echo "=== mindnet-$ENV läuft mit $MINDNET_IMAGE_TAG"
|
||||
exit 0
|
||||
@@ -79,7 +82,7 @@ PREV="$(cat "$LAST_GOOD" 2>/dev/null || true)"
|
||||
if [ "$ENV" = prod ] && [ -n "$PREV" ] && [ "$PREV" != "$MINDNET_IMAGE_TAG" ]; then
|
||||
step "Rollback auf $PREV"
|
||||
export MINDNET_IMAGE_TAG="$PREV"
|
||||
if dc up -d --wait --no-build && smoke; then
|
||||
if dc up -d --wait --no-build --remove-orphans && smoke; then
|
||||
echo "Rollback erfolgreich; Deploy von $ENV-$SHA ist trotzdem fehlgeschlagen."
|
||||
else
|
||||
show_logs
|
||||
|
||||
Vendored
+10
-34
@@ -1,39 +1,15 @@
|
||||
# Mindnet DEV (Container) – Vorlage. Kopieren nach deploy/env/dev.env (nie committen).
|
||||
# Qdrant-URL und Collection-Präfix sind in compose.dev.yml fest auf die Dev-Instanz gesetzt.
|
||||
# Mindnet DEV (Container): NUR Container-Angaben. Liegt auf dem Host außerhalb von Git.
|
||||
# Die Anwendungskonfiguration kommt unverändert aus der .env der systemd-Instanz
|
||||
# (MINDNET_APP_ENV_FILE im Workflow). deploy/appenv.py lehnt hier andere Schlüssel ab,
|
||||
# damit diese Datei die Anwendungskonfiguration nicht überschreibt.
|
||||
|
||||
# --- Compose / Host ------------------------------------------------------------
|
||||
MINDNET_IMAGE_TAG=dev
|
||||
# Host-Pfad eines Verzeichnisses mit TESTDATEN (kein persönlicher Vault); nur lesend.
|
||||
# Muss _system/dictionary/edge_vocabulary.md enthalten (Sentinel), siehe Doku.
|
||||
MINDNET_VAULT_HOST_PATH=
|
||||
MINDNET_API_PORT=8012
|
||||
# API ohne Authentisierung; die UI erreicht sie intern. Für Zugriff von außen auf 0.0.0.0 setzen.
|
||||
MINDNET_API_BIND=127.0.0.1
|
||||
MINDNET_UI_PORT=8512
|
||||
MINDNET_UI_BIND=127.0.0.1
|
||||
MINDNET_DEV_QDRANT_PORT=6343
|
||||
MINDNET_UI_BIND=0.0.0.0
|
||||
|
||||
# --- Lokale Modelle (gemeinsamer Host-Dienst) -------------------------------------
|
||||
MINDNET_OLLAMA_URL=http://host.docker.internal:11434
|
||||
MINDNET_EMBEDDING_MODEL=nomic-embed-text
|
||||
MINDNET_LLM_MODEL=phi3:mini
|
||||
MINDNET_LLM_TIMEOUT=300.0
|
||||
MINDNET_LLM_BACKGROUND_LIMIT=2
|
||||
|
||||
# --- Cloud-LLM -------------------------------------------------------------------
|
||||
# Nur mit synthetischen Testdaten zulässig. Dann Keys setzen und
|
||||
# MINDNET_ALLOW_CLOUD_EGRESS=true. Nie mit echten Vault-Inhalten.
|
||||
MINDNET_LLM_PROVIDER=openrouter
|
||||
OPENROUTER_API_KEY=
|
||||
GOOGLE_API_KEY=
|
||||
# Enthält die systemd-.env Cloud-Keys (OpenRouter/Gemini), startet der Container nur mit
|
||||
# ausdrücklicher Bestätigung. true = gleiches Verhalten wie heute: Vault-Inhalte gehen
|
||||
# ohne Privacy Gateway an den Cloud-Provider.
|
||||
MINDNET_ALLOW_CLOUD_EGRESS=false
|
||||
MINDNET_LLM_FALLBACK=true
|
||||
MINDNET_LLM_RATE_LIMIT_WAIT=60.0
|
||||
MINDNET_LLM_RATE_LIMIT_RETRIES=3
|
||||
|
||||
# --- Verarbeitung ----------------------------------------------------------------
|
||||
MINDNET_TYPES_FILE=./config/types.yaml
|
||||
MINDNET_CHANGE_DETECTION_MODE=full
|
||||
MINDNET_LLM_VALIDATION_HEADERS=Unzugeordnete Kanten,Edge Pool,Candidates
|
||||
MINDNET_LLM_VALIDATION_HEADER_LEVEL=3
|
||||
MINDNET_NOTE_SCOPE_ZONE_HEADERS=Smart Edges,Relationen,Global Links,Note-Level Relations,Globale Verbindungen
|
||||
MINDNET_NOTE_SCOPE_HEADER_LEVEL=2
|
||||
DEBUG=true
|
||||
Vendored
+10
-42
@@ -1,47 +1,15 @@
|
||||
# Mindnet PROD (Container) – Vorlage. Kopieren nach deploy/env/prod.env (nie committen).
|
||||
# Dient zugleich als --env-file für Compose (Interpolation) und als env_file des Containers.
|
||||
# Fest verdrahtete Sicherheitswerte (MINDNET_ENV, VECTOR_DIM, Vault-Pfade, Read-only)
|
||||
# stehen in compose.prod.yml und lassen sich hier NICHT überschreiben.
|
||||
# Mindnet PROD (Container): NUR Container-Angaben. Liegt auf dem Host außerhalb von Git.
|
||||
# Die Anwendungskonfiguration kommt unverändert aus der .env der systemd-Instanz
|
||||
# (MINDNET_APP_ENV_FILE im Workflow). deploy/appenv.py lehnt hier andere Schlüssel ab,
|
||||
# damit diese Datei die Anwendungskonfiguration nicht überschreibt.
|
||||
|
||||
# --- Compose / Host ------------------------------------------------------------
|
||||
MINDNET_IMAGE_TAG=
|
||||
# Host-Pfad des NAS-Vaults (muss vor dem Start gemountet sein; wird nur lesend eingebunden)
|
||||
MINDNET_VAULT_HOST_PATH=
|
||||
MINDNET_API_PORT=8011
|
||||
# API ohne Authentisierung; die UI erreicht sie intern. Für Zugriff von außen auf 0.0.0.0 setzen.
|
||||
MINDNET_API_BIND=127.0.0.1
|
||||
MINDNET_UI_PORT=8511
|
||||
# UI nur lokal veröffentlichen; für LAN-Zugriff explizit die LAN-IP des Hosts setzen
|
||||
MINDNET_UI_BIND=127.0.0.1
|
||||
MINDNET_UI_BIND=0.0.0.0
|
||||
|
||||
# --- Daten ---------------------------------------------------------------------
|
||||
# Bestehende produktive Qdrant-Instanz auf dem Host (wird nicht verändert)
|
||||
QDRANT_URL=http://host.docker.internal:6333
|
||||
QDRANT_API_KEY=
|
||||
COLLECTION_PREFIX=mindnet
|
||||
|
||||
# --- Lokale Modelle (gemeinsamer Host-Dienst) -------------------------------------
|
||||
MINDNET_OLLAMA_URL=http://host.docker.internal:11434
|
||||
MINDNET_EMBEDDING_MODEL=nomic-embed-text
|
||||
MINDNET_LLM_MODEL=phi3:mini
|
||||
MINDNET_LLM_TIMEOUT=300.0
|
||||
MINDNET_LLM_BACKGROUND_LIMIT=2
|
||||
|
||||
# --- Cloud-LLM -------------------------------------------------------------------
|
||||
# Ohne Privacy Gateway gehen Vault-Inhalte unmaskiert an den Provider.
|
||||
# Daher in PROD leer lassen. Sind Keys gesetzt, startet der Container nur mit
|
||||
# MINDNET_ALLOW_CLOUD_EGRESS=true – das ist in PROD derzeit NICHT freigegeben.
|
||||
MINDNET_LLM_PROVIDER=openrouter
|
||||
OPENROUTER_API_KEY=
|
||||
GOOGLE_API_KEY=
|
||||
# Enthält die systemd-.env Cloud-Keys (OpenRouter/Gemini), startet der Container nur mit
|
||||
# ausdrücklicher Bestätigung. true = gleiches Verhalten wie heute: Vault-Inhalte gehen
|
||||
# ohne Privacy Gateway an den Cloud-Provider.
|
||||
MINDNET_ALLOW_CLOUD_EGRESS=false
|
||||
MINDNET_LLM_FALLBACK=true
|
||||
MINDNET_LLM_RATE_LIMIT_WAIT=60.0
|
||||
MINDNET_LLM_RATE_LIMIT_RETRIES=3
|
||||
|
||||
# --- Verarbeitung (aus config/prod.env übernommen) ---------------------------------
|
||||
MINDNET_TYPES_FILE=./config/types.yaml
|
||||
MINDNET_CHANGE_DETECTION_MODE=full
|
||||
MINDNET_LLM_VALIDATION_HEADERS=Unzugeordnete Kanten,Edge Pool,Candidates
|
||||
MINDNET_LLM_VALIDATION_HEADER_LEVEL=3
|
||||
MINDNET_NOTE_SCOPE_ZONE_HEADERS=Smart Edges,Relationen,Global Links,Note-Level Relations,Globale Verbindungen
|
||||
MINDNET_NOTE_SCOPE_HEADER_LEVEL=2
|
||||
DEBUG=false
|
||||
@@ -22,9 +22,14 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
# Runner auf dem Zielhost (heute llm-node). Bei einem Umzug auf einen anderen
|
||||
# Mini-PC nur das Label und die beiden Pfade anpassen.
|
||||
runs-on: linux_host
|
||||
env:
|
||||
MINDNET_ENV_FILE: /home/llmadmin/docker/mindnet/prod.env
|
||||
# Unveränderte Konfiguration der systemd-Prod-Instanz.
|
||||
MINDNET_APP_ENV_FILE: /home/llmadmin/mindnet/.env
|
||||
# Nur Container-Angaben (Vorlage: deploy/env/prod.env.example).
|
||||
MINDNET_ENV_FILE: /home/llmadmin/docker/mindnet/container.env
|
||||
steps:
|
||||
# Ohne actions/checkout: kein Abruf von github.com (DNS/Internet auf dem Host
|
||||
# nicht nötig). Holt genau den Commit des Pushes vom eigenen Gitea, mit Job-Token.
|
||||
@@ -32,10 +37,22 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git init -q .
|
||||
git -c http.extraHeader="Authorization: token ${{ github.token }}" fetch -q --depth 1 "${{ github.server_url }}/${{ github.repository }}.git" "${{ github.sha }}"
|
||||
git -c http.extraHeader="Authorization: token ${{ github.token }}" \
|
||||
fetch -q --depth 1 "${{ github.server_url }}/${{ github.repository }}.git" "${{ github.sha }}"
|
||||
git checkout -q --force FETCH_HEAD
|
||||
git clean -q -ffdx
|
||||
git log -1 --format='Checkout %H %s'
|
||||
|
||||
- name: Container-Datei beim ersten Lauf anlegen
|
||||
run: |
|
||||
set -euo pipefail
|
||||
install -d -m 0750 "$(dirname "$MINDNET_ENV_FILE")"
|
||||
if [ ! -f "$MINDNET_ENV_FILE" ]; then
|
||||
install -m 0600 deploy/env/prod.env.example "$MINDNET_ENV_FILE"
|
||||
echo "Container-Datei aus Vorlage angelegt: $MINDNET_ENV_FILE"
|
||||
fi
|
||||
docker version --format 'Docker {{.Server.Version}}'
|
||||
docker compose version
|
||||
|
||||
- name: Test, Build, Preflight, Start, Smoke (Rollback bei Fehler)
|
||||
run: bash deploy/deploy.sh prod
|
||||
@@ -1,23 +0,0 @@
|
||||
---
|
||||
title: "Experience One"
|
||||
id: "exp-one"
|
||||
type: "experience"
|
||||
status: "active"
|
||||
created: "2026-10-28T16:35:23+01:00"
|
||||
updated: "2026-10-28T16:35:23+01:00"
|
||||
tags: ["area/mindnet","type/experience","topic/test"]
|
||||
---
|
||||
|
||||
## Kontext
|
||||
Diese Notiz verlinkt auf ein existierendes Konzept und auf eine noch **fehlende** Note.
|
||||
|
||||
## Beobachtung
|
||||
- Bezug zu [[concept-alpha]]
|
||||
- Offener Verweis auf [[missing-note]]
|
||||
|
||||
## Interpretation
|
||||
Wenn später eine Datei für 'missing-note' angelegt wird, sollte der Importer die Kanten nachziehen.
|
||||
|
||||
## Mögliche Verbindungen
|
||||
- [[concept-alpha]]
|
||||
- [[missing-note]]
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
title: "Experience Two"
|
||||
id: "exp-two"
|
||||
type: "experience"
|
||||
status: "active"
|
||||
created: "2026-10-28T16:35:23+01:00"
|
||||
updated: "2026-10-28T16:35:23+01:00"
|
||||
tags: ["area/mindnet","type/experience","topic/test"]
|
||||
---
|
||||
|
||||
## Kontext
|
||||
Zweite Experience, die auf dasselbe Konzept verweist, ergänzt um **externe Links**.
|
||||
|
||||
## Beobachtung
|
||||
Verweis auf [[concept-alpha]]. Zusätzliche Ressourcen:
|
||||
- Link: [Beispielseite](https://example.com "Referenz")
|
||||
- Kontakt: [E-Mail](mailto:info@example.com)
|
||||
|
||||
## Mögliche Verbindungen
|
||||
- [[concept-alpha]]
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
title: "Project Demo"
|
||||
id: "project-demo"
|
||||
type: "project"
|
||||
status: "active"
|
||||
created: "2026-10-28T16:35:23+01:00"
|
||||
updated: "2026-10-28T16:35:23+01:00"
|
||||
tags: ["area/mindnet","type/project","topic/test"]
|
||||
---
|
||||
|
||||
## Scope
|
||||
Ein kleines Demo-Projekt, das andere Notizen referenziert.
|
||||
|
||||
## Arbeitspakete
|
||||
- AP-1: Zusammenhang erklären (siehe [[concept-alpha]])
|
||||
- AP-2: Ereignis berücksichtigen (siehe [[exp-one]])
|
||||
|
||||
## Mögliche Verbindungen
|
||||
- [[concept-alpha]]
|
||||
- [[exp-one]]
|
||||
@@ -1,16 +0,0 @@
|
||||
---
|
||||
title: "Concept Alpha"
|
||||
id: "concept-alpha"
|
||||
type: "concept"
|
||||
status: "active"
|
||||
created: "2026-10-28T16:35:23+01:00"
|
||||
updated: "2026-10-28T16:35:23+01:00"
|
||||
tags: ["area/mindnet","type/concept","topic/test"]
|
||||
---
|
||||
|
||||
## Beschreibung
|
||||
Dies ist ein einfaches Konzept für Testzwecke. Es wird von anderen Notizen referenziert.
|
||||
|
||||
## Mögliche Verbindungen
|
||||
- [[exp-one]]
|
||||
- [[project-demo]]
|
||||
@@ -1,15 +0,0 @@
|
||||
---
|
||||
title: "Missing Note (jetzt angelegt)"
|
||||
id: "missing-note"
|
||||
type: "concept"
|
||||
status: "active"
|
||||
created: "2026-10-28T16:35:23+01:00"
|
||||
updated: "2026-10-28T16:35:23+01:00"
|
||||
tags: ["area/mindnet","type/concept","topic/test"]
|
||||
---
|
||||
|
||||
## Kontext
|
||||
Diese Notiz wurde **nachträglich** erstellt, um einen zuvor offenen Link zu schließen.
|
||||
|
||||
## Mögliche Verbindungen
|
||||
- [[exp-one]]
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
id: edge_vocabulary
|
||||
title: Edge Vocabulary (Test-Vault)
|
||||
type: reference
|
||||
status: system
|
||||
system_role: config
|
||||
---
|
||||
|
||||
# Edge Vocabulary (synthetisch, nur für den Dev-Container)
|
||||
|
||||
Dient zugleich als Sentinel des Container-Preflights.
|
||||
|
||||
| System-Typ | Inverse | Aliasse | Beschreibung |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| **`caused_by`** | `causes` | ausgelöst_durch, wegen | Kausalität |
|
||||
| **`derived_from`** | `source_of` | abgeleitet_von, quelle | Herkunft |
|
||||
| **`based_on`** | `foundation_for` | basiert_auf, grundlage | Fundament |
|
||||
| **`solves`** | `solved_by` | löst, beantwortet | Lösung |
|
||||
| **`part_of`** | `has_part` | teil_von, gehört_zu | Hierarchie |
|
||||
| **`depends_on`** | `required_by` | hängt_ab_von, braucht, enforced_by | Abhängigkeit |
|
||||
| **`blocks`** | `blocked_by` | blockiert, verhindert | Blocker |
|
||||
| **`uses`** | `used_by` | nutzt, verwendet | Werkzeug |
|
||||
| **`guides`** | `guided_by` | steuert, leitet | Richtung |
|
||||
| **`next`** | `prev` | danach, folgt | Prozess |
|
||||
| **`prev`** | `next` | davor, vorgänger | Prozess |
|
||||
| **`related_to`** | `related_to` | siehe_auch, kontext | Lose Assoziation |
|
||||
| **`similar_to`** | `similar_to` | ähnlich_wie | Ähnlichkeit |
|
||||
| **`references`** | `referenced_by` | Kein Alias | Standard-Verweis |
|
||||
@@ -1,30 +0,0 @@
|
||||
---
|
||||
id: graph_schema
|
||||
title: Graph Schema (Test-Vault)
|
||||
type: reference
|
||||
status: system
|
||||
system_role: config
|
||||
---
|
||||
|
||||
# Graph Schema (synthetisch, nur für den Dev-Container)
|
||||
|
||||
## Source: `experience`
|
||||
|
||||
| Target | Typical | Prohibited |
|
||||
|---|---|---|
|
||||
| `concept` | based_on, related_to | - |
|
||||
| `project` | part_of, related_to | - |
|
||||
|
||||
## Source: `project`
|
||||
|
||||
| Target | Typical | Prohibited |
|
||||
|---|---|---|
|
||||
| `concept` | uses, based_on | - |
|
||||
| `experience` | derived_from, related_to | - |
|
||||
|
||||
## Source: `concept`
|
||||
|
||||
| Target | Typical | Prohibited |
|
||||
|---|---|---|
|
||||
| `concept` | related_to, similar_to | - |
|
||||
| `experience` | related_to | - |
|
||||
Reference in new issue
Block a user