Containerise: Postgres + Redis/RQ + API + Ghidra worker
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>
This commit is contained in:
72
docker-compose.yml
Normal file
72
docker-compose.yml
Normal file
@@ -0,0 +1,72 @@
|
||||
# Aidem Media Playground — full stack.
|
||||
#
|
||||
# db Postgres (durable catalog)
|
||||
# redis job queue broker
|
||||
# api FastAPI + Command Center UI (http://localhost:8000)
|
||||
# worker Ghidra-headless acquisition worker (drains the 'acquire' queue)
|
||||
#
|
||||
# api and worker share the `uploads` volume: the API streams an uploaded archive there,
|
||||
# the worker reads it back by path. Bring it up with: docker compose up --build
|
||||
#
|
||||
# NOTE: the worker image downloads Ghidra (~1 GB) on first build — that layer is slow but cached.
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_USER: ams
|
||||
POSTGRES_PASSWORD: ams
|
||||
POSTGRES_DB: ams
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ams"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/api.Dockerfile
|
||||
environment:
|
||||
DATABASE_URL: postgresql+psycopg://ams:ams@db:5432/ams
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
AMS_UPLOAD_DIR: /data/uploads
|
||||
ports:
|
||||
- "8000:8000"
|
||||
volumes:
|
||||
- uploads:/data/uploads
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/worker.Dockerfile
|
||||
environment:
|
||||
DATABASE_URL: postgresql+psycopg://ams:ams@db:5432/ams
|
||||
REDIS_URL: redis://redis:6379/0
|
||||
AMS_UPLOAD_DIR: /data/uploads
|
||||
volumes:
|
||||
- uploads:/data/uploads
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
uploads:
|
||||
Reference in New Issue
Block a user