From 5a24056b8e8078e39cdda6b02ff66dc84f3258bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 3 Sep 2019 09:29:38 +0200 Subject: [PATCH] Switch from "run" to "exec" for local initialisation We ran into an issue when trying to run migrations when the MinIO plugin is activated. As seen in issues #243 and #244, the certificates.0003_data__default_modes migration requires access to MinIO. To do so, the MinIO host must be reached. That means that SSL certificates must be in place (if https is enabled) and that the nginx server must be booted. However, it does not make sense to require that the minio container depends on the nginx container. So, in effect, we need a fully working platform to run migrations. In a sense, this is better as it harmonises the init task with k8s: in k8s, init was already run with exec. Next step is to get rid of these ugly mysql-client/minio-client containers that must be up at all times. It would be much simpler to just exec the commands inside the mysql/minio containers. --- CHANGELOG.md | 4 ++++ tutor/commands/local.py | 17 +++++------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a8ea44..d055ead 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Note: Breaking changes between versions are indicated by "💥". +## Latest + +- [Improvement] Use "exec" instead of "run" to initialise local platform + ## 3.6.3 (2019-08-31) - [Security] Fix CustomTagModule mako template injection diff --git a/tutor/commands/local.py b/tutor/commands/local.py index f6808bb..9903868 100644 --- a/tutor/commands/local.py +++ b/tutor/commands/local.py @@ -32,15 +32,15 @@ def quickstart(root, non_interactive, pullimages_): tutor_env.save(root, config) click.echo(fmt.title("Stopping any existing platform")) stop.callback(root, []) + click.echo(fmt.title("HTTPS certificates generation")) + https_create.callback(root) if pullimages_: click.echo(fmt.title("Docker image updates")) pullimages.callback(root) - click.echo(fmt.title("Database creation and migrations")) - init.callback(root) - click.echo(fmt.title("HTTPS certificates generation")) - https_create.callback(root) click.echo(fmt.title("Starting the platform in detached mode")) start.callback(root, True, []) + click.echo(fmt.title("Database creation and migrations")) + init.callback(root) @click.command(help="Update docker images") @@ -330,14 +330,7 @@ def portainer(root, port): class ScriptRunner(scripts.BaseRunner): def exec(self, service, command): docker_compose( - self.root, - self.config, - "run", - "--rm", - "--entrypoint", - "sh -e -c", - service, - command, + self.root, self.config, "exec", service, "sh", "-e", "-c", command )