feat(infra): migrate Postgres to Neon and object storage to Cloudflare R2 - #22
Merged
Conversation
…e R2 Supabase's paused free-tier project can no longer serve as database or storage backend. Points Prisma at Neon (pooled + direct connection strings) and reimplements storageService.ts against R2, preserving object keys and function signatures so no caller changes. Both verified live: real DB reads, a real GeoTIFF round-trip, and a panel recompute with zero calls to solar.googleapis.com. Closes #4, #5
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe backend now uses Neon for PostgreSQL and Cloudflare R2 for object storage. Environment validation, Prisma configuration, deployment documentation, R2 client setup, storage operations, signed URLs, and storage tests were updated accordingly. ChangesNeon and Cloudflare R2 migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant storageService
participant r2
participant CloudflareR2
storageService->>r2: Send PutObjectCommand, GetObjectCommand, or presign GetObjectCommand
r2->>CloudflareR2: Execute object operation
CloudflareR2-->>r2: Return operation result or object body
r2-->>storageService: Return result, ArrayBuffer, or signed URL
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DATABASE_URLfor the app, unpooledDIRECT_URLfor Prisma Migrate), replacing the paused Supabase project.storageService.ts's three exported functions against Cloudflare R2, preserving signatures and object keys byte-for-byte so no caller (overlayService,fluxRecomputeService,geoTiffService,locationService,projectService,locationPipeline/store) needed changes.Test plan
pnpm typecheck— exit 0 across shared/backend/frontend/pdf-servicepnpm test— 211 frontend + 124 backend passing (7 new storage contract tests)eslint . --max-warnings 68/prettier --check .— both cleanprisma migrate statusagainst Neon — up to date, 6/6 migrationsGET /api/healthok, a realLocationrow +Projectcount read through PrismargbImageUrl(200, image/png), full upload→download round trip, cleaned up aftersolar.googleapis.comHTTP_200in 2.17s with no user-visible errorCloses #4, closes #5
Summary by CodeRabbit
Infrastructure
Documentation
Tests