mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
Mechanically re-derived: bin/debrand runs over a fresh import of posthog/posthog@fa1a9a60d4 (2026-08-06). The pipeline (.hanzo/workflows), the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md and the squashed initial migration are restored from the shipped tree, same as the previous import. The prune's import-closure guard kept 21 products the new core now imports; dropping them is a refactor now, recorded rather than forced.
43 lines
1.9 KiB
Bash
Executable File
43 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Computed vars (need a fresh tempdir per invocation) — must stay in script
|
|
export PROMETHEUS_MULTIPROC_DIR=$(mktemp -d)
|
|
trap 'rm -rf "$PROMETHEUS_MULTIPROC_DIR"' EXIT
|
|
|
|
|
|
# Cross-platform Docker host access
|
|
# On macOS/Windows: Docker runs in a VM, use 127.0.0.1 for the host bind
|
|
# On Linux: Use bridge gateway IP for container access while maintaining security
|
|
if [[ -n "$HOST_BIND" ]]; then
|
|
echo "Using pre-configured HOST_BIND: $HOST_BIND"
|
|
elif [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "msys" ]]; then
|
|
HOST_BIND="127.0.0.1"
|
|
echo "🍎 macOS/Windows detected, using secure localhost binding"
|
|
else
|
|
# Linux - containers cannot reach host's 127.0.0.1, use bridge gateway
|
|
DOCKER_GATEWAY_IP=$(docker network inspect bridge --format='{{range .IPAM.Config}}{{.Gateway}}{{end}}' 2>/dev/null || echo "172.17.0.1")
|
|
HOST_BIND="$DOCKER_GATEWAY_IP"
|
|
echo "🐧 Linux detected, binding to Docker bridge gateway: $HOST_BIND"
|
|
fi
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
|
|
# --workers-kill-timeout bounds the reload. Granian defaults it to disabled, which means it joins
|
|
# the old worker with no timeout and only escalates to a hard kill when the flag is set. An open SSE
|
|
# stream (an agent run log held by a browser tab) never finishes on its own, so without this the
|
|
# worker never exits, the replacement is never spawned, and port 8000 stays dead until it is killed
|
|
# by hand. A worker with nothing in flight still exits immediately, so normal reloads are unaffected.
|
|
python ${DEBUG:+ -m debugpy --listen 127.0.0.1:5678} -m granian \
|
|
--interface asgi \
|
|
insights.asgi:application \
|
|
--reload \
|
|
--reload-paths ./insights \
|
|
--reload-paths ./ee \
|
|
--reload-paths ./products \
|
|
--reload-paths ./frontend/src/products.json \
|
|
--host $HOST_BIND \
|
|
--log-level debug \
|
|
--workers 1 \
|
|
--workers-kill-timeout 5
|