Initial curated ITWorx_MCP_Hub source from 368fba691ea8d23403b4d56b53b5ec670d7c5020
This commit is contained in:
commit
cb5be898ea
663 files changed
+82674
No files matched your search
@@ -0,0 +1,7 @@
|
||||
# Immutable source/runtime contract for the schema-compatible ContextForge build.
|
||||
# CONTEXTFORGE_LOCAL_IMAGE is a verified local staging tag only; production uses
|
||||
# CONTEXTFORGE_IMAGE as an immutable registry digest supplied by promotion.
|
||||
CONTEXTFORGE_UPSTREAM_COMMIT=1e58a0434a78bbdbe1e975abeb0bed1043ff14c1
|
||||
CONTEXTFORGE_ALEMBIC_HEAD=12d4a0c7789c
|
||||
CONTEXTFORGE_MCP_SDK=1.30.0
|
||||
CONTEXTFORGE_LOCAL_IMAGE=itworx-mcp-hub/contextforge-schema:12d4a0c7789c
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
fail_secret() {
|
||||
echo "ContextForge secret-file validation failed" >&2
|
||||
exit 78
|
||||
}
|
||||
|
||||
fail_session_topology() {
|
||||
echo "ContextForge multi-worker session topology is unsafe: Redis-backed stateful session affinity is required" >&2
|
||||
exit 78
|
||||
}
|
||||
|
||||
fail_runtime_contract() {
|
||||
echo "ContextForge strict runtime contract verification failed" >&2
|
||||
exit 78
|
||||
}
|
||||
|
||||
read_secret() {
|
||||
[ -f "$1" ] && [ -r "$1" ] && [ -s "$1" ] || fail_secret
|
||||
mode="$(stat -c '%a' "$1" 2>/dev/null || true)"
|
||||
case "$mode" in 400|600) ;; *) fail_secret ;; esac
|
||||
[ "$(stat -c '%u' "$1" 2>/dev/null || true)" = "${SECRET_EXPECTED_UID:?}" ] || fail_secret
|
||||
[ "$(stat -c '%g' "$1" 2>/dev/null || true)" = "${SECRET_EXPECTED_GID:?}" ] || fail_secret
|
||||
value="$(tr -d '\r\n' < "$1")"
|
||||
[ -n "$value" ] || fail_secret
|
||||
printf '%s' "$value"
|
||||
}
|
||||
|
||||
cf_password="$(read_secret /run/secrets/contextforge_database_password)"
|
||||
export DATABASE_URL="postgresql+psycopg://contextforge:${cf_password}@postgres:5432/contextforge"
|
||||
export JWT_SECRET_KEY="$(read_secret /run/secrets/contextforge_jwt_secret)"
|
||||
export AUTH_ENCRYPTION_SECRET="$(read_secret /run/secrets/contextforge_auth_encryption_secret)"
|
||||
export BASIC_AUTH_USER="itworx-contextforge-admin"
|
||||
export BASIC_AUTH_PASSWORD="$(read_secret /run/secrets/contextforge_admin_credential)"
|
||||
export PLATFORM_ADMIN_EMAIL="${PLATFORM_ADMIN_EMAIL:-contextforge-admin@example.com}"
|
||||
export PLATFORM_ADMIN_PASSWORD="$BASIC_AUTH_PASSWORD"
|
||||
|
||||
# Base/dev defaults retain the historical safe multi-worker topology. Production
|
||||
# overrides these values to the separately tested stateless single-worker
|
||||
# contract. Multi-worker mode is never allowed to weaken its affinity controls.
|
||||
export CACHE_TYPE="${CACHE_TYPE:-redis}"
|
||||
export USE_STATEFUL_SESSIONS="${USE_STATEFUL_SESSIONS:-true}"
|
||||
export MCPGATEWAY_SESSION_AFFINITY_ENABLED="${MCPGATEWAY_SESSION_AFFINITY_ENABLED:-true}"
|
||||
export MCPGATEWAY_SESSION_AFFINITY_TTL="${MCPGATEWAY_SESSION_AFFINITY_TTL:-3600}"
|
||||
|
||||
case "${GUNICORN_WORKERS:-auto}" in
|
||||
1) ;;
|
||||
*)
|
||||
[ "$CACHE_TYPE" = "redis" ] || fail_session_topology
|
||||
[ "$USE_STATEFUL_SESSIONS" = "true" ] || fail_session_topology
|
||||
[ "$MCPGATEWAY_SESSION_AFFINITY_ENABLED" = "true" ] || fail_session_topology
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${REDIS_AUTH_ENABLED:-false}" = "true" ]; then
|
||||
redis_password="$(read_secret /run/secrets/redis_password)"
|
||||
export REDIS_URL="redis://:${redis_password}@redis:6379/0"
|
||||
unset redis_password
|
||||
else
|
||||
export REDIS_URL="${REDIS_URL:-redis://redis:6379/0}"
|
||||
fi
|
||||
|
||||
# Production strict mode is a hard startup gate. The verifier is read-only: it
|
||||
# proves the embedded compatibility tuple, installed MCP SDK/API, image Alembic
|
||||
# head, database revision and transport settings. It never installs packages or
|
||||
# runs migration mutations. Any failure stops before ContextForge/Gunicorn.
|
||||
if [ "${ITWORX_CONTEXTFORGE_CONTRACT_MODE:-relaxed}" = "strict" ]; then
|
||||
[ -r /opt/itworx/contextforge-runtime-contract.py ] || fail_runtime_contract
|
||||
/app/.venv/bin/python /opt/itworx/contextforge-runtime-contract.py --startup || fail_runtime_contract
|
||||
fi
|
||||
|
||||
exec /app/docker-entrypoint.sh
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"schema": "itworx.contextforge-runtime-contract/v1",
|
||||
"sourceCommit": "1e58a0434a78bbdbe1e975abeb0bed1043ff14c1",
|
||||
"alembicHead": "12d4a0c7789c",
|
||||
"mcpSdk": "1.30.0",
|
||||
"requiredSymbol": "McpError",
|
||||
"productionEnvironment": {
|
||||
"GUNICORN_WORKERS": "1",
|
||||
"USE_STATEFUL_SESSIONS": "false",
|
||||
"MCPGATEWAY_SESSION_AFFINITY_ENABLED": "false",
|
||||
"JSON_RESPONSE_ENABLED": "true",
|
||||
"EMAIL_AUTH_ENABLED": "false",
|
||||
"MCP_SESSION_POOL_ENABLED": "false",
|
||||
"MCPGATEWAY_SKIP_MIGRATIONS": "true",
|
||||
"ITWORX_CONTEXTFORGE_CONTRACT_MODE": "strict"
|
||||
},
|
||||
"migrationPolicy": {
|
||||
"startupMigrations": "forbidden",
|
||||
"skipEnv": "MCPGATEWAY_SKIP_MIGRATIONS",
|
||||
"skipValue": "true"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user