diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f1b2eb..02e6c38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥". ## Latest +- 💥[Improvement] Remove the `-y/--yes` option: `tutor config save` is now non-interactive by default. Use `-i/--interactive` to force interactive mode. - 💥[Improvement] Replace the `databases` command by `init`. ## 3.3.11 (2019-06-07) diff --git a/Makefile b/Makefile index 6c4d184..a992e02 100644 --- a/Makefile +++ b/Makefile @@ -65,8 +65,8 @@ ci-bundle: ## Create bundle and run basic tests mkdir -p releases/ ./dist/tutor --version ./dist/tutor config printroot - yes "" | ./dist/tutor config save - ./dist/tutor config save --yes --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true + yes "" | ./dist/tutor config save --interactive + ./dist/tutor config save --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true ./releases/github-release: ## Download github-release binary cd releases/ \ diff --git a/cloud/aws.sh b/cloud/aws.sh index aad9833..0d1828a 100755 --- a/cloud/aws.sh +++ b/cloud/aws.sh @@ -37,7 +37,7 @@ sudo curl -L "https://github.com/regisb/tutor/releases/download/$TUTOR_VERSION/t sudo chmod +x /usr/local/bin/tutor echo "=============== Pulling vendor docker images" -tutor config save --yes +tutor config save tutor images pull elasticsearch tutor images pull memcached tutor images pull mongodb @@ -65,7 +65,7 @@ docker push localhost:5000/$(tutor config printvalue DOCKER_IMAGE_NGINX) docker push localhost:5000/$(tutor config printvalue DOCKER_IMAGE_RABBITMQ) echo "=============== Building openedx docker images" -tutor config save --yes --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true --set DOCKER_REGISTRY=localhost:5000/ +tutor config save --set ACTIVATE_NOTES=true --set ACTIVATE_XQUEUE=true --set DOCKER_REGISTRY=localhost:5000/ tutor images build all echo "=============== Create Web UI script" diff --git a/docs/configuration.rst b/docs/configuration.rst index 70f08a6..affa83a 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -23,7 +23,7 @@ By default, this file contains only the required configuration parameters for ru Alternatively, you can set each parameter from the command line:: - tutor config save -y --set PARAM1=VALUE1 --set PARAM2=VALUE2 + tutor config save --set PARAM1=VALUE1 --set PARAM2=VALUE2 Or from the system environment:: @@ -139,7 +139,7 @@ SMTP Optional features ~~~~~~~~~~~~~~~~~ -Some optional features may be activated or deactivated during the interactive configuration step (``tutor config save``). +Some optional features may be activated or deactivated during the interactive configuration step (``tutor config save -i``). SSL/TLS certificates for HTTPS access ************************************* @@ -264,7 +264,7 @@ Running a different ``openedx`` Docker image By default, Tutor runs the `regis/openedx `_ docker image from Docker Hub. If you have an account on `hub.docker.com `_ or you have a private image registry, you can build your image and push it to your registry with:: - tutor config save -y --set DOCKER_IMAGE_OPENEDX=myusername/openedx:mytag + tutor config save --set DOCKER_IMAGE_OPENEDX=myusername/openedx:mytag tutor images build openedx tutor images push openedx diff --git a/docs/intro.rst b/docs/intro.rst index bac2dfe..0087790 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -21,7 +21,7 @@ How does Tutor work? You can experiment with Tutor very quickly: start by `installing `_ Tutor. Then run:: - tutor config save + tutor config save --interactive This command does two things: @@ -32,7 +32,7 @@ All these files are stored in a single folder, called the Tutor project root. On The values from ``config.yml`` are used to generate the environment files in ``env/``. As a consequence, **every time the values from** ``config.yml`` **are modified, the environment must be regenerated**. This can be done with:: - tutor config save -y + tutor config save Another consequence is that **any manual change made to a file in** ``env/`` **will be overwritten by** ``tutor config save`` **commands**. Consider yourself warned ;-) diff --git a/docs/local.rst b/docs/local.rst index 07ffca9..07dc59b 100644 --- a/docs/local.rst +++ b/docs/local.rst @@ -28,9 +28,9 @@ Configuration :: - tutor config save + tutor config save --interactive -This is the only non-automatic step in the install process. You will be asked various questions about your Open edX platform and appropriate configuration files will be generated. If you would like to automate this step then you should run ``tutor config save`` once. After that, there will be a ``config.yml`` file at the root of the project folder: this file contains all the configuration values for your platform, such as randomly generated passwords, domain names, etc. +This is the only non-automatic step in the install process. You will be asked various questions about your Open edX platform and appropriate configuration files will be generated. If you would like to automate this step then you should run ``tutor config save --interactive`` once. After that, there will be a ``config.yml`` file at the root of the project folder: this file contains all the configuration values for your platform, such as randomly generated passwords, domain names, etc. If you want to run a fully automated install, upload the ``config.yml`` file to wherever you want to run Open edX. You can then entirely skip the configuration step. @@ -143,7 +143,7 @@ Running Open edX behind a web proxy The containerized web server (nginx) needs to listen to ports 80 and 443 on the host. If there is already a webserver running on the host, such as Apache or Nginx, the nginx container will not be able to start. Tutor supports running behind a web proxy. To do so, add the following configuration:: - tutor config save -y --set WEB_PROXY=true --set NGINX_HTTP_PORT=81 --set NGINX_HTTPS_PORT=444 + tutor config save --set WEB_PROXY=true --set NGINX_HTTP_PORT=81 --set NGINX_HTTPS_PORT=444 In this example, the nginx container ports would be mapped to 81 and 444, instead of 80 and 443. You must then configure the web proxy on the host. Basic configuration files are provided by Tutor which can be used directly by your web proxy. @@ -180,14 +180,14 @@ As an example, here is how to launch two different platforms, with nginx running # platform 1 export TUTOR_ROOT=~/openedx/site1 - tutor config save --set WEB_PROXY=true --set LOCAL_PROJECT_NAME=tutor_site1 --set NGINX_HTTP_PORT=81 --set NGINX_HTTPS_PORT=481 + tutor config save --interactive --set WEB_PROXY=true --set LOCAL_PROJECT_NAME=tutor_site1 --set NGINX_HTTP_PORT=81 --set NGINX_HTTPS_PORT=481 tutor local quickstart sudo ln -s "$(tutor config printroot)/env/local/proxy/nginx/openedx.conf" /etc/nginx/sites-enabled/site1.conf # platform 2 export TUTOR_ROOT=~/openedx/site2 - tutor config save --set WEB_PROXY=true --set LOCAL_PROJECT_NAME=tutor_site2 --set NGINX_HTTP_PORT=82 --set NGINX_HTTPS_PORT=482 + tutor config save --interactive --set WEB_PROXY=true --set LOCAL_PROJECT_NAME=tutor_site2 --set NGINX_HTTP_PORT=82 --set NGINX_HTTPS_PORT=482 tutor local quickstart sudo ln -s "$(tutor config printroot)/env/local/proxy/nginx/openedx.conf" /etc/nginx/sites-enabled/site2.conf diff --git a/plugins/minio/README.rst b/plugins/minio/README.rst index 2035d1f..a3d56db 100644 --- a/plugins/minio/README.rst +++ b/plugins/minio/README.rst @@ -3,7 +3,7 @@ TODO - This is mainly for production. Does not work with `tutor dev` commands. - For local testing, you need to set MINIO_HOST to minio.localhost: - tutor config save -y --set MINIO_HOST=minio.localhost + tutor config save --set MINIO_HOST=minio.localhost - You need `minio.LMS_HOST` domain name. For local development, the MinIO admin dashboard is at minio.localhost. For authentication, use MINIO_ACCESS_KEY and MINIO_SECRET_KEY: diff --git a/tutor/commands/config.py b/tutor/commands/config.py index c60f3e7..47d84ba 100644 --- a/tutor/commands/config.py +++ b/tutor/commands/config.py @@ -4,7 +4,7 @@ from .. import config as tutor_config from .. import env from .. import exceptions from .. import fmt -from .. import interactive +from .. import interactive as interactive_config from .. import opts @@ -19,12 +19,10 @@ def config_command(): @click.command(help="Create and save configuration interactively") @opts.root -@click.option("-y", "--yes", "silent1", is_flag=True, help="Run non-interactively") -@click.option("--silent", "silent2", is_flag=True, hidden=True) +@click.option("-i", "--interactive", is_flag=True, help="Run interactively") @opts.key_value -def save(root, silent1, silent2, set_): - silent = silent1 or silent2 - config, defaults = interactive.load_all(root, silent=silent) +def save(root, interactive, set_): + config, defaults = interactive_config.load_all(root, interactive=interactive) if set_: tutor_config.merge(config, dict(set_), force=True) tutor_config.save(root, config) diff --git a/tutor/commands/k8s.py b/tutor/commands/k8s.py index f57061c..47573b0 100644 --- a/tutor/commands/k8s.py +++ b/tutor/commands/k8s.py @@ -3,7 +3,7 @@ import click from .. import config as tutor_config from .. import env as tutor_env from .. import fmt -from .. import interactive +from .. import interactive as interactive_config from .. import opts from .. import scripts from .. import utils @@ -16,10 +16,10 @@ def k8s(): @click.command(help="Configure and run Open edX from scratch") @opts.root -@click.option("-y", "--yes", "silent", is_flag=True, help="Run non-interactively") -def quickstart(root, silent): +@click.option("-I", "--non-interactive", is_flag=True, help="Run non-interactively") +def quickstart(root, non_interactive): click.echo(fmt.title("Interactive platform configuration")) - config = interactive.update(root, silent=silent) + config = interactive_config.update(root, interactive=(not non_interactive)) click.echo(fmt.title("Updating the current environment")) tutor_env.save(root, config) click.echo(fmt.title("Starting the platform")) diff --git a/tutor/commands/local.py b/tutor/commands/local.py index ca2eaf2..8b12973 100644 --- a/tutor/commands/local.py +++ b/tutor/commands/local.py @@ -5,7 +5,7 @@ import click from .. import config as tutor_config from .. import env as tutor_env from .. import fmt -from .. import interactive +from .. import interactive as interactive_config from .. import opts from .. import scripts from .. import utils @@ -21,13 +21,13 @@ def local(): @click.command(help="Configure and run Open edX from scratch") @opts.root -@click.option("-y", "--yes", "silent", is_flag=True, help="Run non-interactively") +@click.option("-I", "--non-interactive", is_flag=True, help="Run non-interactively") @click.option( "-p", "--pullimages", "pullimages_", is_flag=True, help="Update docker images" ) -def quickstart(root, silent, pullimages_): +def quickstart(root, non_interactive, pullimages_): click.echo(fmt.title("Interactive platform configuration")) - config = interactive.update(root, silent=silent) + config = interactive_config.update(root, interactive=(not non_interactive)) click.echo(fmt.title("Updating the current environment")) tutor_env.save(root, config) click.echo(fmt.title("Stopping any existing platform")) diff --git a/tutor/config.py b/tutor/config.py index ef22bb6..345ece0 100644 --- a/tutor/config.py +++ b/tutor/config.py @@ -181,7 +181,7 @@ def check_existing_config(root): """ if not os.path.exists(config_path(root)): raise exceptions.TutorError( - "Project root does not exist. Make sure to generate the initial configuration with `tutor config save` or `tutor config quickstart` prior to running other commands." + "Project root does not exist. Make sure to generate the initial configuration with `tutor config save --interactive` or `tutor config quickstart` prior to running other commands." ) env.check_is_up_to_date(root) diff --git a/tutor/env.py b/tutor/env.py index 7ef46f4..3511766 100644 --- a/tutor/env.py +++ b/tutor/env.py @@ -191,7 +191,7 @@ def check_is_up_to_date(root): "v{} while the 'tutor' binary is at v{}. You should upgrade " "the environment by running:\n" "\n" - " tutor config save -y" + " tutor config save" ) fmt.echo_alert(message.format(base_dir(root), version(root), __version__)) diff --git a/tutor/interactive.py b/tutor/interactive.py index 53d2d0c..02d2bab 100644 --- a/tutor/interactive.py +++ b/tutor/interactive.py @@ -8,17 +8,17 @@ from . import fmt from .__about__ import __version__ -def update(root, silent=False): +def update(root, interactive=True): """ Load and save the configuration. """ - config, defaults = load_all(root, silent=silent) + config, defaults = load_all(root, interactive=interactive) tutor_config.save(root, config) tutor_config.merge(config, defaults) return config -def load_all(root, silent=False): +def load_all(root, interactive=True): """ Load configuration and interactively ask questions to collect param values from the user. """ @@ -27,7 +27,7 @@ def load_all(root, silent=False): if os.path.exists(tutor_config.config_path(root)): config = tutor_config.load_current(root, defaults) - if not silent: + if interactive: ask_questions(config, defaults) return config, defaults