69a232d08a
- FastAPI: POST /api/v1/events, GET /health, JSON Schema validation - PostgreSQL models, Alembic migration, bootstrap API key - deploy/docker-compose.yml, .env.example - docs/install-ubuntu-24.04.md, updated work-plan (agents first)
37 lines
948 B
Markdown
37 lines
948 B
Markdown
# Backend — Security Alert Center
|
|
|
|
FastAPI + PostgreSQL + Alembic.
|
|
|
|
## Локальная разработка (без Docker)
|
|
|
|
```bash
|
|
cd backend
|
|
python3.12 -m venv .venv
|
|
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
pip install -r requirements.txt
|
|
export DATABASE_URL=postgresql+psycopg2://sac:sac@localhost:5432/sac
|
|
export SAC_BOOTSTRAP_API_KEY=sac_dev_test_key_change_me
|
|
alembic upgrade head
|
|
uvicorn app.main:app --reload --port 8000
|
|
```
|
|
|
|
## Docker (из корня репозитория)
|
|
|
|
```bash
|
|
cd deploy
|
|
cp .env.example .env
|
|
# отредактировать .env
|
|
docker compose up -d
|
|
docker compose run --rm migrate
|
|
curl http://127.0.0.1:8000/health
|
|
```
|
|
|
|
## API
|
|
|
|
| Метод | Путь | Auth |
|
|
|-------|------|------|
|
|
| GET | `/health` | нет |
|
|
| POST | `/api/v1/events` | Bearer API key |
|
|
|
|
См. [docs/agent-integration.md](../docs/agent-integration.md) и [docs/event-schema-v1.json](../docs/event-schema-v1.json).
|