# Backup Orchestrator Server Backend orchestrator for the Windows-to-Proxmox rsync pull pipeline. ## Structure - `app/config.py`: settings derived from `.env` and helpers for backup/current/history/log directories. - `app/models.py`: SQLModel schema for jobs, profiles, tokens and retention history. - `app/database.py`: SQLite engine and helpers. - `app/job_runner.py`: threaded job queue that executes `rsync` over SSH, streams logs, updates job status, and enforces 20-run retention. - `app/main.py`: FastAPI application exposing auth, profile CRUD, backup start/status/log, and health. ## Getting started 1. Copy `.env.example` to `.env` and adjust values (especially `DATABASE_URL`, `BACKUP_BASE`, and credentials). 2. Create Python environment and install dependencies (e.g. `pip install .` or `hatch run pip install .`). 3. Start the API/runner: ```bash uvicorn app.main:app --host 0.0.0.0 --port 8443 ``` 4. Ensure `/srv/backup/current` and `/srv/backup/.history` are writable by the service user. 5. Install `sshpass` and `rsync` on the Proxmox VM; the runner relies on them to pull from Windows. ## Notes - Tokens live in the database for `TOKEN_LIFETIME_MINUTES`; expired tokens return 401. - Each backup run writes to `/job_.log`; status endpoints return the last lines. - History retention keeps the 20 most recent runs per profile and prunes older directories under `/srv/backup/.history`. - The job runner expects the client to expose OpenSSH on port 22; `sshpass` is used to handpass the provided password.