refactor: retire external vector deployment
This commit is contained in:
+45
-18
@@ -46,29 +46,23 @@ trap cleanup EXIT
|
||||
trap 'exit 129' HUP
|
||||
trap 'exit 130' INT
|
||||
trap 'exit 143' TERM
|
||||
|
||||
mkdir -p "$tmp/source/evidence"
|
||||
printf '%s\n' '# Evidence' 'generation one' >"$tmp/source/evidence/a.md"
|
||||
bundle="$tmp/thothii.secrets"
|
||||
{
|
||||
printf 'THT_VECTOR_BOOTSTRAP_PASSWORD=smoke-bootstrap-%s\n' "$project"
|
||||
printf 'THT_VECTOR_MIGRATOR_PASSWORD=smoke-migrator-%s\n' "$project"
|
||||
printf 'THT_VECTOR_READER_PASSWORD=smoke-reader-%s\n' "$project"
|
||||
printf 'THT_VECTOR_WRITER_PASSWORD=smoke-writer-%s\n' "$project"
|
||||
} >"$bundle"
|
||||
printf '%s\n' 'THT_MODEL_API_KEY=smoke-model-key' >"$bundle"
|
||||
chmod 0600 "$bundle"
|
||||
export THT_SECRETS_FILE="$bundle"
|
||||
export THT_OLLAMA_URL=http://mock-embeddings:8081
|
||||
printf '%s\n' '{}' >"$tmp/pi-auth.json"
|
||||
chmod 0600 "$tmp/pi-auth.json"
|
||||
printf '%s' 'smoke-dwh-password' >"$tmp/dwh-password"
|
||||
chmod 0600 "$tmp/pi-auth.json" "$tmp/dwh-password"
|
||||
printf '%s\n' \
|
||||
'THT_WORKSPACE_GIT_REMOTE=https://git.example.invalid/platform/thoth-workspaces.git' \
|
||||
"PI_AUTH_FILE=$tmp/pi-auth.json" \
|
||||
"THT_SECRETS_FILE=$bundle" \
|
||||
'THT_OLLAMA_URL=http://mock-embeddings:8081' >"$tmp/operator.env"
|
||||
"THT_SECRETS_FILE=$bundle" >"$tmp/operator.env"
|
||||
|
||||
cat >"$tmp/smoke.yaml" <<YAML
|
||||
services:
|
||||
mock-embeddings:
|
||||
embedding:
|
||||
image: thothii-core:local
|
||||
profiles: [preprocess]
|
||||
entrypoint: [/opt/venv/bin/python, -c]
|
||||
@@ -78,19 +72,52 @@ services:
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
class H(BaseHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
n=len(json.loads(self.rfile.read(int(self.headers['Content-Length'])))['input'])
|
||||
body=json.dumps({'embeddings': [[1.0]+[0.0]*767 for _ in range(n)]}).encode()
|
||||
self.send_response(200); self.send_header('Content-Length', str(len(body))); self.end_headers(); self.wfile.write(body)
|
||||
n = len(json.loads(self.rfile.read(int(self.headers["Content-Length"])))["input"])
|
||||
body = json.dumps({"embeddings": [[1.0] + [0.0] * 1023 for _ in range(n)]}).encode()
|
||||
self.send_response(200); self.send_header("Content-Length", str(len(body))); self.end_headers(); self.wfile.write(body)
|
||||
def do_GET(self):
|
||||
body = b'{"models":[{"name":"qwen3-embedding:0.6b"}]}'
|
||||
self.send_response(200); self.send_header("Content-Length", str(len(body))); self.end_headers(); self.wfile.write(body)
|
||||
def log_message(self, *args): pass
|
||||
HTTPServer(('0.0.0.0',8081),H).serve_forever()
|
||||
HTTPServer(("0.0.0.0", 11434), H).serve_forever()
|
||||
embedding-model-init:
|
||||
profiles: [preprocess]
|
||||
image: busybox:1.37.0
|
||||
entrypoint: [sh, -ec]
|
||||
command: ["exit 0"]
|
||||
depends_on:
|
||||
embedding: {condition: service_started}
|
||||
dwh:
|
||||
image: postgres:16-alpine
|
||||
profiles: [preprocess]
|
||||
environment:
|
||||
POSTGRES_DB: warehouse
|
||||
POSTGRES_USER: thoth_reader
|
||||
POSTGRES_PASSWORD: smoke-dwh-password
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U thoth_reader -d warehouse"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 20
|
||||
start_period: 10s
|
||||
preprocess-evidence:
|
||||
volumes:
|
||||
- $tmp/source:/data/source:ro
|
||||
preprocess-dwh:
|
||||
environment:
|
||||
THT_PREPROCESS_DWH_HOST: dwh
|
||||
THT_PREPROCESS_DWH_PORT: "5432"
|
||||
THT_PREPROCESS_DWH_DATABASE: warehouse
|
||||
THT_PREPROCESS_DWH_SCHEMA: public
|
||||
THT_PREPROCESS_DWH_USER: thoth_reader
|
||||
THT_PREPROCESS_DWH_PASSWORD_FILE: /run/secrets/preprocess-dwh-password
|
||||
volumes:
|
||||
- $tmp/dwh-password:/run/secrets/preprocess-dwh-password:ro
|
||||
depends_on:
|
||||
mock-embeddings: {condition: service_started}
|
||||
dwh: {condition: service_healthy}
|
||||
YAML
|
||||
|
||||
compose="docker compose --env-file $tmp/operator.env -f compose.yaml -f deploy/compose.local-vector.yaml -f deploy/compose.preprocess.yaml -f deploy/compose.preprocess-local-vector.yaml -f $tmp/smoke.yaml --project-name $project --profile local-vector --profile preprocess"
|
||||
compose="docker compose --env-file $tmp/operator.env -f compose.yaml -f deploy/compose.preprocess.yaml -f $tmp/smoke.yaml --project-name $project --profile preprocess"
|
||||
$compose build preprocess-evidence
|
||||
if [ "${PREPROCESS_SMOKE_INJECT_FAILURE:-0}" = "1" ]; then
|
||||
sh -c 'exit 97'
|
||||
|
||||
Reference in New Issue
Block a user