chore: add GRACE semantic contracts across agent + backend + build scripts
- Add @RELATION/@RATIONALE/@REJECTED headers to agent modules - Add GRACE contracts to backend services, models, schemas - Update build.sh with single-image build commands (build:backend|frontend|agent) - Update docker entrypoint: openssl rsa → openssl pkey (alg-agnostic) - Add @RATIONALE to backend core modules (cot_logger, config_manager, ssl)
This commit is contained in:
496
build.sh
496
build.sh
@@ -1,19 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# #region build [C:2] [TYPE Module]
|
||||
# @PURPOSE: Unified build script — local docker compose + release bundles (backend + frontend + agent) + lightweight bundle
|
||||
# @PURPOSE: Unified build script — local docker compose + individual image builds + release bundles
|
||||
# @COMPLEXITY: 2
|
||||
#
|
||||
# Usage: ./build.sh <command> [options]
|
||||
#
|
||||
# Commands:
|
||||
# Commands (local docker):
|
||||
# up [profile] Build and start local docker compose (default: current)
|
||||
# down [profile] Stop services
|
||||
# restart [profile] Rebuild and restart services
|
||||
# logs [profile] Tail logs
|
||||
# status Show running containers for all profiles
|
||||
#
|
||||
# Commands (individual image build — no export):
|
||||
# build:backend <tag> Build backend image only (superset-tools-backend:<tag>)
|
||||
# build:frontend <tag> Build frontend image only (superset-tools-frontend:<tag>)
|
||||
# build:agent <tag> Build agent image only (superset-tools-agent:<tag>)
|
||||
#
|
||||
# Commands (single-image bundle — build + .tar.xz export):
|
||||
# bundle:backend <tag> Build + export backend .tar.xz only
|
||||
# bundle:frontend <tag> Build + export frontend .tar.xz only
|
||||
# bundle:agent <tag> Build + export agent .tar.xz only
|
||||
#
|
||||
# Commands (full bundles — all three images):
|
||||
# bundle <tag> Slim enterprise bundle (no embeddings agent). Default.
|
||||
# bundle:embeddings <tag> Enterprise bundle WITH semantic embedding routing (larger agent)
|
||||
# bundle:light <tag> Lightweight all-in-one bundle (<200 MB, .tar.xz, no Playwright)
|
||||
#
|
||||
# help Show this help
|
||||
#
|
||||
# Profiles: current (default), master, enterprise-clean
|
||||
@@ -141,6 +154,67 @@ get_repo_digest() {
|
||||
fi
|
||||
}
|
||||
|
||||
resolve_app_version() {
|
||||
local tag="$1"
|
||||
local git_commit
|
||||
git_commit="$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')"
|
||||
echo "${tag}+${git_commit}"
|
||||
}
|
||||
|
||||
# ======================================================================
|
||||
# SINGLE-IMAGE BUILD FUNCTIONS
|
||||
# ======================================================================
|
||||
|
||||
build_backend() {
|
||||
local tag="$1"
|
||||
local image="superset-tools-backend:${tag}"
|
||||
echo "[build] Building backend image ${image}..."
|
||||
docker build -f docker/backend.Dockerfile -t "${image}" .
|
||||
echo "[build] ✅ Backend image ${image} built"
|
||||
}
|
||||
|
||||
build_frontend() {
|
||||
local tag="$1"
|
||||
local image="superset-tools-frontend:${tag}"
|
||||
local app_version
|
||||
app_version="$(resolve_app_version "${tag}")"
|
||||
echo "[build] Building frontend image ${image} (APP_VERSION=${app_version})..."
|
||||
docker build --build-arg "APP_VERSION=${app_version}" -f docker/frontend.Dockerfile -t "${image}" .
|
||||
echo "[build] ✅ Frontend image ${image} built"
|
||||
}
|
||||
|
||||
build_agent() {
|
||||
local tag="$1"
|
||||
local image="superset-tools-agent:${tag}"
|
||||
echo "[build] Building agent image ${image}..."
|
||||
docker build -f docker/Dockerfile.agent -t "${image}" .
|
||||
echo "[build] ✅ Agent image ${image} built"
|
||||
}
|
||||
|
||||
build_agent_embeddings() {
|
||||
local tag="$1"
|
||||
local image="superset-tools-agent:${tag}"
|
||||
echo "[build] Building agent image ${image} (WITH_EMBEDDINGS=true)..."
|
||||
docker build \
|
||||
--build-arg WITH_EMBEDDINGS=true \
|
||||
-f docker/Dockerfile.agent \
|
||||
-t "${image}" .
|
||||
echo "[build] ✅ Agent image ${image} built (embeddings)"
|
||||
}
|
||||
|
||||
# ======================================================================
|
||||
# SINGLE-IMAGE EXPORT
|
||||
# ======================================================================
|
||||
|
||||
export_image() {
|
||||
local image="$1"
|
||||
local archive="$2"
|
||||
echo "[bundle] Compressing ${image} -> ${archive}..."
|
||||
mkdir -p "$(dirname "${archive}")"
|
||||
docker save "${image}" | xz -T0 -3 > "${archive}"
|
||||
echo "[bundle] ✅ ${archive} saved"
|
||||
}
|
||||
|
||||
# ======================================================================
|
||||
# COMPOSE COMMANDS
|
||||
# ======================================================================
|
||||
@@ -206,58 +280,64 @@ compose_status() {
|
||||
# BUNDLE: full release (backend + frontend + agent .tar.xz's)
|
||||
# ======================================================================
|
||||
|
||||
bundle_release() {
|
||||
# ======================================================================
|
||||
# SINGLE-IMAGE BUNDLE FUNCTIONS
|
||||
# ======================================================================
|
||||
|
||||
bundle_single_backend() {
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Error: tag is required."
|
||||
echo "Usage: ./build.sh bundle <tag> (e.g. v1.0.0)"
|
||||
echo "Usage: ./build.sh bundle:backend <tag>"
|
||||
exit 1
|
||||
fi
|
||||
local tag="$1"
|
||||
local backend_tag="superset-tools-backend:${tag}"
|
||||
local frontend_tag="superset-tools-frontend:${tag}"
|
||||
local agent_tag="superset-tools-agent:${tag}"
|
||||
|
||||
# Git commit hash for APP_VERSION (e.g. "0.5.2+58d06fb2")
|
||||
local git_commit
|
||||
git_commit="$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')"
|
||||
local app_version="${tag}+${git_commit}"
|
||||
|
||||
local image="superset-tools-backend:${tag}"
|
||||
mkdir -p "$DIST_ROOT"
|
||||
build_backend "${tag}"
|
||||
export_image "${image}" "${DIST_ROOT}/superset-tools-backend.${tag}.tar.xz"
|
||||
(cd "${DIST_ROOT}" && sha256sum "superset-tools-backend.${tag}.tar.xz" > "sha256sums-backend.${tag}.txt")
|
||||
echo "[bundle:backend] ✅ Backend bundle ${tag} created"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-backend.${tag}.tar.xz | docker load"
|
||||
}
|
||||
|
||||
echo "[bundle] Building backend image ${backend_tag}..."
|
||||
docker build -f docker/backend.Dockerfile -t "${backend_tag}" .
|
||||
bundle_single_frontend() {
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Error: tag is required."
|
||||
echo "Usage: ./build.sh bundle:frontend <tag>"
|
||||
exit 1
|
||||
fi
|
||||
local tag="$1"
|
||||
local image="superset-tools-frontend:${tag}"
|
||||
mkdir -p "$DIST_ROOT"
|
||||
build_frontend "${tag}"
|
||||
export_image "${image}" "${DIST_ROOT}/superset-tools-frontend.${tag}.tar.xz"
|
||||
(cd "${DIST_ROOT}" && sha256sum "superset-tools-frontend.${tag}.tar.xz" > "sha256sums-frontend.${tag}.txt")
|
||||
echo "[bundle:frontend] ✅ Frontend bundle ${tag} created"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-frontend.${tag}.tar.xz | docker load"
|
||||
}
|
||||
|
||||
echo "[bundle] Building frontend image ${frontend_tag}..."
|
||||
docker build --build-arg "APP_VERSION=${app_version}" -f docker/frontend.Dockerfile -t "${frontend_tag}" .
|
||||
bundle_single_agent() {
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Error: tag is required."
|
||||
echo "Usage: ./build.sh bundle:agent <tag>"
|
||||
exit 1
|
||||
fi
|
||||
local tag="$1"
|
||||
local image="superset-tools-agent:${tag}"
|
||||
mkdir -p "$DIST_ROOT"
|
||||
build_agent "${tag}"
|
||||
export_image "${image}" "${DIST_ROOT}/superset-tools-agent.${tag}.tar.xz"
|
||||
(cd "${DIST_ROOT}" && sha256sum "superset-tools-agent.${tag}.tar.xz" > "sha256sums-agent.${tag}.txt")
|
||||
echo "[bundle:agent] ✅ Agent bundle ${tag} created"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-agent.${tag}.tar.xz | docker load"
|
||||
}
|
||||
|
||||
echo "[bundle] Building agent image ${agent_tag}..."
|
||||
docker build -f docker/Dockerfile.agent -t "${agent_tag}" .
|
||||
# ======================================================================
|
||||
# FULL BUNDLE: backend + frontend + agent
|
||||
# ======================================================================
|
||||
|
||||
echo "[bundle] Exporting .tar.xz archives..."
|
||||
echo "[bundle] Compressing backend image..."
|
||||
docker save "${backend_tag}" | xz -T0 -3 > "${DIST_ROOT}/superset-tools-backend.${tag}.tar.xz"
|
||||
echo "[bundle] Compressing frontend image..."
|
||||
docker save "${frontend_tag}" | xz -T0 -3 > "${DIST_ROOT}/superset-tools-frontend.${tag}.tar.xz"
|
||||
echo "[bundle] Compressing agent image..."
|
||||
docker save "${agent_tag}" | xz -T0 -3 > "${DIST_ROOT}/superset-tools-agent.${tag}.tar.xz"
|
||||
|
||||
echo "[bundle] Calculating checksums..."
|
||||
(
|
||||
cd "${DIST_ROOT}"
|
||||
sha256sum "superset-tools-backend.${tag}.tar.xz" "superset-tools-frontend.${tag}.tar.xz" "superset-tools-agent.${tag}.tar.xz" > "sha256sums.${tag}.txt"
|
||||
)
|
||||
|
||||
local backend_id frontend_id agent_id
|
||||
local backend_digest frontend_digest agent_digest
|
||||
backend_id="$(get_image_id "${backend_tag}")"
|
||||
frontend_id="$(get_image_id "${frontend_tag}")"
|
||||
agent_id="$(get_image_id "${agent_tag}")"
|
||||
backend_digest="$(get_repo_digest "${backend_tag}")"
|
||||
frontend_digest="$(get_repo_digest "${frontend_tag}")"
|
||||
agent_digest="$(get_repo_digest "${agent_tag}")"
|
||||
|
||||
# Генерируем deploy-compose для загрузки pre-built образов (image: + pull_policy: never)
|
||||
# Без postgres — используется внешний корпоративный PostgreSQL.
|
||||
generate_deploy_compose() {
|
||||
local tag="$1" backend_tag="$2" frontend_tag="$3" agent_tag="$4"
|
||||
cat > "${DIST_ROOT}/docker-compose.enterprise-clean.yml" <<DEPLOY
|
||||
services:
|
||||
backend:
|
||||
@@ -322,29 +402,39 @@ services:
|
||||
ports:
|
||||
- "\${AGENT_HOST_PORT:-7860}:7860"
|
||||
DEPLOY
|
||||
}
|
||||
|
||||
cat > "${DIST_ROOT}/manifest.${tag}.txt" <<EOF
|
||||
generate_manifest() {
|
||||
local tag="$1" backend_tag="$2" frontend_tag="$3" agent_tag="$4"
|
||||
local suffix="${5:-}"
|
||||
|
||||
local backend_id frontend_id agent_id
|
||||
backend_id="$(get_image_id "${backend_tag}")"
|
||||
frontend_id="$(get_image_id "${frontend_tag}")"
|
||||
agent_id="$(get_image_id "${agent_tag}")"
|
||||
|
||||
cat > "${DIST_ROOT}/manifest.${tag}${suffix}.txt" <<EOF
|
||||
release_tag=${tag}
|
||||
backend_image=${backend_tag}
|
||||
backend_image_id=${backend_id}
|
||||
backend_repo_digest=${backend_digest}
|
||||
backend_archive=superset-tools-backend.${tag}.tar.xz
|
||||
backend_repo_digest=$(get_repo_digest "${backend_tag}")
|
||||
backend_archive=superset-tools-backend.${tag}${suffix}.tar.xz
|
||||
frontend_image=${frontend_tag}
|
||||
frontend_image_id=${frontend_id}
|
||||
frontend_repo_digest=${frontend_digest}
|
||||
frontend_archive=superset-tools-frontend.${tag}.tar.xz
|
||||
frontend_repo_digest=$(get_repo_digest "${frontend_tag}")
|
||||
frontend_archive=superset-tools-frontend.${tag}${suffix}.tar.xz
|
||||
agent_image=${agent_tag}
|
||||
agent_image_id=${agent_id}
|
||||
agent_repo_digest=${agent_digest}
|
||||
agent_archive=superset-tools-agent.${tag}.tar.xz
|
||||
agent_repo_digest=$(get_repo_digest "${agent_tag}")
|
||||
agent_archive=superset-tools-agent.${tag}${suffix}.tar.xz
|
||||
compose_file=docker-compose.enterprise-clean.yml
|
||||
env_template=.env.enterprise-clean.example
|
||||
env_bootstrap_fields=INITIAL_ADMIN_CREATE,INITIAL_ADMIN_USERNAME,INITIAL_ADMIN_PASSWORD,INITIAL_ADMIN_EMAIL
|
||||
checksums_file=sha256sums.${tag}.txt
|
||||
checksums_file=sha256sums.${tag}${suffix}.txt
|
||||
generated_at_utc=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
EOF
|
||||
|
||||
cat > "${DIST_ROOT}/manifest.${tag}.json" <<EOF
|
||||
cat > "${DIST_ROOT}/manifest.${tag}${suffix}.json" <<EOF
|
||||
{
|
||||
"release_tag": "${tag}",
|
||||
"generated_at_utc": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
|
||||
@@ -353,22 +443,22 @@ EOF
|
||||
"role": "backend",
|
||||
"image": "${backend_tag}",
|
||||
"image_id": "${backend_id}",
|
||||
"repo_digest": "${backend_digest}",
|
||||
"archive": "superset-tools-backend.${tag}.tar.xz"
|
||||
"repo_digest": "$(get_repo_digest "${backend_tag}")",
|
||||
"archive": "superset-tools-backend.${tag}${suffix}.tar.xz"
|
||||
},
|
||||
{
|
||||
"role": "frontend",
|
||||
"image": "${frontend_tag}",
|
||||
"image_id": "${frontend_id}",
|
||||
"repo_digest": "${frontend_digest}",
|
||||
"archive": "superset-tools-frontend.${tag}.tar.xz"
|
||||
"repo_digest": "$(get_repo_digest "${frontend_tag}")",
|
||||
"archive": "superset-tools-frontend.${tag}${suffix}.tar.xz"
|
||||
},
|
||||
{
|
||||
"role": "agent",
|
||||
"image": "${agent_tag}",
|
||||
"image_id": "${agent_id}",
|
||||
"repo_digest": "${agent_digest}",
|
||||
"archive": "superset-tools-agent.${tag}.tar.xz"
|
||||
"repo_digest": "$(get_repo_digest "${agent_tag}")",
|
||||
"archive": "superset-tools-agent.${tag}${suffix}.tar.xz"
|
||||
}
|
||||
],
|
||||
"compose_file": "docker-compose.enterprise-clean.yml",
|
||||
@@ -379,9 +469,45 @@ EOF
|
||||
"INITIAL_ADMIN_PASSWORD",
|
||||
"INITIAL_ADMIN_EMAIL"
|
||||
],
|
||||
"checksums_file": "sha256sums.${tag}.txt"
|
||||
"checksums_file": "sha256sums.${tag}${suffix}.txt"
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
bundle_release() {
|
||||
if [[ $# -lt 1 ]]; then
|
||||
echo "Error: tag is required."
|
||||
echo "Usage: ./build.sh bundle <tag> (e.g. v1.0.0)"
|
||||
exit 1
|
||||
fi
|
||||
local tag="$1"
|
||||
local backend_tag="superset-tools-backend:${tag}"
|
||||
local frontend_tag="superset-tools-frontend:${tag}"
|
||||
local agent_tag="superset-tools-agent:${tag}"
|
||||
|
||||
mkdir -p "$DIST_ROOT"
|
||||
|
||||
# Build all three images
|
||||
build_backend "${tag}"
|
||||
build_frontend "${tag}"
|
||||
build_agent "${tag}"
|
||||
|
||||
# Export .tar.xz archives
|
||||
echo "[bundle] Exporting .tar.xz archives..."
|
||||
export_image "${backend_tag}" "${DIST_ROOT}/superset-tools-backend.${tag}.tar.xz"
|
||||
export_image "${frontend_tag}" "${DIST_ROOT}/superset-tools-frontend.${tag}.tar.xz"
|
||||
export_image "${agent_tag}" "${DIST_ROOT}/superset-tools-agent.${tag}.tar.xz"
|
||||
|
||||
# Checksums
|
||||
echo "[bundle] Calculating checksums..."
|
||||
(cd "${DIST_ROOT}" && sha256sum \
|
||||
"superset-tools-backend.${tag}.tar.xz" \
|
||||
"superset-tools-frontend.${tag}.tar.xz" \
|
||||
"superset-tools-agent.${tag}.tar.xz" > "sha256sums.${tag}.txt")
|
||||
|
||||
# Generate deploy compose + manifest
|
||||
generate_deploy_compose "${tag}" "${backend_tag}" "${frontend_tag}" "${agent_tag}"
|
||||
generate_manifest "${tag}" "${backend_tag}" "${frontend_tag}" "${agent_tag}"
|
||||
|
||||
cp "${SCRIPT_DIR}/.env.enterprise-clean.example" "${DIST_ROOT}/.env.enterprise-clean.example"
|
||||
|
||||
@@ -526,185 +652,47 @@ bundle_embeddings() {
|
||||
exit 1
|
||||
fi
|
||||
local tag="$1"
|
||||
local backend_tag="superset-tools-backend:${tag}-embeddings"
|
||||
local frontend_tag="superset-tools-frontend:${tag}-embeddings"
|
||||
local agent_tag="superset-tools-agent:${tag}-embeddings"
|
||||
|
||||
# Git commit hash for APP_VERSION (e.g. "0.5.2+58d06fb2")
|
||||
local git_commit
|
||||
git_commit="$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown')"
|
||||
local app_version="${tag}+${git_commit}"
|
||||
local suffix="-embeddings"
|
||||
local backend_tag="superset-tools-backend:${tag}${suffix}"
|
||||
local frontend_tag="superset-tools-frontend:${tag}${suffix}"
|
||||
local agent_tag="superset-tools-agent:${tag}${suffix}"
|
||||
|
||||
mkdir -p "$DIST_ROOT"
|
||||
|
||||
echo "[bundle:embeddings] Building backend image ${backend_tag}..."
|
||||
docker build -f docker/backend.Dockerfile -t "${backend_tag}" .
|
||||
|
||||
echo "[bundle:embeddings] Building frontend image ${frontend_tag}..."
|
||||
docker build --build-arg "APP_VERSION=${app_version}" -f docker/frontend.Dockerfile -t "${frontend_tag}" .
|
||||
|
||||
echo "[bundle:embeddings] Building agent image ${agent_tag} (WITH_EMBEDDINGS=true)..."
|
||||
docker build \
|
||||
--build-arg WITH_EMBEDDINGS=true \
|
||||
-f docker/Dockerfile.agent \
|
||||
-t "${agent_tag}" .
|
||||
# Build all three images
|
||||
build_backend "${tag}${suffix}"
|
||||
build_frontend "${tag}${suffix}"
|
||||
build_agent_embeddings "${tag}${suffix}"
|
||||
|
||||
# Export .tar.xz archives
|
||||
echo "[bundle:embeddings] Exporting .tar.xz archives..."
|
||||
echo "[bundle:embeddings] Compressing backend image..."
|
||||
docker save "${backend_tag}" | xz -T0 -3 > "${DIST_ROOT}/superset-tools-backend.${tag}-embeddings.tar.xz"
|
||||
echo "[bundle:embeddings] Compressing frontend image..."
|
||||
docker save "${frontend_tag}" | xz -T0 -3 > "${DIST_ROOT}/superset-tools-frontend.${tag}-embeddings.tar.xz"
|
||||
echo "[bundle:embeddings] Compressing agent image..."
|
||||
docker save "${agent_tag}" | xz -T0 -3 > "${DIST_ROOT}/superset-tools-agent.${tag}-embeddings.tar.xz"
|
||||
export_image "${backend_tag}" "${DIST_ROOT}/superset-tools-backend.${tag}${suffix}.tar.xz"
|
||||
export_image "${frontend_tag}" "${DIST_ROOT}/superset-tools-frontend.${tag}${suffix}.tar.xz"
|
||||
export_image "${agent_tag}" "${DIST_ROOT}/superset-tools-agent.${tag}${suffix}.tar.xz"
|
||||
|
||||
# Checksums
|
||||
echo "[bundle:embeddings] Calculating checksums..."
|
||||
(
|
||||
cd "${DIST_ROOT}"
|
||||
sha256sum \
|
||||
"superset-tools-backend.${tag}-embeddings.tar.xz" \
|
||||
"superset-tools-frontend.${tag}-embeddings.tar.xz" \
|
||||
"superset-tools-agent.${tag}-embeddings.tar.xz" > "sha256sums.${tag}-embeddings.txt"
|
||||
)
|
||||
(cd "${DIST_ROOT}" && sha256sum \
|
||||
"superset-tools-backend.${tag}${suffix}.tar.xz" \
|
||||
"superset-tools-frontend.${tag}${suffix}.tar.xz" \
|
||||
"superset-tools-agent.${tag}${suffix}.tar.xz" > "sha256sums.${tag}${suffix}.txt")
|
||||
|
||||
local backend_id frontend_id agent_id
|
||||
local backend_digest frontend_digest agent_digest
|
||||
backend_id="$(get_image_id "${backend_tag}")"
|
||||
frontend_id="$(get_image_id "${frontend_tag}")"
|
||||
agent_id="$(get_image_id "${agent_tag}")"
|
||||
backend_digest="$(get_repo_digest "${backend_tag}")"
|
||||
frontend_digest="$(get_repo_digest "${frontend_tag}")"
|
||||
agent_digest="$(get_repo_digest "${agent_tag}")"
|
||||
# Generate deploy compose + manifest
|
||||
generate_deploy_compose "${tag}${suffix}" "${backend_tag}" "${frontend_tag}" "${agent_tag}"
|
||||
generate_manifest "${tag}" "${backend_tag}" "${frontend_tag}" "${agent_tag}" "${suffix}"
|
||||
|
||||
# Generate deploy-compose — same as enterprise-clean, with embeddings image tags
|
||||
cat > "${DIST_ROOT}/docker-compose.enterprise-clean.yml" <<DEPLOY
|
||||
services:
|
||||
backend:
|
||||
image: ${backend_tag}
|
||||
pull_policy: never
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
DATABASE_URL: postgresql+psycopg2://\${POSTGRES_USER:-postgres}:\${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@\${POSTGRES_HOST:?Set POSTGRES_HOST}:\${POSTGRES_PORT:-5432}/\${POSTGRES_DB:-ss_tools}
|
||||
TASKS_DATABASE_URL: postgresql+psycopg2://\${POSTGRES_USER:-postgres}:\${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@\${POSTGRES_HOST:?Set POSTGRES_HOST}:\${POSTGRES_PORT:-5432}/\${POSTGRES_DB:-ss_tools}
|
||||
AUTH_DATABASE_URL: postgresql+psycopg2://\${POSTGRES_USER:-postgres}:\${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@\${POSTGRES_HOST:?Set POSTGRES_HOST}:\${POSTGRES_PORT:-5432}/\${POSTGRES_DB:-ss_tools}
|
||||
BACKEND_PORT: 8000
|
||||
AUTH_SECRET_KEY: \${AUTH_SECRET_KEY:?Set AUTH_SECRET_KEY in .env}
|
||||
ENCRYPTION_KEY: \${ENCRYPTION_KEY:?Set ENCRYPTION_KEY in .env}
|
||||
ENABLE_BELIEF_STATE_LOGGING: \${ENABLE_BELIEF_STATE_LOGGING:-true}
|
||||
TASK_LOG_LEVEL: \${TASK_LOG_LEVEL:-INFO}
|
||||
INITIAL_ADMIN_CREATE: \${INITIAL_ADMIN_CREATE:-false}
|
||||
INITIAL_ADMIN_USERNAME: \${INITIAL_ADMIN_USERNAME:-admin}
|
||||
INITIAL_ADMIN_PASSWORD: \${INITIAL_ADMIN_PASSWORD:-}
|
||||
INITIAL_ADMIN_EMAIL: \${INITIAL_ADMIN_EMAIL:-}
|
||||
OPENAI_API_KEY: \${OPENAI_API_KEY:-}
|
||||
ANTHROPIC_API_KEY: \${ANTHROPIC_API_KEY:-}
|
||||
FEATURES__DATASET_REVIEW: \${FEATURES__DATASET_REVIEW:-true}
|
||||
FEATURES__HEALTH_MONITOR: \${FEATURES__HEALTH_MONITOR:-true}
|
||||
CERTS_PATH: /opt/certs
|
||||
ports:
|
||||
- "\${BACKEND_HOST_PORT:-8001}:8000"
|
||||
volumes:
|
||||
- ./storage:/app/storage
|
||||
- \${CERTS_PATH:-./certs}:/opt/certs:ro
|
||||
|
||||
frontend:
|
||||
image: ${frontend_tag}
|
||||
pull_policy: never
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- backend
|
||||
- agent
|
||||
environment:
|
||||
SSL_KEY_PASSPHRASE: \${SSL_KEY_PASSPHRASE:-}
|
||||
ports:
|
||||
- "\${FRONTEND_HOST_PORT:-8000}:80"
|
||||
- "\${FRONTEND_SSL_PORT:-443}:443"
|
||||
volumes:
|
||||
- \${CERTS_PATH:-./certs}:/opt/certs:ro
|
||||
|
||||
agent:
|
||||
image: ${agent_tag}
|
||||
pull_policy: never
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- backend
|
||||
environment:
|
||||
LLM_API_KEY: \${LLM_API_KEY:-}
|
||||
LLM_BASE_URL: \${LLM_BASE_URL:-https://api.openai.com/v1}
|
||||
LLM_MODEL: \${LLM_MODEL:-gpt-4o}
|
||||
FASTAPI_URL: http://backend:8000
|
||||
AUTH_SECRET_KEY: \${AUTH_SECRET_KEY:?Set AUTH_SECRET_KEY in .env}
|
||||
SERVICE_JWT: \${SERVICE_JWT:?Set SERVICE_JWT in .env}
|
||||
DATABASE_URL: postgresql+psycopg2://\${POSTGRES_USER:-postgres}:\${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}@\${POSTGRES_HOST:?Set POSTGRES_HOST}:\${POSTGRES_PORT:-5432}/\${POSTGRES_DB:-ss_tools}
|
||||
GRADIO_SERVER_PORT: 7860
|
||||
GRADIO_ROOT_PATH: /api/agent/gradio
|
||||
ports:
|
||||
- "\${AGENT_HOST_PORT:-7860}:7860"
|
||||
DEPLOY
|
||||
|
||||
cat > "${DIST_ROOT}/manifest.${tag}-embeddings.txt" <<EOF
|
||||
release_tag=${tag}
|
||||
variant=embeddings
|
||||
backend_image=${backend_tag}
|
||||
backend_image_id=${backend_id}
|
||||
backend_repo_digest=${backend_digest}
|
||||
backend_archive=superset-tools-backend.${tag}-embeddings.tar.xz
|
||||
frontend_image=${frontend_tag}
|
||||
frontend_image_id=${frontend_id}
|
||||
frontend_repo_digest=${frontend_digest}
|
||||
frontend_archive=superset-tools-frontend.${tag}-embeddings.tar.xz
|
||||
agent_image=${agent_tag}
|
||||
agent_image_id=${agent_id}
|
||||
agent_repo_digest=${agent_digest}
|
||||
agent_archive=superset-tools-agent.${tag}-embeddings.tar.xz
|
||||
# Add variant field to manifest for embeddings
|
||||
cat >> "${DIST_ROOT}/manifest.${tag}${suffix}.txt" <<EOF
|
||||
agent_embeddings=true
|
||||
compose_file=docker-compose.enterprise-clean.yml
|
||||
env_template=.env.enterprise-clean.example
|
||||
checksums_file=sha256sums.${tag}-embeddings.txt
|
||||
generated_at_utc=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
EOF
|
||||
|
||||
cat > "${DIST_ROOT}/manifest.${tag}-embeddings.json" <<EOF
|
||||
{
|
||||
"release_tag": "${tag}",
|
||||
"variant": "embeddings",
|
||||
"generated_at_utc": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
|
||||
"images": [
|
||||
{
|
||||
"role": "backend",
|
||||
"image": "${backend_tag}",
|
||||
"image_id": "${backend_id}",
|
||||
"repo_digest": "${backend_digest}",
|
||||
"archive": "superset-tools-backend.${tag}-embeddings.tar.xz"
|
||||
},
|
||||
{
|
||||
"role": "frontend",
|
||||
"image": "${frontend_tag}",
|
||||
"image_id": "${frontend_id}",
|
||||
"repo_digest": "${frontend_digest}",
|
||||
"archive": "superset-tools-frontend.${tag}-embeddings.tar.xz"
|
||||
},
|
||||
{
|
||||
"role": "agent",
|
||||
"image": "${agent_tag}",
|
||||
"image_id": "${agent_id}",
|
||||
"repo_digest": "${agent_digest}",
|
||||
"archive": "superset-tools-agent.${tag}-embeddings.tar.xz",
|
||||
"embeddings": true
|
||||
}
|
||||
],
|
||||
"compose_file": "docker-compose.enterprise-clean.yml",
|
||||
"env_template": ".env.enterprise-clean.example",
|
||||
"checksums_file": "sha256sums.${tag}-embeddings.txt"
|
||||
}
|
||||
EOF
|
||||
|
||||
cp "${SCRIPT_DIR}/.env.enterprise-clean.example" "${DIST_ROOT}/.env.enterprise-clean.example"
|
||||
|
||||
echo "[bundle:embeddings] ✅ Embeddings bundle created in ${DIST_ROOT}"
|
||||
echo " # Load images:"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-backend.${tag}-embeddings.tar.xz | docker load"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-frontend.${tag}-embeddings.tar.xz | docker load"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-agent.${tag}-embeddings.tar.xz | docker load"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-backend.${tag}${suffix}.tar.xz | docker load"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-frontend.${tag}${suffix}.tar.xz | docker load"
|
||||
echo " xz -dc ${DIST_ROOT}/superset-tools-agent.${tag}${suffix}.tar.xz | docker load"
|
||||
echo " # Edit .env.enterprise-clean.example -> .env.enterprise-clean, then:"
|
||||
echo " docker compose -f ${DIST_ROOT}/docker-compose.enterprise-clean.yml up"
|
||||
echo ""
|
||||
@@ -727,20 +715,30 @@ Commands for local docker:
|
||||
logs [profile] Tail logs from all services
|
||||
status Show running containers for all profiles
|
||||
|
||||
Commands for release bundles:
|
||||
Commands for individual image build (docker build only, no export):
|
||||
build:backend <tag> Build backend image (superset-tools-backend:<tag>)
|
||||
build:frontend <tag> Build frontend image (superset-tools-frontend:<tag>)
|
||||
build:agent <tag> Build agent image (superset-tools-agent:<tag>)
|
||||
|
||||
Commands for single-image bundle (build + .tar.xz export):
|
||||
bundle:backend <tag> Build + export backend .tar.xz only
|
||||
bundle:frontend <tag> Build + export frontend .tar.xz only
|
||||
bundle:agent <tag> Build + export agent .tar.xz only
|
||||
|
||||
Commands for full bundles (all three images):
|
||||
bundle <tag> Default slim bundle (backend + frontend + agent .tar.xz's).
|
||||
Agent: NO sentence-transformers/embeddings (~500 MB saved).
|
||||
Backend: NO agent/ML/dev deps.
|
||||
NOTE: external PostgreSQL only — no bundled postgres image.
|
||||
REQUIRED: AUTH_SECRET_KEY, ENCRYPTION_KEY, POSTGRES_PASSWORD, SERVICE_JWT.
|
||||
Example: ./build.sh bundle v1.0.0
|
||||
Agent: NO sentence-transformers/embeddings (~500 MB saved).
|
||||
Backend: NO agent/ML/dev deps.
|
||||
NOTE: external PostgreSQL only — no bundled postgres image.
|
||||
REQUIRED: AUTH_SECRET_KEY, ENCRYPTION_KEY, POSTGRES_PASSWORD, SERVICE_JWT.
|
||||
Example: ./build.sh bundle v1.0.0
|
||||
|
||||
bundle:embeddings <tag>
|
||||
Enterprise bundle with semantic embedding routing.
|
||||
Agent built WITH sentence-transformers+torch (larger image).
|
||||
Same backend/frontend as default bundle.
|
||||
REQUIRED: AUTH_SECRET_KEY, ENCRYPTION_KEY, POSTGRES_PASSWORD, SERVICE_JWT.
|
||||
Example: ./build.sh bundle:embeddings v1.0.0
|
||||
Agent built WITH sentence-transformers+torch (larger image).
|
||||
Same backend/frontend as default bundle.
|
||||
REQUIRED: AUTH_SECRET_KEY, ENCRYPTION_KEY, POSTGRES_PASSWORD, SERVICE_JWT.
|
||||
Example: ./build.sh bundle:embeddings v1.0.0
|
||||
|
||||
bundle:light <tag> Lightweight all-in-one image (.tar.xz, <200 MB, no Playwright)
|
||||
Example: ./build.sh bundle:light v1.0.0
|
||||
@@ -760,6 +758,10 @@ Notes:
|
||||
- 'current' and 'master' use docker-compose.yml (dev, with local postgres).
|
||||
- 'enterprise-clean' uses docker-compose.enterprise-clean.yml (build from source,
|
||||
external postgres, corporate certs, optional nginx SSL).
|
||||
- Individual build commands (build:backend|frontend|agent) produce local docker
|
||||
images without touching dist/docker/.
|
||||
- Single-image bundle commands (bundle:backend|frontend|agent) build + export
|
||||
only one .tar.xz, useful for incremental deployments.
|
||||
HELP
|
||||
}
|
||||
|
||||
@@ -772,7 +774,9 @@ main() {
|
||||
shift 2>/dev/null || true
|
||||
|
||||
case "$CMD" in
|
||||
up|down|restart|logs|bundle|bundle:embeddings|bundle:light|status|help|-h|--help)
|
||||
up|down|restart|logs|status|help|-h|--help|bundle|bundle:embeddings|bundle:light|\
|
||||
build:backend|build:frontend|build:agent|\
|
||||
bundle:backend|bundle:frontend|bundle:agent)
|
||||
# Valid commands — proceed
|
||||
;;
|
||||
*)
|
||||
@@ -784,15 +788,21 @@ main() {
|
||||
esac
|
||||
|
||||
case "$CMD" in
|
||||
up) compose_up "${1:-current}" ;;
|
||||
down) compose_down "${1:-current}" ;;
|
||||
restart) compose_restart "${1:-current}" ;;
|
||||
logs) compose_logs "${1:-current}" ;;
|
||||
bundle) bundle_release "$@" ;;
|
||||
bundle:embeddings) bundle_embeddings "$@" ;;
|
||||
bundle:light) bundle_light "$@" ;;
|
||||
status) compose_status ;;
|
||||
help|-h|--help) show_help ;;
|
||||
up) compose_up "${1:-current}" ;;
|
||||
down) compose_down "${1:-current}" ;;
|
||||
restart) compose_restart "${1:-current}" ;;
|
||||
logs) compose_logs "${1:-current}" ;;
|
||||
bundle) bundle_release "$@" ;;
|
||||
bundle:embeddings) bundle_embeddings "$@" ;;
|
||||
bundle:light) bundle_light "$@" ;;
|
||||
build:backend) build_backend "$@" ;;
|
||||
build:frontend) build_frontend "$@" ;;
|
||||
build:agent) build_agent "$@" ;;
|
||||
bundle:backend) bundle_single_backend "$@" ;;
|
||||
bundle:frontend) bundle_single_frontend "$@" ;;
|
||||
bundle:agent) bundle_single_agent "$@" ;;
|
||||
status) compose_status ;;
|
||||
help|-h|--help) show_help ;;
|
||||
*)
|
||||
echo "Error: unknown command '$CMD'. See ./build.sh help"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user