50 lines
1.7 KiB
Bash
Executable File
50 lines
1.7 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
MODE=${1:-}
|
|
CONFIRM=${2:-}
|
|
ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
PROJECT=mike-ai-tools
|
|
BASE=(docker compose -p "$PROJECT" --profile github -f "$ROOT_DIR/compose.yaml")
|
|
MAINTENANCE=(-f "$ROOT_DIR/compose.github-maintenance.yaml")
|
|
|
|
die() { printf 'FEHLER: %s\n' "$*" >&2; exit 1; }
|
|
[[ $EUID -eq 0 ]] || die "Bitte als root ausführen."
|
|
|
|
case "$MODE" in
|
|
read)
|
|
"${BASE[@]}" up -d --no-deps --force-recreate mcp-github
|
|
;;
|
|
maintenance)
|
|
[[ $CONFIRM == --confirm ]] || die \
|
|
"Wartungsmodus nur mit: $0 maintenance --confirm"
|
|
"${BASE[@]}" "${MAINTENANCE[@]}" up -d --no-deps --force-recreate mcp-github
|
|
;;
|
|
status)
|
|
command_line=$(docker inspect -f '{{json .Config.Cmd}}' mike-ai-mcp-github 2>/dev/null || true)
|
|
if [[ $command_line == *create_branch* ]]; then
|
|
printf 'GitHub MCP: WARTUNGSMODUS (begrenzter Schreibzugriff)\n'
|
|
elif [[ $command_line == *--read-only* ]]; then
|
|
printf 'GitHub MCP: NUR LESEN\n'
|
|
else
|
|
die "GitHub-MCP-Modus ist nicht eindeutig; Konfiguration prüfen."
|
|
fi
|
|
exit 0
|
|
;;
|
|
*)
|
|
die "Aufruf: $0 {status|read|maintenance --confirm}"
|
|
;;
|
|
esac
|
|
|
|
# Open WebUI caches MCP capabilities. A short backend restart makes the new
|
|
# allowlist deterministic for all profiles without touching model services.
|
|
docker restart mike-ai-open-webui >/dev/null
|
|
for _ in $(seq 1 30); do
|
|
[[ $(docker inspect -f '{{.State.Health.Status}}' mike-ai-mcp-github 2>/dev/null || true) == healthy ]] && break
|
|
sleep 1
|
|
done
|
|
[[ $(docker inspect -f '{{.State.Health.Status}}' mike-ai-mcp-github 2>/dev/null || true) == healthy ]] || \
|
|
die "GitHub MCP wurde nicht gesund. Zurücksetzen mit: $0 read"
|
|
|
|
"$0" status
|