1a88ab3199
The v0.8 milestone: installable on any Debian-based server via docker (Gitea registry image, honest sandbox degrade), deb (amd64+arm64, advisory postinst), and arch-aware binary — with release consistency enforced by pre-commit hooks + Gitea Actions (3-runner fleet on CT 113, machine-made releases with the full 8-asset matrix + registry image), the CLI carrying the full suite (guide, channel-aware doctor), and the admin runbook (deploy/README.md, evidence-backed recipes). ---ci--- phase: 6 milestone: v0.8 status: complete requirements: covered: [REQ-8-001, REQ-8-002, REQ-8-003, REQ-8-004, REQ-8-005] partial: [] ---/ci---
41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Dev server: export secrets (if present) then run uvicorn.
|
|
# Binds 0.0.0.0 by default so the stack is reachable from other machines
|
|
# (v0.3.5 network mode) — set AI_HOST=127.0.0.1 in .env to revert to loopback.
|
|
set -euo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
APP_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
REPO_ROOT="$(cd "$APP_DIR/../.." && pwd)"
|
|
VENV="$APP_DIR/.venv"
|
|
|
|
if [ ! -x "$VENV/bin/uvicorn" ]; then
|
|
echo "venv missing — run nextcraft bootstrap first (or: bash scripts/bootstrap.sh)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
SECRETS="$REPO_ROOT/.ciagent/.env.secrets"
|
|
if [ -f "$SECRETS" ]; then
|
|
while IFS='=' read -r key value; do
|
|
case "$key" in
|
|
OLLAMA_API_KEY) export AI_OLLAMA_CLOUD_API_KEY="$value" ;;
|
|
OLLAMA_BASE_URL) export AI_OLLAMA_CLOUD_BASE_URL="$value" ;;
|
|
AI_TUTOR_MODEL) export AI_MODEL="$value" ;;
|
|
esac
|
|
done < "$SECRETS"
|
|
fi
|
|
|
|
ENV_FILE="$APP_DIR/.env"
|
|
if [ -f "$ENV_FILE" ]; then
|
|
while IFS='=' read -r key value; do
|
|
case "$key" in
|
|
AI_HOST|AI_PORT|AI_CORS_ORIGINS) export "$key=$value" ;;
|
|
esac
|
|
done < "$ENV_FILE"
|
|
fi
|
|
|
|
HOST="${AI_HOST:-0.0.0.0}"
|
|
PORT="${AI_PORT:-8420}"
|
|
|
|
cd "$APP_DIR"
|
|
exec "$VENV/bin/uvicorn" ai_service.main:app --reload --host "$HOST" --port "$PORT"
|