Jul 14 - Using CDN - Phase 3
This commit is contained in:
@@ -1374,14 +1374,13 @@ timeout = 30
|
||||
- [ ] `.env`: `R2_ENDPOINT_URL`, `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_BUCKET=jqc-media`, `R2_PRESIGN_TTL=86400`. Keep `STORAGE_BACKEND=local` for now.
|
||||
- [ ] `pip install boto3` into the venv.
|
||||
|
||||
### Phase 3 — Verified migration sync
|
||||
- [ ] `scripts/migrate_photos_to_r2.py` — idempotent, resumable, checksummed.
|
||||
- Upload **every** file under `static/uploads/` (orphans included — completeness over reference-only).
|
||||
- Per file: local MD5 → `put_object` → `head_object` → assert ETag/size match; append result (`ok`/`uploaded`/`mismatch`/`error`) to a JSON log.
|
||||
- Skip keys already present **and** verified (resumable).
|
||||
- [ ] Bulk run ahead of time (can run while `local` is still live — it only reads local + writes R2).
|
||||
- [ ] Re-run immediately before cutover to catch the delta (idempotent).
|
||||
- [ ] Gate check: `verified == referenced-present` (Phase 0 baseline) AND zero mismatches.
|
||||
### Phase 3 — Verified migration sync — ✅ script delivered
|
||||
`scripts/migrate_photos_to_r2.py`. Copy-only (never deletes local, never touches the DB), idempotent, resumable, checksummed. Reads R2 creds from config — run it while still on `STORAGE_BACKEND=local`.
|
||||
- [x] Script delivered. Per file: MD5 + size → skip if R2 object already matches (resumable) → else single-part `put_object` (so ETag == MD5) → re-`head_object` and assert ETag + size match. Uploads **every** file under `static/uploads/` (orphans included). JSON log of all failures. Exit 0 only when every file verifies (0 mismatches, 0 errors).
|
||||
- [ ] `python scripts/migrate_photos_to_r2.py --dry-run` (review plan).
|
||||
- [ ] `python scripts/migrate_photos_to_r2.py` — bulk sync (can run while `local` is live; only writes to R2).
|
||||
- [ ] Re-run immediately before cutover to catch the delta (idempotent — skips already-verified).
|
||||
- [ ] Gate: script exits 0 → every local file verified in R2. Cross-check `verified >= referenced-present` from the Phase 0 baseline. Only then flip in Phase 4.
|
||||
|
||||
### Phase 4 — Cutover + iOS
|
||||
- [ ] Maintenance window: final incremental sync → set `STORAGE_BACKEND=s3` → `systemctl restart janitorial-qc`.
|
||||
|
||||
Reference in New Issue
Block a user