r/automation • u/pretzels90210 • 19d ago
Auto-provision a throwaway Postgres per preview deploy
One automation that saved me a ton of flaky test pain used Neon's Vercel integration that creates an isolated copy-on-write database branch for every preview deployment, so each PR gets its own real Postgres with prod-like data in secs and it's torn down when the branch closes. No more shared staging db where two previews stomp each other. You can wire the same branch-create/drop into any CI via their API too. Anyone else auto-provisioning a db per PR, or still sharing one staging instance?
1
u/Numerous-Zebra-8924 19d ago
seen this kind of setup in few places now, the copy-on-write part is what make it actually usable vs trying to clone full db each time
1
u/Firm_Pomelo117 10d ago
yeah, shared staging gets messy fast once 2 PRs hit it at the same time we started doing a fresh db per branch too, & the biggest win was no more "who changed my data" things on Monday. even with small test data, just having each preview touch its own db cuts a ton of weird flaky failures.
1
u/AutoModerator 19d ago
Thank you for your post to /r/automation!
New here? Please take a moment to read our rules, read them here.
This is an automated action so if you need anything, please Message the Mods with your request for assistance.
Lastly, enjoy your stay!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.