docs: native Ubuntu install as primary; systemd and nginx

- install-ubuntu-24.04-native.md (production) and -docker.md (alternative)

- deploy/systemd/sac-api.service, nginx/sac.conf.example, env.native.example

- deployment, README, INDEX, work-plan, TZ updated
This commit is contained in:
PTah
2026-05-26 20:28:05 +10:00
parent 69a232d08a
commit 9203af90d5
14 changed files with 582 additions and 427 deletions
+20 -14
View File
@@ -2,29 +2,37 @@
FastAPI + PostgreSQL + Alembic.
## Локальная разработка (без Docker)
## 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
# /etc/security-alert-center/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 # Windows: .venv\Scripts\activate
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_change_me
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 (из корня репозитория)
## 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
```
[docs/install-ubuntu-24.04-docker.md](../docs/install-ubuntu-24.04-docker.md)
## API
@@ -32,5 +40,3 @@ curl http://127.0.0.1:8000/health
|-------|------|------|
| 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).