Skip to content

cdli.py 0.3.0 revamp (with .env file loading and examples); removal of cdlidev.py

Dependencies

Description

  • cdli.py v0.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 .env file exists in the local (aka /dev/) folder where it will be parsed by Docker Compose, and directs the user gently to look at .env.example if one does not.
      • --dry-run option 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.
      • restart CLI shorthand now uses Docker Compose's restart command directly. This is less confusing, but also changes the behaviour of this command. However, the previous behaviour of calling down and then up was a workaround, better accomplished by something like up --force-recreate (more details below).
      • Docstring cleanup, with more/clearer information in it now.
    • New features:
      • Imported and revised the destroy CLI shorthand from cdlidev.py to allow the user to call Compose's down --volumes but with additional "are you absolutely sure?" confirmation.
      • Added -r / --recreate option for up CLI shorthand to pass up --force-recreate into Compose. This is the idiomatic way to do a "hard-restart" of containers (like the old restart CLI command attempted to accomplish), causing the compose definition and environment variables to be re-evaluated even if nothing has changed.
      • Added build CLI shorthand with -f / --force option to provide shorthand for Compose's build command with/without --no-cache.
  • cdlidev.py removed in favour of cdli.py dev
    • /cdlidev shell script has also been removed.
    • References to cdlidev.py throughout repo documentation and scripts has been replaced with cdli.py dev.
    • setup.sh section 3.2 ("Detecting cdlidev.py status") removed.
      • This was definitely already broken, since the cdlidev.py script hasn't stayed running since Docker Compose v2.
  • Env file handling and explanation:
    • Existing default behaviour of docker compose looking for an .env file in the CWD and project folder is being used.
      • cdli.py always chdirs into /dev/ so /dev/.env would is the sole place docker compose looks by default.
      • As mentioned above, cdli.py checks for this file and notifies the user about its status on start (like it does for config.json)
    • Added /dev/.env ignore patterns to gitignore.
    • Added /dev/.env.examples as a documentation and base .env file 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.examples file.
      • 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.examples as they set up environment injection into containers for any given feature.
Edited by Tim Bellefleur

Merge request reports

Loading