43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
# Backend — Security Alert Center
|
|
|
|
FastAPI + PostgreSQL + Alembic.
|
|
|
|
## Production (native на Ubuntu 24.04)
|
|
|
|
См. **[docs/install-ubuntu-24.04-native.md](../docs/install-ubuntu-24.04-native.md)**.
|
|
|
|
Кратко:
|
|
|
|
```bash
|
|
cd /opt/security-alert-center/backend
|
|
python3.12 -m venv .venv && .venv/bin/pip install -r requirements.txt
|
|
# /opt/security-alert-center/config/sac-api.env — см. deploy/env.native.example
|
|
alembic upgrade head
|
|
systemctl start sac-api
|
|
```
|
|
|
|
## Локальная разработка
|
|
|
|
```bash
|
|
cd backend
|
|
python3.12 -m venv .venv
|
|
source .venv/bin/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
|
|
export EVENT_SCHEMA_PATH=../schemas/event-schema-v1.json
|
|
alembic upgrade head
|
|
uvicorn app.main:app --reload --port 8000
|
|
```
|
|
|
|
## Docker (альтернатива)
|
|
|
|
[docs/install-ubuntu-24.04-docker.md](../docs/install-ubuntu-24.04-docker.md)
|
|
|
|
## API
|
|
|
|
| Метод | Путь | Auth |
|
|
|-------|------|------|
|
|
| GET | `/health` | нет |
|
|
| POST | `/api/v1/events` | Bearer API key |
|