-
Notifications
You must be signed in to change notification settings - Fork 27
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
Make the docker-compose.yml file manipulatable #27
Comments
Hmm... so you want to combine these files in memory, tweak some values, and run the CLI with the result? Seems reasonable. We can write the temp file to the Design wise, I'd probably create a It might even be possible to extract all filename handling into this class (and retain your array approach, if someone wanted to specify multiple editable compositions ... hmm ... ) I'd probably add a |
I think the biggest hurdle here can become the output-parser. You know handled parsing the compose file, now we have to properly write it:
Use cases for compose file manipulationa) Open specific ports for Development ( Debugging / Database ports ) Alternatives?Using compose file overrides like shown in the pull request, you can handle a-c pretty easy and you can use those docker files without docker-compose.rb, which make them more independent. A fairly interesting point though is d) which is not solvable right now with the compose-overrides since the values are dynamic. d) is often important for setting up "debugging hosts" on the container so it connects back properly, exposing the host interface for a particular image or apply developer-defauls which are in ~/.myapp/devdefault.yaml - whatever kind of things. One additional integration point could be rsync/unison/nfs share-volume setups for development E.g. Hodor https://github.com/gansbrest/hodor does offer a .hoderfile which is a compose file, but parsed by ERB. While i like this idea, the file there is not being able to be used in production, its a copy of the production compose file, a separate one. Though one could write a "generate production compose file on build|" CI step to solve this without a copy. I hope you do not mind that i make this topic a bit bigger. I just want to share some scenarios this kind of things gets used in and actually also the reason i looked for a gem like you have here. @xeger thanks for making me a contributor. I will continue creating pull-requests nevertheless, so we can have code reviews and things - i guess thats common sense anyway |
Use Cases & AlternativesHmm. So, there is an obscure feature of docker-compose.yml; it allows host env to be substituted like so:
It may even support the The For (a) and (b), you might be able to handle them with selective overriding -- add additional file if user wants ports, volumes, etc -- but it would get sloppy. Editing the composition in ruby space is more graceful. |
YAML Parsing
Preserving ordering is a bit more tricky. Ruby's A final consideration is that many things in docker-compose YML that need to be ordered, already are capable of using an Array notation, e.g.
|
Closing (for now) due to lack of interest from contributors. |
This projects seems very useful! Thank you for all the work.
I would like to replace it a pretty complicated script which uses uses several docker compose files and overlays to do something like "load dev enironment with variations A" which means:
So i am using several docker-compose files as overlay, while production/docker-compose.yml is huge and defines all services, while development/docker-compose.yml basically just changes some ENV vars to initiate some the development enironment and rarely using a different image for development.
Any ideas if you would like to either add this "overlay suppport" to session or even, parse the config once, and then let the hash be manipulateble, when running, you write this file temporary into the dir defined, like . and run compuse -f . op
While the reason we should not write to /tmp/ is because compose actuall derives the network-domain from the top-level folder. We could of course simulate that folder in /tmp
What are your ideas?
The text was updated successfully, but these errors were encountered: