-
-
Notifications
You must be signed in to change notification settings - Fork 178
Update and consolidate Docker Compose variable documentation. #367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
…tional image and examples to better help visualize how to perform it
Hi @bozau, The base branch of this PR has been automatically changed to A maintainer will review your PR within 5 to 7 business days. Thank you! |
docs/builds/packs/docker-compose.md
Outdated
myservice: | ||
environment: | ||
- HARD_CODED=dev # Passed to the container, but not visible in Coolify's UI. | ||
- SOME_OPTIONAL_VARIABLE=${EnvironmentNameShort} # Creates an editable, uninitialized variable in the UI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We recommend defining environment variables using upper snake case, we should keep that consinstent through out the docs. Maybe also give it a more generic name, which aligns better with the other examples.
- SOME_OPTIONAL_VARIABLE=${EnvironmentNameShort} # Creates an editable, uninitialized variable in the UI. | |
- SOME_OPTIONAL_VARIABLE=${SOME_VARIABLE_IN_COOLIFY_UI} # Creates an editable, uninitialized variable in the UI. |
docs/builds/packs/docker-compose.md
Outdated
|
||
If in developer view, you can enter it like so; | ||
``` | ||
EnvironmentNameShort={{environment.EnvironmentNameShort}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this can be a bit confusing for people. Thinking that the application env and the shared env need to share the same name, which afaik is not the case. Maybe we can re-name them, to mak the difference clear what is what.
EnvironmentNameShort={{environment.EnvironmentNameShort}} | |
SOME_VARIABLE_IN_COOLIFY_UI={{environment.SOME_SHARED_VARIABLE}} |
docs/builds/packs/docker-compose.md
Outdated
EnvironmentNameShort={{environment.EnvironmentNameShort}} | ||
``` | ||
Or in the normal view, the Name is what's referenced in the Docker Compose file `EnvironmentNameShort` with the Value being the referenced environment variable `{{environment.EnvironmentNameShort}}` as seen below. Once saved if correct, you'll see there's a third text box, if you reveal this, you should be able to see the true value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as already mentioned above.
Or in the normal view, the Name is what's referenced in the Docker Compose file `EnvironmentNameShort` with the Value being the referenced environment variable `{{environment.EnvironmentNameShort}}` as seen below. Once saved if correct, you'll see there's a third text box, if you reveal this, you should be able to see the true value. | |
Or in the normal view, the Name is what's referenced in the Docker Compose file `SOME_VARIABLE_IN_COOLIFY_UI` with the Value being the referenced environment variable `{{environment.SOME_SHARED_VARIABLE}}` as seen below. Once saved if correct, you'll see there's a third text box, if you reveal this, you should be able to see the true value. |
```bash | ||
NODE_ENV={{team.NODE_ENV}} | ||
``` | ||
Please refer to [Shared Environment Variables in Docker Compose](/builds/packs/docker-compose#shared-environment-variables) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would actually be better, to move everything in here, instead of /builds/packs/docker-compose#shared-environment-variables
. Makes semantically more sense to have everything environment variables related under the environment variables page.
The Build Pack Docker Compose page is already long enough by itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure can do if that's the preferred location :)
``` | ||
Please refer to [Defining Environment Variables in Docker Compose](/builds/packs/docker-compose#defining-environment-variables) | ||
|
||
**Key behaviors:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this + the magic environment
section be moved as well then? They work the same across both as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check it out, I haven't personally used any of the magic variables in my docker compose, but I suspect you'll be correct.
From what I understand, the magic variables are across all of Coolify, and not docker compose specific right? If so, they probably should sit in the Environment Variables page, yeah?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are actually Docker Compose specific, so I would say we add them in the Environment Variables page under Docker Compose.
Appreciate the work btw! 😊
…ced references where duplication was previously and moved the magic variables to the kb file for completeness
Hi @Cinzya and @ShadowArcanist , I believe that I've completed the changes including the suggestions, could you double check I've not missed something :) Cheers. |
Hi,
I've consolidated variable substitution documentation for Docker Compose into a single location as recommended by @ShadowArcanist, previously there were three separate locations, these were;
https://coolify.io/docs/knowledge-base/environment-variables#shared-variables
https://coolify.io/docs/knowledge-base/docker/compose#defining-environment-variables
https://coolify.io/docs/builds/packs/docker-compose#defining-environment-variables
I also added additional information regarding shared variables and how to configure and consume them better.
I hope that this will better help people on-boarding with Docker Compose.
Cheers.
Aaron.