feat(prepare-compose): compose file picker#1135
Open
keithy wants to merge 5 commits intonextlevelbuilder:mainfrom
Open
feat(prepare-compose): compose file picker#1135keithy wants to merge 5 commits intonextlevelbuilder:mainfrom
keithy wants to merge 5 commits intonextlevelbuilder:mainfrom
Conversation
- Remove compose.d/ and compose.options/ symlink directories - New prepare-compose.sh with --generate, --edit, --update, --check flags - Uses .env-compose for file selection (uncomment = enabled) - Sections: ROOT (required), SERVICE (optional), OVERLAY (optional) - Detection by services:/networks:/volumes: content + naming (. = service, + = overlay) - Validates with compose config via DOCKER_CMD (default: docker) - Rename postgres-low-cpu.yml to postgres+low-cpu.yml
Auto-runs --check and --update after copying the file
Order: --generate, --edit, --update, --check do_edit now calls do_update then do_check after editor saves
Replaces verbose write_compose_file with generic update_env(key, value) that's more readable and reusable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Having used a variety of schemes for managing the COMPOSE_FILE value, the symlink file method becomes cumbersome when you want to change the root docker-compose.yml file for an alternative implementation. The previous GOCLAW_MODULES env var approach is no longer generic and doesn't help the user with discovery of additional modules. Another option would be to write a bespoke tui picker, but that just seems like overkill for such a simple configuration item. These options dont easily ship with presets or examples.
Using a single bash script that offers the user the ability to edit an intermediary file, adds module discover-ability, and retains the same functionality. This one script is clean and simple.
It is also a generic approach that can be adopted by other compose oriented projects.
compose.d/andcompose.options/symlink directories (tidier).env-composefile-based selection uncomment to enable files. (effectively a tmpfile)services:/networks:/volumes:) + naming (.= service,+= overlay)--generate,--edit,--update,--check,--filedocker/podman compose configviaDOCKER_CMDpostgres-low-cpu.yml→postgres+low-cpu.ymlOptions
--generate.env-composefrom available compose files--edit.env-composein$EDITOR, then apply to.env--update.env-composeto.env--check$DOCKER_CMD(default: docker)--file <f><f>to.env-compose, auto-runs--check+--updateTest plan
prepare-compose.sh --generatecreates.env-composeprepare-compose.sh --editopens editor and appliesprepare-compose.sh --checkvalidates with compose configprepare-compose.sh --file <f>copies file, checks, and updates