Cockroachdb serverless for preview / pr environments

We use cockroachdb serverless as our database. We can create new instances via their API and would like to have a new instance per pull request environment (or preview environment).

Is it possible to run a pre or post build script to create my instance and set environment variables for the new environment? It looks like there’s a post build shell script option within the render.yaml for preview envs, but not pull request. If there’s no way on render, then I’ll have to use github actions to integrate cockroach and trigger deployments on render.

Hey Dennis,

It certainly is possible, there are a few ways of doing that. Using PR Environments and the render.yaml file, you can dynamically set the initialDeployHook [], which will run after the first successful deploy and before your service’s start command.

And you can also dynamically set your environments variables (feeding your cockroach DB new URL):

Make sure that “previewsEnabled” is set to “true” in our render.yaml file.

Jérémy, Render Support

1 Like

Thanks Jeremy