Brings up the documented target architecture as a docker-compose stack — a modular monolith with the Ghidra step split into its own async worker. - worker/: RQ queue (lazy redis import) + run_acquisition task (Job status queued→started→finished/failed, drives ams.acquire with sink=db) - Job model + JobOut schema; Snapshot.data is JSONB on Postgres - POST/GET /jobs: stream an upload to a shared volume, enqueue, poll status - docker/api.Dockerfile (slim) + docker/worker.Dockerfile (JDK21 + Ghidra fetched at build, overridable via GHIDRA_URL) + docker-compose.yml - ghidra.py: AMS_GHIDRA_SCRIPTS override for in-container script path - pyproject: [worker] extra (rq/redis/psycopg), python-multipart in [api] - tests: 4 new (task success/failure + endpoint enqueue/503) -> 22/22 Verified: API image builds, container serves /health + /ui + /jobs; compose config validates. Worker image (downloads ~1 GB Ghidra) not built here. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
58 lines
1.1 KiB
Python
58 lines
1.1 KiB
Python
"""Pydantic request/response models."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
class GameCreate(BaseModel):
|
|
name: str
|
|
notes: str | None = None
|
|
|
|
|
|
class GameOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
name: str
|
|
notes: str | None = None
|
|
|
|
|
|
class SnapshotOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
game_id: int | None
|
|
binary_name: str
|
|
sha256: str
|
|
engine: str | None
|
|
compiler: str | None
|
|
schema_version: int | None
|
|
n_types: int
|
|
n_methods: int
|
|
n_events: int
|
|
n_fields: int
|
|
created_at: datetime
|
|
|
|
|
|
class SnapshotDetail(SnapshotOut):
|
|
data: dict
|
|
|
|
|
|
class GameDetail(GameOut):
|
|
snapshots: list[SnapshotOut] = []
|
|
|
|
|
|
class JobOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
id: int
|
|
rq_id: str | None
|
|
status: str
|
|
source_name: str
|
|
game_name: str | None
|
|
snapshot_id: int | None
|
|
dll_name: str | None
|
|
error: str | None
|
|
created_at: datetime
|
|
updated_at: datetime
|