Replace `databases` command by `init`.

Since initialisation does not only refer to database migrations, it
makes more sense to rename this command.
This commit is contained in:
Régis Behmo 2019-06-05 19:28:06 +02:00
parent 6a68c4cc20
commit 18d05fcbbb
8 changed files with 31 additions and 25 deletions

View File

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

View File

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

View File

@ -43,16 +43,16 @@ Update docker images
This downloads the latest version of the docker images from `Docker Hub <https://hub.docker.com/r/regis/openedx/>`_. 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
~~~~~~~~~~~~~~~~

View File

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

View File

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

View File

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

View File

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

View File

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