MicroFish/scripts
liyizhouAI 925d2f7ca6 feat: add one-click deploy script
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
2026-04-16 08:21:52 +08:00
..
deploy.sh feat: add one-click deploy script 2026-04-16 08:21:52 +08:00