diff --git a/derex/runner/compose_files/docker-compose-admin.yml b/derex/runner/compose_files/docker-compose-admin.yml index 82ca46a9..89ad4513 100644 --- a/derex/runner/compose_files/docker-compose-admin.yml +++ b/derex/runner/compose_files/docker-compose-admin.yml @@ -1,5 +1,4 @@ # Services to monitor/inspect Open edX -version: "3.5" services: adminer: image: adminer:4.7.6 diff --git a/derex/runner/compose_files/docker-compose-services.yml b/derex/runner/compose_files/docker-compose-services.yml index 40b07260..1bd2e796 100644 --- a/derex/runner/compose_files/docker-compose-services.yml +++ b/derex/runner/compose_files/docker-compose-services.yml @@ -1,5 +1,4 @@ # Services needed for Open edX to work -version: "3.5" services: mongodb: image: mongo:3.2.21 diff --git a/derex/runner/compose_utils.py b/derex/runner/compose_utils.py index 33919dc2..aafdd8d5 100644 --- a/derex/runner/compose_utils.py +++ b/derex/runner/compose_utils.py @@ -1,35 +1,34 @@ -from compose.cli.main import main from contextlib import contextmanager from typing import List import click import derex # noqa # This is ugly, but makes mypy and flake8 happy and still performs type checks import logging +import subprocess import sys logger = logging.getLogger(__name__) +def run_compose(compose_argv: List[str]): + subprocess.run(["docker", "compose"] + compose_argv) + + def run_docker_compose( compose_argv: List[str], dry_run: bool = False, exit_afterwards: bool = False ): """Run a docker-compose command with the specified arguments.""" - system_argv = sys.argv - try: - sys.argv = ["docker-compose"] + compose_argv - if not dry_run: - click.echo(f'Running\n{" ".join(sys.argv)}', err=True) - if exit_afterwards: - main() - else: - with exit_cm(): - main() + if not dry_run: + click.echo(f'Running\ndocker compose {" ".join(compose_argv)}', err=True) + if exit_afterwards: + run_compose(compose_argv) else: - click.echo("Would have run:\n") - click.echo(click.style(" ".join(sys.argv), fg="blue")) - finally: - sys.argv = system_argv + with exit_cm(): + run_compose(compose_argv) + else: + click.echo("Would have run:\n") + click.echo(click.style(" ".join(sys.argv), fg="blue")) @contextmanager diff --git a/derex/runner/templates/docker-compose-project.yml.j2 b/derex/runner/templates/docker-compose-project.yml.j2 index 9cf11d08..f90733c7 100644 --- a/derex/runner/templates/docker-compose-project.yml.j2 +++ b/derex/runner/templates/docker-compose-project.yml.j2 @@ -1,6 +1,4 @@ # Open edX services -version: "3.5" - x-common: &common-conf {% if project.runmode.name == "production" -%} @@ -70,8 +68,6 @@ services: <<: *common-env SERVICE_VARIANT: lms container_name: {{ project.name }}_flower - networks: - - derex networks: derex: aliases: diff --git a/derex/runner/templates/docker-compose-test.yml.j2 b/derex/runner/templates/docker-compose-test.yml.j2 index 87e43775..0901f705 100644 --- a/derex/runner/templates/docker-compose-test.yml.j2 +++ b/derex/runner/templates/docker-compose-test.yml.j2 @@ -1,6 +1,4 @@ # Test Open edX services -version: "3.5" - services: cypress: image: cypress/included:6.4.0 diff --git a/requirements.txt b/requirements.txt index 8a2056d6..a24c84fa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,23 +1,15 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile # -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic appdirs==1.4.4 # via derex.runner (setup.py) -attrs==23.1.0 - # via jsonschema -bcrypt==4.0.1 - # via paramiko -certifi==2023.7.22 +certifi==2024.8.30 # via requests -cffi==1.16.0 - # via - # cryptography - # pynacl charset-normalizer==3.3.2 # via requests click==8.1.7 @@ -27,96 +19,53 @@ click==8.1.7 # typer click-plugins==1.1.1 # via derex.runner (setup.py) -cryptography==41.0.5 - # via paramiko -distro==1.8.0 - # via docker-compose -docker[ssh]==6.1.3 - # via docker-compose -docker-compose==1.29.2 - # via derex.runner (setup.py) -dockerpty==0.4.1 - # via docker-compose -docopt==0.6.2 - # via docker-compose -idna==3.4 +idna==3.8 # via requests -importlib-metadata==6.8.0 +importlib-metadata==8.5.0 # via derex.runner (setup.py) -jinja2==3.1.2 +jinja2==3.1.4 # via derex.runner (setup.py) -jsonschema==3.2.0 - # via docker-compose markdown-it-py==3.0.0 # via rich -markupsafe==2.1.3 +markupsafe==2.1.5 # via jinja2 mdurl==0.1.2 # via markdown-it-py -packaging==23.2 - # via docker -paramiko==3.3.1 - # via docker -pluggy==1.3.0 +pluggy==1.5.0 # via derex.runner (setup.py) -pycparser==2.21 - # via cffi -pydantic==2.4.2 +pydantic==2.9.1 # via python-on-whales -pydantic-core==2.10.1 +pydantic-core==2.23.3 # via pydantic -pygments==2.16.1 +pygments==2.18.0 # via rich pymongo==3.13.0 # via derex.runner (setup.py) -pymysql==1.1.0 +pymysql==1.1.1 # via derex.runner (setup.py) -pynacl==1.5.0 - # via paramiko -pyrsistent==0.20.0 - # via jsonschema -python-dotenv==0.21.1 - # via docker-compose -python-on-whales==0.67.0 +python-on-whales==0.73.0 # via derex.runner (setup.py) pyyaml==5.3 - # via - # derex.runner (setup.py) - # docker-compose -requests==2.31.0 - # via - # docker - # docker-compose - # python-on-whales -rich==13.6.0 # via derex.runner (setup.py) -six==1.16.0 +requests==2.32.3 + # via python-on-whales +rich==13.8.1 # via - # dockerpty - # jsonschema - # websocket-client -texttable==1.7.0 - # via docker-compose -tqdm==4.66.1 + # derex.runner (setup.py) + # typer +shellingham==1.5.4 + # via typer +tqdm==4.66.5 # via python-on-whales -typer==0.9.0 +typer==0.12.5 # via python-on-whales -typing-extensions==4.8.0 +typing-extensions==4.12.2 # via # pydantic # pydantic-core # python-on-whales # typer -urllib3==2.0.7 - # via - # docker - # requests -websocket-client==0.59.0 - # via - # docker - # docker-compose -zipp==3.17.0 +urllib3==2.2.3 + # via requests +zipp==3.20.2 # via importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/setup.py b/setup.py index fc034e87..bb441d09 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,6 @@ "appdirs", "Click", "click_plugins", - "docker-compose", "importlib_metadata", "jinja2", "pluggy",