Smart Deploy
The Smart Deploy system tracks file hashes and only uploads changed files to R2, dramatically reducing deployment time for large sites.
Problem
The previous approach (rclone copy ./public r2:redecasas) uploaded all 50,000+ files (3.5GB) on every deploy, even if only a few changed.
Solution
Only uploads:
- New files — don’t exist remotely
- Modified files — different SHA256 hash
- Skips unchanged — matching hashes untouched
Usage
Quick Deploy (Incremental)
# Deploy only changed filescd site && go run . smart-deploy
# Or use the script./smart-deploy.shProduction Deployment
# Build and deploycd site && ./deploy-production.sh
# Force full deployment./deploy-production.sh --forceCLI Options
# Dry rungo run . smart-deploy --dry-run
# Force full deploygo run . smart-deploy --force
# Sync remote state to manifestgo run . smart-deploy --sync-remote
# Deploy only single pages (home, auth, contact, chat, calculators, etc.)go run . smart-deploy --single
# Deploy only specific prefixes (can be repeated)go run . smart-deploy --scope conta/ --scope login/
# Custom settingsgo run . smart-deploy \ --public-dir ./public \ --remote r2:redecasas \ --concurrent 20How It Works
- Scan — computes SHA256 for all files in
public/ - Compare — against manifest to find changes
- Deploy — uploads changed files via concurrent rclone copyto
- Cleanup — removes remote files no longer local
- Save — updates manifest
Manifest
Stored at site/cache/deploy/deploy-manifest.json:
- File paths
- SHA256 hashes
- File sizes
- Timestamps
Performance
| Scenario | Full Sync | Smart Deploy |
|---|---|---|
| First deploy (50k files, 3.5GB) | ~45 min | ~45 min |
| Small change (5 files, 50KB) | ~45 min | ~2 sec |
| Medium change (100 files, 2MB) | ~45 min | ~30 sec |
| Large change (1000 files, 50MB) | ~45 min | ~5 min |