Repository navigation
Dynamic environment variables per preview deployment #12099
b-gonzalez
started this conversation in
Feature Requests
Replies: 1 comment
|
I would love to have at least the PR number in the environment variables of preview deployments. Maybe a sanitized branch name or a way to sanitize it (so if my branch is |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I was wondering if there's a good way to have dynamic environment variables for each preview deployment. This is similar to the discussion in #4237 . Although that was talking about per-branch environment variables whereas I'm specifically talking about preview deployments.
Currently, there are two sets of environment variables available in Coolify: Production and Preview deployments. If you want dynamic environment variables that can be updated e.g. as part of a CI workflow, you can use the API. For production this is fine because you will only ever have one instance of production. For Preview deployments, this can also be fine if you only work on one preview at a time. But where it can become an issue when you have multiple preview deployments where each needs a dynamic and overlapping environment variables.
For my circumstance in particular, I was hoping to use dynmic environment variables with docker-compose. Specifically with docker images that are created as a part of my CI process and tagged using something like GitHub SHA. With custom environment variables per deployment, I would just be able to update that specific deployment's environment variables. So there wouldn't be an issue with having multiple preview deployments at once since each preview deployment would have its own custom and isolated environment variables. A preview deployment 1 could have an image tag in service 1 of service1:abc123 and a tag in service2 of service2:prod. And a preview deployment 2 could have an image tag in service 1 of service1:prod and could have an image tag in service 2 of service2:bcd234, etc.
Another option I thought about was to create a .env file in the CI process. And then just use the values in the environment variables dynamically with docker-compose. But it doesn't look like this is supported.
If there's a better way to do this, I'd love to hear about other options.
Thanks!
All reactions