40 lines
1.6 KiB
Bash
40 lines
1.6 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
echo "=== Mind-o-Mat Container starting ==="
|
|
|
|
VAULT_DIR="${MINDOMAT_VAULT_PATH:-/vault}"
|
|
mkdir -p "$VAULT_DIR"
|
|
|
|
# Git safe.directory konfigurieren und Stand aktualisieren
|
|
if command -v git >/dev/null 2>&1; then
|
|
git config --global --add safe.directory "$VAULT_DIR" 2>/dev/null || true
|
|
if [ -d "$VAULT_DIR/.git" ]; then
|
|
if [ -n "$VAULT_SYNC_TOKEN" ]; then
|
|
git -C "$VAULT_DIR" remote set-url origin "https://${VAULT_SYNC_TOKEN}@git.orfel.de/Jannik/Mind-o-Mat-Vault.git" 2>/dev/null || true
|
|
fi
|
|
git -C "$VAULT_DIR" config user.name "Mind-o-Mat Server" 2>/dev/null || true
|
|
git -C "$VAULT_DIR" config user.email "mindomat@orfel.de" 2>/dev/null || true
|
|
echo "[Git] Pulling latest changes from remote..."
|
|
(cd "$VAULT_DIR" && git pull --ff-only 2>/dev/null) || echo "[Git] Git pull skipped or offline"
|
|
fi
|
|
fi
|
|
|
|
# Vault initial indizieren (erzeugt landkarte.json)
|
|
if [ -f "/app/bin/mindomat.mjs" ]; then
|
|
echo "[Indexer] Running initial index on $VAULT_DIR..."
|
|
node /app/bin/mindomat.mjs index --vault "$VAULT_DIR" 2>/dev/null || echo "[Indexer] Initial indexing non-fatal warning"
|
|
fi
|
|
|
|
# 1. QMD MCP-Dienst im Hintergrund starten (Port 8181)
|
|
if command -v qmd >/dev/null 2>&1; then
|
|
echo "[1/2] Starting QMD MCP daemon on port 8181..."
|
|
qmd mcp --http --daemon --host 0.0.0.0 --port 8181 &
|
|
else
|
|
echo "[1/2] Warning: qmd command not found, skipping QMD startup"
|
|
fi
|
|
|
|
# 2. Webapp / Notes-API Server starten (Port 5173)
|
|
echo "[2/2] Starting Mind-o-Mat Webapp & API server on port ${PORT:-5173}..."
|
|
exec node server.mjs
|