mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 21:43:05 +09:00
- ContainerScalePolicy model (per-app: enabled, service_name, min/max replicas, cpu high/low %, cooldown, current_replicas). - ContainerScaleService: evaluate() scales a compose service up/down by one replica when average CPU crosses the high/low thresholds, within bounds and outside the cooldown; scale_to() for manual; sweep() for cron. Uses `docker compose --scale`; local + scale-capable services only. - apps.py: GET/PUT /<id>/scale-policy, POST /<id>/scale, POST /<id>/scale/evaluate, POST /scale-sweep (admin). - 10 tests: bounds clamping, scale up/down, hold-at-max, cooldown, disabled, unknown-cpu, manual endpoint, auth. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>