6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +00:00

fix: compose error on "dev --mount=learning:..."

When mounting a directory in a dev-only container, such as the
"learning" mfe, docker-compose is failing because it is attempting to
run "docker-compose stop" in the local context -- which knows nothing
about the learning container.

To resolve this, we store tmp volumes either in the local or dev
docker-compose.yml, and load either one depending on the context.
This commit is contained in:
Régis Behmo 2022-04-26 14:11:26 +01:00
parent 75ed5b4609
commit 514e3fce22
4 changed files with 6 additions and 2 deletions

View File

@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
## Unreleased
- [Fix] "The Compose file is invalid" error on mounting dev-only folders.
- [Fix] CMS settings in development.
## v13.2.0 (2022-04-24)

View File

@ -19,6 +19,7 @@ class ComposeJobRunner(jobs.BaseComposeJobRunner):
self.project_name = ""
self.docker_compose_files: t.List[str] = []
self.docker_compose_job_files: t.List[str] = []
self.docker_compose_tmp_path = ""
def docker_compose(self, *command: str) -> int:
"""

View File

@ -18,10 +18,11 @@ class DevJobRunner(compose.ComposeJobRunner):
"""
super().__init__(root, config)
self.project_name = get_typed(self.config, "DEV_PROJECT_NAME", str)
self.docker_compose_tmp_path = tutor_env.pathjoin(self.root, "dev", "docker-compose.tmp.yml")
self.docker_compose_files += [
tutor_env.pathjoin(self.root, "local", "docker-compose.yml"),
tutor_env.pathjoin(self.root, "dev", "docker-compose.yml"),
tutor_env.pathjoin(self.root, "local", "docker-compose.tmp.yml"),
self.docker_compose_tmp_path,
tutor_env.pathjoin(self.root, "local", "docker-compose.override.yml"),
tutor_env.pathjoin(self.root, "dev", "docker-compose.override.yml"),
]

View File

@ -20,10 +20,11 @@ class LocalJobRunner(compose.ComposeJobRunner):
"""
super().__init__(root, config)
self.project_name = get_typed(self.config, "LOCAL_PROJECT_NAME", str)
self.docker_compose_tmp_path = tutor_env.pathjoin(self.root, "dev", "docker-compose.tmp.yml")
self.docker_compose_files += [
tutor_env.pathjoin(self.root, "local", "docker-compose.yml"),
tutor_env.pathjoin(self.root, "local", "docker-compose.prod.yml"),
tutor_env.pathjoin(self.root, "local", "docker-compose.tmp.yml"),
self.docker_compose_tmp_path,
tutor_env.pathjoin(self.root, "local", "docker-compose.override.yml"),
]
self.docker_compose_job_files += [