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.
This commit is contained in:
Régis Behmo 2019-09-03 09:29:38 +02:00
parent 88d94bcc24
commit 5a24056b8e
2 changed files with 9 additions and 12 deletions

View File

@ -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

View File

@ -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
)