c889a57b6b
Test Suites / Build CI Environment (push) Has been cancelled
Test Suites / Basic Tests (push) Has been cancelled
Test Suites / End-to-End Tests (push) Has been cancelled
Test Suites / CLI Tests (push) Has been cancelled
Test Suites / Slow End-to-End Tests (push) Has been cancelled
Test Suites / Graph Database Tests (push) Has been cancelled
Test Suites / Vector DB Tests (push) Has been cancelled
Test Suites / Temporal Graph Test (push) Has been cancelled
Test Suites / Search Test on Different DBs (push) Has been cancelled
Test Suites / Example Tests (push) Has been cancelled
Test Suites / Notebook Tests (push) Has been cancelled
Test Suites / OS and Python Tests Ubuntu (push) Has been cancelled
Test Suites / OS and Python Tests Extended (push) Has been cancelled
Test Suites / LLM Test Suite (push) Has been cancelled
Test Suites / S3 File Storage Test (push) Has been cancelled
Test Suites / Run Integration Tests (push) Has been cancelled
Test Suites / MCP Tests (push) Has been cancelled
Test Suites / Docker Compose Test (push) Has been cancelled
Test Suites / Docker CI test (push) Has been cancelled
Test Suites / Relational DB Migration Tests (push) Has been cancelled
Test Suites / Distributed Cognee Test (push) Has been cancelled
Test Suites / DB Examples Tests (push) Has been cancelled
Test Suites / Test Completion Status (push) Has been cancelled
Test Suites / Claude Code Review (push) Has been cancelled
Test Suites / basic checks (push) Has been cancelled
build | Build and Push Cognee MCP Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
build | Build and Push Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.11) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.12) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (kuzu, kuzu) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (neo4j, neo4j) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Examples (push) Has been cancelled
Weighted Edges Tests / Code Quality for Weighted Edges (push) Has been cancelled
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
"""
|
|
Cognee on Modal — 1-click serverless deployment.
|
|
|
|
Deploys the Cognee FastAPI server as a Modal ASGI app with:
|
|
- Persistent volume for file-based databases (SQLite, LanceDB, Ladybug)
|
|
- Secret injection for LLM_API_KEY and other credentials
|
|
- Auto-scaling with configurable concurrency
|
|
|
|
Setup:
|
|
1. pip install modal && modal setup
|
|
2. modal secret create cognee-secrets \
|
|
LLM_API_KEY=sk-xxx \
|
|
LLM_MODEL=openai/gpt-4o-mini
|
|
3. modal deploy distributed/deploy/modal_app.py
|
|
|
|
Your API will be available at:
|
|
https://<your-org>--cognee-api-serve.modal.run
|
|
"""
|
|
|
|
import modal
|
|
|
|
app = modal.App("cognee-api")
|
|
|
|
# Persistent volume for file-based databases
|
|
volume = modal.Volume.from_name("cognee-data", create_if_missing=True)
|
|
|
|
# Build image from existing Dockerfile
|
|
image = (
|
|
modal.Image.debian_slim(python_version="3.12")
|
|
.apt_install("gcc", "libpq-dev", "git", "curl", "cmake", "clang", "build-essential")
|
|
.pip_install("uv")
|
|
.run_commands(
|
|
"uv pip install --system cognee[postgres,api]",
|
|
)
|
|
.env(
|
|
{
|
|
"PYTHONUNBUFFERED": "1",
|
|
"HOST": "0.0.0.0",
|
|
"DATA_ROOT_DIRECTORY": "/data/cognee_data",
|
|
"SYSTEM_ROOT_DIRECTORY": "/data/cognee_system",
|
|
}
|
|
)
|
|
)
|
|
|
|
|
|
@app.function(
|
|
image=image,
|
|
secrets=[modal.Secret.from_name("cognee-secrets")],
|
|
volumes={"/data": volume},
|
|
timeout=3600,
|
|
container_idle_timeout=300,
|
|
allow_concurrent_inputs=10,
|
|
)
|
|
@modal.asgi_app()
|
|
def serve():
|
|
from cognee.api.client import app as fastapi_app
|
|
|
|
return fastapi_app
|