We currently have a prod environment group which we use across all prod services/workers.
Is there a way to use e.g. a preview environment group for preview deployments only? Can’t quite figure out how to express this in the yaml file, if at all possible.
I know there’s a previewValue field for individual environment variable overrides, but ideally we’d like to have a separate environment variable group used for all preview deployments.
The only issue here would be that the preview environments will each create a copy of the environment group, though env groups are free of charge and get deleted as soon as your PR is closed.
… it seems like I can’t override a variable in my prod env group
Since we are using the YAML format, you will need to remove the - from your fromGroup line.
What you’re saying definitely makes sense. Right now, there’s no way to have preview-specific configuration for environment variables that isn’t defined directly in the render.yaml. This is something I think would benefit a lot of users who are using preview environments, so I’ve created an internal issue to track this.
In the mean time, the only solutions I can think of are workarounds, like injecting two environment variable groups with different keys (like *_PROD and *_PREVIEW) and conditionally selecting between them in your run script. This obviously isn’t ideal since the production values would still be available in the preview environment services, so depending on your security requirements, this workaround might not be acceptable for you.
I second this request. I wouldn’t really have a need to dive into the render.yaml if there was simply a way to select a different environment for pull request previews.
Guessing this will be a pretty common use case amongst production applications. Currently we have our pull request builds point at a staging api instead of our production api. Trying to get our app deployment working in Preview and this was the first hiccup I ran into. Otherwise I’m really liking the platform!
FYI this was easily configured in Heroku using “Review app config vars”. Not to distract too much from this thread, but it’d also be nice to include a UI control for the render.yaml parameter previewsExpireAfterDays. Not sure if that shows up once I get things working, but was surprised that I didn’t see this in the settings page.
Hey team, I also wanted to +1 this issue. I don’t want to commit secrets to github but that seems to be the only way to connect to a QA database. Without that there is limited utility in PR previews.
Hey @kcc989, I didn’t test this, but I guess it could work.
If you have env vars DATABASE_URL_PROD and DATABASE_URL_QA set up in the render.com UI and linked to your service, then you can use the env var names as a value or previewValue in the render.yaml file. Something like this:
And then reference the value of the particular env var itself like this (bash):
DATABASE_URL_PROD="your PROD DB credentials"
DATABASE_URL_QA="your QA DB credentials"
DATABASE_URL_ENV_VAR_NAME=DATABASE_URL_QA
echo ${!DATABASE_URL_ENV_VAR_NAME} # prints your QA DB credentials
Of course, preview only env groups would be very useful, but this little hack could hopefully solve your situation.
As I don’t see anything like this on the roadmap, I went ahead and created a feature request that I hope summarizes this thread. Feel free to upvote it if you want this feature
Hey Alexander,
I can definitely see your way of thinking but it won’t work - we’re planning a lot of work around blueprints and thing is definitely an area we are hoping to improve,