mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-08 16:14:08 +00:00
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:
parent
6a68c4cc20
commit
18d05fcbbb
10
CHANGELOG.md
10
CHANGELOG.md
@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
Note: Breaking changes between versions are indicated by "💥".
|
||||||
|
|
||||||
|
## Latest
|
||||||
|
|
||||||
|
- 💥[Improvement] Replace the `databases` command by `init`.
|
||||||
|
|
||||||
## 3.3.11 (2019-06-07)
|
## 3.3.11 (2019-06-07)
|
||||||
|
|
||||||
- [Improvement] Upgrade to ironwood.2
|
- [Improvement] Upgrade to ironwood.2
|
||||||
@ -8,7 +14,7 @@
|
|||||||
- [Bugfix] Fix installing a locally cloned requirement repository
|
- [Bugfix] Fix installing a locally cloned requirement repository
|
||||||
- [Improvement] Add `--no-cache` option to `images build`
|
- [Improvement] Add `--no-cache` option to `images build`
|
||||||
- [Improvement] Make it possible to configure the notes service hostname
|
- [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)
|
## 3.3.10 (2019-05-15)
|
||||||
|
|
||||||
@ -128,7 +134,7 @@
|
|||||||
|
|
||||||
## 3.0.1 (2019-02-11)
|
## 3.0.1 (2019-02-11)
|
||||||
|
|
||||||
- [Bugfix] fix mysql initialization (#159, #160)
|
- [Bugfix] fix mysql initialisation (#159, #160)
|
||||||
- [Improvement] Better handling of continuous integration
|
- [Improvement] Better handling of continuous integration
|
||||||
- [Bugfix] fix `tutor --version` (#156)
|
- [Bugfix] fix `tutor --version` (#156)
|
||||||
- [Improvement] Absolute settings imports -- 📯 thanks @tonytan4ever!
|
- [Improvement] Absolute settings imports -- 📯 thanks @tonytan4ever!
|
||||||
|
2
Makefile
2
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
|
ci-images: ## Build and push docker images to hub.docker.com
|
||||||
python setup.py develop
|
python setup.py develop
|
||||||
tutor images build all
|
tutor images build all
|
||||||
tutor local databases
|
tutor local init
|
||||||
docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD"
|
docker login -u "$$DOCKER_USERNAME" -p "$$DOCKER_PASSWORD"
|
||||||
tutor images push all
|
tutor images push all
|
||||||
|
|
||||||
|
@ -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.
|
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
|
Running Open edX
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
@ -25,7 +25,7 @@ def quickstart(root, silent):
|
|||||||
click.echo(fmt.title("Starting the platform"))
|
click.echo(fmt.title("Starting the platform"))
|
||||||
start.callback(root)
|
start.callback(root)
|
||||||
click.echo(fmt.title("Database creation and migrations"))
|
click.echo(fmt.title("Database creation and migrations"))
|
||||||
databases.callback(root)
|
init.callback(root)
|
||||||
# TODO https certificates
|
# 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
|
@opts.root
|
||||||
def databases(root):
|
def init(root):
|
||||||
# TODO this requires a running mysql/mongodb/elasticsearch. Maybe we should wait until they are up?
|
# TODO this requires a running mysql/mongodb/elasticsearch. Maybe we should wait until they are up?
|
||||||
config = tutor_config.load(root)
|
config = tutor_config.load(root)
|
||||||
runner = K8sScriptRunner(root, config)
|
runner = K8sScriptRunner(root, config)
|
||||||
scripts.migrate(runner)
|
scripts.initialise(runner)
|
||||||
|
|
||||||
|
|
||||||
@click.command(help="Create an Open edX user and interactively set their password")
|
@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(start)
|
||||||
k8s.add_command(stop)
|
k8s.add_command(stop)
|
||||||
k8s.add_command(delete)
|
k8s.add_command(delete)
|
||||||
k8s.add_command(databases)
|
k8s.add_command(init)
|
||||||
k8s.add_command(createuser)
|
k8s.add_command(createuser)
|
||||||
k8s.add_command(importdemocourse)
|
k8s.add_command(importdemocourse)
|
||||||
k8s.add_command(indexcourses)
|
k8s.add_command(indexcourses)
|
||||||
|
@ -36,7 +36,7 @@ def quickstart(root, silent, pullimages_):
|
|||||||
click.echo(fmt.title("Docker image updates"))
|
click.echo(fmt.title("Docker image updates"))
|
||||||
pullimages.callback(root)
|
pullimages.callback(root)
|
||||||
click.echo(fmt.title("Database creation and migrations"))
|
click.echo(fmt.title("Database creation and migrations"))
|
||||||
databases.callback(root)
|
init.callback(root)
|
||||||
click.echo(fmt.title("HTTPS certificates generation"))
|
click.echo(fmt.title("HTTPS certificates generation"))
|
||||||
https_create.callback(root)
|
https_create.callback(root)
|
||||||
click.echo(fmt.title("Starting the platform in detached mode"))
|
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)
|
docker_compose(root, config, *exec_command)
|
||||||
|
|
||||||
|
|
||||||
@click.command(help="Create databases and run database migrations")
|
@click.command(help="Initialise all applications")
|
||||||
@opts.root
|
@opts.root
|
||||||
def databases(root):
|
def init(root):
|
||||||
config = tutor_config.load(root)
|
config = tutor_config.load(root)
|
||||||
runner = ScriptRunner(root, config)
|
runner = ScriptRunner(root, config)
|
||||||
scripts.migrate(runner)
|
scripts.initialise(runner)
|
||||||
|
|
||||||
|
|
||||||
@click.group(help="Manage https certificates")
|
@click.group(help="Manage https certificates")
|
||||||
@ -328,7 +328,7 @@ local.add_command(stop)
|
|||||||
local.add_command(restart)
|
local.add_command(restart)
|
||||||
local.add_command(run)
|
local.add_command(run)
|
||||||
local.add_command(execute, name="exec")
|
local.add_command(execute, name="exec")
|
||||||
local.add_command(databases)
|
local.add_command(init)
|
||||||
local.add_command(https)
|
local.add_command(https)
|
||||||
local.add_command(logs)
|
local.add_command(logs)
|
||||||
local.add_command(createuser)
|
local.add_command(createuser)
|
||||||
|
@ -60,7 +60,7 @@ class Patches:
|
|||||||
def get_callable_attr(plugin, attr_name):
|
def get_callable_attr(plugin, attr_name):
|
||||||
attr = getattr(plugin, attr_name, {})
|
attr = getattr(plugin, attr_name, {})
|
||||||
if callable(attr):
|
if callable(attr):
|
||||||
# TODO pass config here for initialization
|
# TODO pass config here for initialisation
|
||||||
attr = attr()
|
attr = attr()
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
|
@ -31,19 +31,19 @@ class BaseRunner:
|
|||||||
yield from plugins.iter_scripts(self.config, script)
|
yield from plugins.iter_scripts(self.config, script)
|
||||||
|
|
||||||
|
|
||||||
def migrate(runner):
|
def initialise(runner):
|
||||||
fmt.echo_info("Creating all databases...")
|
fmt.echo_info("Initialising all services...")
|
||||||
runner.run("mysql-client", "scripts", "mysql-client", "init")
|
runner.run("mysql-client", "scripts", "mysql-client", "init")
|
||||||
for service in ["lms", "cms", "forum", "notes", "xqueue"]:
|
for service in ["lms", "cms", "forum", "notes", "xqueue"]:
|
||||||
if runner.is_activated(service):
|
if runner.is_activated(service):
|
||||||
fmt.echo_info("Running {} migrations...".format(service))
|
fmt.echo_info("Initialising {}...".format(service))
|
||||||
runner.run(service, "scripts", service, "init")
|
runner.run(service, "scripts", service, "init")
|
||||||
for plugin_name, service in runner.iter_plugin_scripts("init"):
|
for plugin_name, service in runner.iter_plugin_scripts("init"):
|
||||||
fmt.echo_info(
|
fmt.echo_info(
|
||||||
"Plugin {}: running init for service {}...".format(plugin_name, service)
|
"Plugin {}: running init for service {}...".format(plugin_name, service)
|
||||||
)
|
)
|
||||||
runner.run(service, plugin_name, "scripts", service, "init")
|
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):
|
def create_user(runner, superuser, staff, username, email):
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
echo "Initializing MySQL..."
|
echo "Initialising MySQL..."
|
||||||
mysql_connection_max_attempts=10
|
mysql_connection_max_attempts=10
|
||||||
mysql_connection_attempt=0
|
mysql_connection_attempt=0
|
||||||
until mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'exit'
|
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)..."
|
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 ]
|
if [ $mysql_connection_attempt -eq $mysql_connection_max_attempts ]
|
||||||
then
|
then
|
||||||
echo "MySQL initialization error" 1>&2
|
echo "MySQL initialisation error" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sleep 10
|
sleep 10
|
||||||
|
Loading…
Reference in New Issue
Block a user