cdli.py 0.3.0 revamp (with .env file loading and examples); removal of cdlidev.py
Dependencies
- Replaces !1070 (closed)
- Resolves #336
- Unblocks !1071
Description
-
cdli.pyv0.3.0- Changes & Improvements:
- Works on Python 3.5+ with zero external dependencies (except docopt which is now added directly to the repo).
- Validates the Docker Compose v2 is available on start.
- On startup, notifies about whether an
.envfile exists in the local (aka/dev/) folder where it will be parsed by Docker Compose, and directs the user gently to look at.env.exampleif one does not. -
--dry-runoption now uses Docker Compose's "Dry Run" mode, which should be much more descriptive about what a given command will do than just printing the command line. -
restartCLI shorthand now uses Docker Compose'srestartcommand directly. This is less confusing, but also changes the behaviour of this command. However, the previous behaviour of callingdownand thenupwas a workaround, better accomplished by something likeup --force-recreate(more details below). - Docstring cleanup, with more/clearer information in it now.
- New features:
- Imported and revised the
destroyCLI shorthand fromcdlidev.pyto allow the user to call Compose'sdown --volumesbut with additional "are you absolutely sure?" confirmation. - Added
-r / --recreateoption forupCLI shorthand to passup --force-recreateinto Compose. This is the idiomatic way to do a "hard-restart" of containers (like the oldrestartCLI command attempted to accomplish), causing the compose definition and environment variables to be re-evaluated even if nothing has changed. - Added
buildCLI shorthand with-f / --forceoption to provide shorthand for Compose'sbuildcommand with/without--no-cache.
- Imported and revised the
- Changes & Improvements:
-
cdlidev.pyremoved in favour ofcdli.py dev-
/cdlidevshell script has also been removed. - References to
cdlidev.pythroughout repo documentation and scripts has been replaced withcdli.py dev. -
setup.shsection 3.2 ("Detecting cdlidev.py status") removed.- This was definitely already broken, since the
cdlidev.pyscript hasn't stayed running since Docker Compose v2.
- This was definitely already broken, since the
-
- Env file handling and explanation:
- Existing default behaviour of
docker composelooking for an.envfile in the CWD and project folder is being used.-
cdli.pyalways chdirs into/dev/so/dev/.envwould is the sole placedocker composelooks by default. - As mentioned above,
cdli.pychecks for this file and notifies the user about its status on start (like it does forconfig.json)
-
- Added
/dev/.envignore patterns to gitignore. - Added
/dev/.env.examplesas a documentation and base.envfile that can be populated with fields/comments that might need to be set by users.- Optional and required env vars for !1071 are already in the
.env.examplesfile. - Once this is merged, we should encourage devs to add variable names and explanations (without the actual secret values, of course) to the bottom of
.env.examplesas they set up environment injection into containers for any given feature.
- Optional and required env vars for !1071 are already in the
- Existing default behaviour of
Edited by Tim Bellefleur