9a43f85259
Introduce a StorageBackend abstraction (local filesystem and S3) for patent PDF storage. When STORAGE_BACKEND=s3, PDFs are read/written via boto3 to an S3-compatible bucket instead of the local filesystem. - Add SPARC/storage.py with LocalStorageBackend and S3StorageBackend - Update serp_api.py save_patents and parse_patent_pdf to use storage - Add storage config vars to config.py and .env.example - Add optional MinIO service to docker-compose.yml (--profile s3) - Add boto3 to requirements.txt Closes leeworks-agents/SPARC#38 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
90 lines
2.3 KiB
YAML
90 lines
2.3 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: sparc-postgres
|
|
environment:
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
init-db:
|
|
build: .
|
|
container_name: sparc-init-db
|
|
command: python scripts/init_database.py
|
|
environment:
|
|
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: "no"
|
|
|
|
api:
|
|
build: .
|
|
container_name: sparc-api
|
|
command: uvicorn SPARC.api:app --host 0.0.0.0 --port 8000
|
|
environment:
|
|
API_KEY: ${API_KEY}
|
|
OPENROUTER_API_KEY: ${OPENROUTER_API_KEY}
|
|
DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}
|
|
USE_CACHE: "true"
|
|
JWT_SECRET: ${JWT_SECRET:-sparc-secret-key-change-in-production}
|
|
CORS_ORIGINS: ${CORS_ORIGINS:-}
|
|
APP_ENV: ${APP_ENV:-development}
|
|
ROOT_PATH: /api
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
init-db:
|
|
condition: service_completed_successfully
|
|
volumes:
|
|
- ./patents:/app/patents
|
|
restart: unless-stopped
|
|
|
|
# Optional: MinIO for S3-compatible local object storage
|
|
# Enable by setting STORAGE_BACKEND=s3 in .env
|
|
minio:
|
|
image: minio/minio:latest
|
|
container_name: sparc-minio
|
|
command: server /data --console-address ":9001"
|
|
environment:
|
|
MINIO_ROOT_USER: ${AWS_ACCESS_KEY_ID:-minioadmin}
|
|
MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY:-minioadmin}
|
|
ports:
|
|
- "9000:9000"
|
|
- "9001:9001"
|
|
volumes:
|
|
- minio_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "mc", "ready", "local"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
restart: unless-stopped
|
|
profiles:
|
|
- s3
|
|
|
|
dashboard:
|
|
build: ./frontend
|
|
container_name: sparc-dashboard
|
|
ports:
|
|
- "8080:80"
|
|
depends_on:
|
|
- api
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
minio_data:
|