runner.ddc

ddc (derex docker compose) wrappers. These wrappers invoke docker-compose functions to get their job done. They put a docker.compose.yml file in place based on user configuration.

Module Contents

Functions

ddc_parse_args(compose_args: List[str]) → Tuple[List[str], bool]

Given a list of arguments, extract the ones to be passed to docker-compose

ddc_services()

Derex docker-compose: run docker-compose with additional parameters.

ddc_project()

Proxy for docker-compose: writes a docker-compose.yml file with the

check_docker()

run_ddc_services(argv: List[str], dry_run: bool = False, exit_afterwards: bool = False)

Run a docker-compose command relative to the system services.

run_ddc_project(argv: List[str], project: derex.runner.project.Project, dry_run: bool = False, exit_afterwards: bool = False)

Run a docker-compose command relative to a project.

run_django_script(project: Optional[derex.runner.project.Project], script_text: str, context: str = 'lms') → Any

Run a script in a django shell, decode its stdout

runner.ddc.ddc_parse_args(compose_args: List[str])Tuple[List[str], bool][source]

Given a list of arguments, extract the ones to be passed to docker-compose (basically just omit the first one) and return the adjusted list.

Also checks if the –dry-run flag is present, removes it from the list of arguments if it is and returns a 2-tuple like (compose_args, dry_run)

runner.ddc.ddc_services()[source]

Derex docker-compose: run docker-compose with additional parameters. Adds docker compose file paths for services and administrative tools. If the environment variable DEREX_ADMIN_SERVICES is set to a falsey value, only the core ones will be started (mysql, mongodb etc) and the nice-to-have will not (portainer and adminer).

Besides the regular docker-compose options it also accepts the –dry-run option; in case it’s specified docker-compose will not be invoked, but a line will be printed showing what would have been invoked.

runner.ddc.ddc_project()[source]

Proxy for docker-compose: writes a docker-compose.yml file with the configuration of this project, and then run docker-compose on it.

You probably want do run ddc-project up -d and ddc-project logs -f.

runner.ddc.check_docker()[source]
runner.ddc.run_ddc_services(argv: List[str], dry_run: bool = False, exit_afterwards: bool = False)[source]

Run a docker-compose command relative to the system services. Plugin arguments are added to arguments passed in this function sorted by plugin priority.

Used by ddc-services cli command.

runner.ddc.run_ddc_project(argv: List[str], project: derex.runner.project.Project, dry_run: bool = False, exit_afterwards: bool = False)[source]

Run a docker-compose command relative to a project. Plugin arguments are added to arguments passed in this function sorted by plugin priority.

Used by ddc-project cli command.

runner.ddc.run_django_script(project: Optional[derex.runner.project.Project], script_text: str, context: str = 'lms')Any[source]

Run a script in a django shell, decode its stdout with JSON and return it. If the script does not output a parsable JSON None is returned.