diff --git a/CHANGELOG.md b/CHANGELOG.md index 10852e1..8f1b2eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +Note: Breaking changes between versions are indicated by "💥". + +## Latest + +- 💥[Improvement] Replace the `databases` command by `init`. + ## 3.3.11 (2019-06-07) - [Improvement] Upgrade to ironwood.2 @@ -8,7 +14,7 @@ - [Bugfix] Fix installing a locally cloned requirement repository - [Improvement] Add `--no-cache` option to `images build` - [Improvement] Make it possible to configure the notes service hostname -- [Improvement] Better, more robust MySQL initialization +- [Improvement] Better, more robust MySQL initialisation ## 3.3.10 (2019-05-15) @@ -128,7 +134,7 @@ ## 3.0.1 (2019-02-11) -- [Bugfix] fix mysql initialization (#159, #160) +- [Bugfix] fix mysql initialisation (#159, #160) - [Improvement] Better handling of continuous integration - [Bugfix] fix `tutor --version` (#156) - [Improvement] Absolute settings imports -- 📯 thanks @tonytan4ever! diff --git a/Makefile b/Makefile index 6b82a93..6c4d184 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,7 @@ ci-github: ./releases/github-release ## Upload assets to github ci-images: ## Build and push docker images to hub.docker.com python setup.py develop tutor images build all - tutor local databases + tutor local init docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD" tutor images push all diff --git a/docs/local.rst b/docs/local.rst index b302f35..07ffca9 100644 --- a/docs/local.rst +++ b/docs/local.rst @@ -43,16 +43,16 @@ Update docker images This downloads the latest version of the docker images from `Docker Hub `_. Depending on your bandwidth, this might take a long time. Minor image updates will be incremental, and thus much faster. -Database management -~~~~~~~~~~~~~~~~~~~ +Service initialisation +~~~~~~~~~~~~~~~~~~~~~~ :: - tutor local databases + tutor local init -This command should be run just once. It will create the required databases tables and apply database migrations for all applications. +This command should be run just once. It will initialise all applications: in particular, this will create the required databases tables and apply database migrations for all applications. -If migrations are stopped with a ``Killed`` message, this certainly means the docker containers don't have enough RAM. See the :ref:`troubleshooting` section. +If initialisation is stopped with a ``Killed`` message, this certainly means the docker containers don't have enough RAM. See the :ref:`troubleshooting` section. Running Open edX ~~~~~~~~~~~~~~~~ diff --git a/tutor/commands/k8s.py b/tutor/commands/k8s.py index b5c5717..f57061c 100644 --- a/tutor/commands/k8s.py +++ b/tutor/commands/k8s.py @@ -25,7 +25,7 @@ def quickstart(root, silent): click.echo(fmt.title("Starting the platform")) start.callback(root) click.echo(fmt.title("Database creation and migrations")) - databases.callback(root) + init.callback(root) # TODO https certificates @@ -81,13 +81,13 @@ def delete(root, yes): ) -@click.command(help="Create databases and run database migrations") +@click.command(help="Initialise all applications") @opts.root -def databases(root): +def init(root): # TODO this requires a running mysql/mongodb/elasticsearch. Maybe we should wait until they are up? config = tutor_config.load(root) runner = K8sScriptRunner(root, config) - scripts.migrate(runner) + scripts.initialise(runner) @click.command(help="Create an Open edX user and interactively set their password") @@ -200,7 +200,7 @@ k8s.add_command(quickstart) k8s.add_command(start) k8s.add_command(stop) k8s.add_command(delete) -k8s.add_command(databases) +k8s.add_command(init) k8s.add_command(createuser) k8s.add_command(importdemocourse) k8s.add_command(indexcourses) diff --git a/tutor/commands/local.py b/tutor/commands/local.py index 4f91fb9..ca2eaf2 100644 --- a/tutor/commands/local.py +++ b/tutor/commands/local.py @@ -36,7 +36,7 @@ def quickstart(root, silent, pullimages_): click.echo(fmt.title("Docker image updates")) pullimages.callback(root) click.echo(fmt.title("Database creation and migrations")) - databases.callback(root) + init.callback(root) click.echo(fmt.title("HTTPS certificates generation")) https_create.callback(root) click.echo(fmt.title("Starting the platform in detached mode")) @@ -147,12 +147,12 @@ def execute(root, service, command, args): docker_compose(root, config, *exec_command) -@click.command(help="Create databases and run database migrations") +@click.command(help="Initialise all applications") @opts.root -def databases(root): +def init(root): config = tutor_config.load(root) runner = ScriptRunner(root, config) - scripts.migrate(runner) + scripts.initialise(runner) @click.group(help="Manage https certificates") @@ -328,7 +328,7 @@ local.add_command(stop) local.add_command(restart) local.add_command(run) local.add_command(execute, name="exec") -local.add_command(databases) +local.add_command(init) local.add_command(https) local.add_command(logs) local.add_command(createuser) diff --git a/tutor/plugins.py b/tutor/plugins.py index f7dac9e..52f0da1 100644 --- a/tutor/plugins.py +++ b/tutor/plugins.py @@ -60,7 +60,7 @@ class Patches: def get_callable_attr(plugin, attr_name): attr = getattr(plugin, attr_name, {}) if callable(attr): - # TODO pass config here for initialization + # TODO pass config here for initialisation attr = attr() return attr diff --git a/tutor/scripts.py b/tutor/scripts.py index 5e6f9bb..37e9770 100644 --- a/tutor/scripts.py +++ b/tutor/scripts.py @@ -31,19 +31,19 @@ class BaseRunner: yield from plugins.iter_scripts(self.config, script) -def migrate(runner): - fmt.echo_info("Creating all databases...") +def initialise(runner): + fmt.echo_info("Initialising all services...") runner.run("mysql-client", "scripts", "mysql-client", "init") for service in ["lms", "cms", "forum", "notes", "xqueue"]: if runner.is_activated(service): - fmt.echo_info("Running {} migrations...".format(service)) + fmt.echo_info("Initialising {}...".format(service)) runner.run(service, "scripts", service, "init") for plugin_name, service in runner.iter_plugin_scripts("init"): fmt.echo_info( "Plugin {}: running init for service {}...".format(plugin_name, service) ) runner.run(service, plugin_name, "scripts", service, "init") - fmt.echo_info("Databases ready.") + fmt.echo_info("All services initialised.") def create_user(runner, superuser, staff, username, email): diff --git a/tutor/templates/scripts/mysql-client/init b/tutor/templates/scripts/mysql-client/init index 100ed08..813be0a 100644 --- a/tutor/templates/scripts/mysql-client/init +++ b/tutor/templates/scripts/mysql-client/init @@ -1,4 +1,4 @@ -echo "Initializing MySQL..." +echo "Initialising MySQL..." mysql_connection_max_attempts=10 mysql_connection_attempt=0 until mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'exit' @@ -7,7 +7,7 @@ do echo " [$mysql_connection_attempt/$mysql_connection_max_attempts] Waiting for MySQL service (this may take a while)..." if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ] then - echo "MySQL initialization error" 1>&2 + echo "MySQL initialisation error" 1>&2 exit 1 fi sleep 10