mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-04 19:03:39 +00:00
Make configuration silent (non-interactive) by default
Thus, we remove the -y/--yes options, which were kind of unintuitive, and we add instead `-i/--interactive`. The quickstart commands remain interactive by default, but can be silenced with `-I/--non-interactive`.
This commit is contained in:
parent
18d05fcbbb
commit
bc21102cf4
@ -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)
|
||||
|
4
Makefile
4
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/ \
|
||||
|
@ -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"
|
||||
|
@ -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 <https://hub.docker.com/r/regis/openedx/>`_ docker image from Docker Hub. If you have an account on `hub.docker.com <https://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
|
||||
|
||||
|
@ -21,7 +21,7 @@ How does Tutor work?
|
||||
|
||||
You can experiment with Tutor very quickly: start by `installing <install>`_ 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 ;-)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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"))
|
||||
|
@ -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"))
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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__))
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user