scripts/deploy.sh unifies backend/frontend deployment:
- --backend (default): rsync app+scripts → ubuntu@124.223.92.72:/opt/foresight/backend
+ kill/restart Flask + health check
- --frontend: vite build + coscmd upload to COS bucket foresight-1317962478
+ tccli CDN purge
- --full: both
- --no-restart: skip Flask restart
- --dry-run: preview only
Safety:
- Python syntax check before rsync (aborts on error)
- health check loop after restart (aborts if /health fails 5x)
- rsync --delete excludes __pycache__ / *.pyc / .pytest_cache
- rsync --rsync-path="sudo rsync" for remote permissions
- set -euo pipefail throughout
- "$@" not eval (handles spaces in project path)
Solves:
- Manual deploys of backend bits scattered across sessions missed v0.3
accelerate methods on server until this was caught in production
- No consistent way to push frontend + purge CDN in one step