mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
71 lines
3.0 KiB
Bash
Executable File
71 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Run the warm-flags-cache Rust CLI against the local dev environment.
|
|
#
|
|
# Targets the dockerized services started by ./bin/start:
|
|
# - Postgres on localhost:5432 (insights/insights)
|
|
# - Redis on localhost:6379 (db 1 for flags, matching feature-flags service)
|
|
# - MinIO on localhost:19000 (bucket "insights")
|
|
#
|
|
# Prerequisites:
|
|
# - ./bin/start running (or at least db, redis7, objectstorage containers up)
|
|
#
|
|
# Usage:
|
|
# bin/warm-flags-cache --team-ids 1 --no-stagger
|
|
# bin/warm-flags-cache # warm all teams with flags
|
|
# bin/warm-flags-cache --help
|
|
#
|
|
# Pass --release to build in release mode (first run is slow, subsequent fast).
|
|
# Everything else is forwarded to the binary.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
CARGO_PROFILE=()
|
|
BIN_ARGS=()
|
|
for arg in "$@"; do
|
|
if [ "$arg" = "--release" ]; then
|
|
CARGO_PROFILE=(--release)
|
|
else
|
|
BIN_ARGS+=("$arg")
|
|
fi
|
|
done
|
|
|
|
# Local dev defaults — mirror bin/start-rust-service feature-flags, plus the
|
|
# MinIO endpoint/creds that the object storage client needs.
|
|
export READ_DATABASE_URL="${READ_DATABASE_URL:-postgres://insights:insights@localhost:5432/insights}"
|
|
export REDIS_URL="${REDIS_URL:-redis://localhost:6379/}"
|
|
export FLAGS_REDIS_URL="${FLAGS_REDIS_URL:-redis://localhost:6379/1}"
|
|
export OBJECT_STORAGE_BUCKET="${OBJECT_STORAGE_BUCKET:-insights}"
|
|
export OBJECT_STORAGE_REGION="${OBJECT_STORAGE_REGION:-us-east-1}"
|
|
export OBJECT_STORAGE_ENDPOINT="${OBJECT_STORAGE_ENDPOINT:-http://localhost:19000}"
|
|
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-object_storage_root_user}"
|
|
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-object_storage_root_password}"
|
|
# .envrc sets RUST_LOG to suppress flox noise (e.g. "flox=error,..."). Once RUST_LOG
|
|
# has any value, EnvFilter's default directive no longer applies — so the binary's
|
|
# logs would be silenced. Append our directive so warm_flags_cache=info always
|
|
# wins, while preserving any flox suppression the user wants.
|
|
if [ -z "${RUST_LOG:-}" ]; then
|
|
export RUST_LOG="info"
|
|
elif [[ "$RUST_LOG" != *"warm_flags_cache="* ]]; then
|
|
export RUST_LOG="${RUST_LOG},warm_flags_cache=info"
|
|
fi
|
|
export RUST_BACKTRACE="${RUST_BACKTRACE:-1}"
|
|
|
|
# Strip user:password@ from URLs before printing — the local defaults are safe
|
|
# but operators sometimes override these with real DSNs, and terminal scrollback
|
|
# / session recordings shouldn't capture credentials.
|
|
redact_dsn() {
|
|
# scheme://user:pass@host… → scheme://***@host…
|
|
printf '%s\n' "$1" | sed -E 's#(://)[^@/]*@#\1***@#'
|
|
}
|
|
|
|
echo ">> READ_DATABASE_URL=$(redact_dsn "$READ_DATABASE_URL")"
|
|
echo ">> FLAGS_REDIS_URL=$(redact_dsn "$FLAGS_REDIS_URL")"
|
|
echo ">> OBJECT_STORAGE_ENDPOINT=$(redact_dsn "$OBJECT_STORAGE_ENDPOINT") (bucket=$OBJECT_STORAGE_BUCKET)"
|
|
|
|
cd "$REPO_ROOT/rust"
|
|
exec cargo run "${CARGO_PROFILE[@]}" -p feature-flags --features warm-flags-cache --bin warm-flags-cache -- "${BIN_ARGS[@]}"
|