mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-05 23:20:40 +00:00
Get rid of mysql-client container
This has an impact on plugin hooks. Plugin hooks that needed to run inside mysql-client now need to run inside mysql container. This simplifies the deployment, as we no longer have an empty mysql-client container sitting around. When mysql is not enabled (ACTIVATE_MYSQL=False) the mysql container is simply a mysql client.
This commit is contained in:
parent
14dd9e54a9
commit
0c0db78310
@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
|
|||||||
|
|
||||||
## Latest
|
## Latest
|
||||||
|
|
||||||
|
- 💥[Improvement] Get rid of mysql-client container
|
||||||
- [Improvement] Add "local-docker-compose-lms/cms-dependencies" plugin patches
|
- [Improvement] Add "local-docker-compose-lms/cms-dependencies" plugin patches
|
||||||
- [Improvement] Use "exec" instead of "run" to initialise local platform
|
- [Improvement] Use "exec" instead of "run" to initialise local platform
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ class EnvTests(unittest.TestCase):
|
|||||||
config = {}
|
config = {}
|
||||||
tutor_config.merge(config, tutor_config.load_defaults())
|
tutor_config.merge(config, tutor_config.load_defaults())
|
||||||
config["MYSQL_ROOT_PASSWORD"] = "testpassword"
|
config["MYSQL_ROOT_PASSWORD"] = "testpassword"
|
||||||
rendered = env.render_file(config, "hooks", "mysql-client", "init")
|
rendered = env.render_file(config, "hooks", "mysql", "init")
|
||||||
self.assertIn("testpassword", rendered)
|
self.assertIn("testpassword", rendered)
|
||||||
|
|
||||||
@unittest.mock.patch.object(tutor_config.fmt, "echo")
|
@unittest.mock.patch.object(tutor_config.fmt, "echo")
|
||||||
|
@ -41,6 +41,7 @@ def quickstart(root, non_interactive, pullimages_):
|
|||||||
start.callback(root, True, [])
|
start.callback(root, True, [])
|
||||||
click.echo(fmt.title("Database creation and migrations"))
|
click.echo(fmt.title("Database creation and migrations"))
|
||||||
init.callback(root)
|
init.callback(root)
|
||||||
|
echo_platform_info(config)
|
||||||
|
|
||||||
|
|
||||||
@click.command(help="Update docker images")
|
@click.command(help="Update docker images")
|
||||||
@ -62,25 +63,22 @@ def start(root, detach, services):
|
|||||||
config = tutor_config.load(root)
|
config = tutor_config.load(root)
|
||||||
docker_compose(root, config, *command, *services)
|
docker_compose(root, config, *command, *services)
|
||||||
|
|
||||||
if detach:
|
|
||||||
fmt.echo_info("The Open edX platform is now running in detached mode")
|
def echo_platform_info(config):
|
||||||
http = "https" if config["ACTIVATE_HTTPS"] else "http"
|
fmt.echo_info("The Open edX platform is now running in detached mode")
|
||||||
urls = []
|
http = "https" if config["ACTIVATE_HTTPS"] else "http"
|
||||||
if not config["ACTIVATE_HTTPS"] and not config["WEB_PROXY"]:
|
urls = []
|
||||||
urls += ["http://localhost", "http://studio.localhost"]
|
if not config["ACTIVATE_HTTPS"] and not config["WEB_PROXY"]:
|
||||||
urls.append(
|
urls += ["http://localhost", "http://studio.localhost"]
|
||||||
"{http}://{lms_host}".format(http=http, lms_host=config["LMS_HOST"])
|
urls.append("{http}://{lms_host}".format(http=http, lms_host=config["LMS_HOST"]))
|
||||||
)
|
urls.append("{http}://{cms_host}".format(http=http, cms_host=config["CMS_HOST"]))
|
||||||
urls.append(
|
fmt.echo_info(
|
||||||
"{http}://{cms_host}".format(http=http, cms_host=config["CMS_HOST"])
|
"""Your Open edX platform is ready and can be accessed at the following urls:
|
||||||
)
|
|
||||||
fmt.echo_info(
|
|
||||||
"""Your Open edX platform is ready and can be accessed at the following urls:
|
|
||||||
|
|
||||||
{}""".format(
|
{}""".format(
|
||||||
"\n ".join(urls)
|
"\n ".join(urls)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@click.command(help="Stop a running platform")
|
@click.command(help="Stop a running platform")
|
||||||
|
@ -36,7 +36,7 @@ class BaseRunner:
|
|||||||
|
|
||||||
def initialise(runner):
|
def initialise(runner):
|
||||||
fmt.echo_info("Initialising all services...")
|
fmt.echo_info("Initialising all services...")
|
||||||
runner.run("mysql-client", "hooks", "mysql-client", "init")
|
runner.run("mysql", "hooks", "mysql", "init")
|
||||||
for plugin_name, hook in runner.iter_plugin_hooks("pre-init"):
|
for plugin_name, hook in runner.iter_plugin_hooks("pre-init"):
|
||||||
for service in hook:
|
for service in hook:
|
||||||
fmt.echo_info(
|
fmt.echo_info(
|
||||||
|
@ -295,7 +295,6 @@ spec:
|
|||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: mongodb
|
claimName: mongodb
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ACTIVATE_MYSQL %}
|
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
@ -317,7 +316,12 @@ spec:
|
|||||||
containers:
|
containers:
|
||||||
- name: mysql
|
- name: mysql
|
||||||
image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MYSQL }}
|
image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MYSQL }}
|
||||||
|
{% if ACTIVATE_MYSQL %}
|
||||||
args: ["mysqld", "--character-set-server=utf8", "--collation-server=utf8_general_ci"]
|
args: ["mysqld", "--character-set-server=utf8", "--collation-server=utf8_general_ci"]
|
||||||
|
{% else %}
|
||||||
|
command: ["sh", "-e", "-c"]
|
||||||
|
args: ["echo 'ready'; while true; do sleep 60; done"]
|
||||||
|
{% endif %}
|
||||||
env:
|
env:
|
||||||
- name: MYSQL_ROOT_PASSWORD
|
- name: MYSQL_ROOT_PASSWORD
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@ -326,6 +330,7 @@ spec:
|
|||||||
key: MYSQL_ROOT_PASSWORD
|
key: MYSQL_ROOT_PASSWORD
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 3306
|
- containerPort: 3306
|
||||||
|
{% if ACTIVATE_MYSQL %}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /var/lib/mysql
|
- mountPath: /var/lib/mysql
|
||||||
name: data
|
name: data
|
||||||
@ -333,28 +338,7 @@ spec:
|
|||||||
- name: data
|
- name: data
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: mysql
|
claimName: mysql
|
||||||
{% endif %}
|
{% endif %}
|
||||||
---
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: mysql-client
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/name: mysql-client
|
|
||||||
spec:
|
|
||||||
selector:
|
|
||||||
matchLabels:
|
|
||||||
app.kubernetes.io/name: mysql-client
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
app.kubernetes.io/name: mysql-client
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: mysql
|
|
||||||
image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MYSQL }}
|
|
||||||
command: ["sh", "-e", "-c"]
|
|
||||||
args: ["echo 'ready'; while true; do sleep 60; done"]
|
|
||||||
{% if ACTIVATE_SMTP %}
|
{% if ACTIVATE_SMTP %}
|
||||||
---
|
---
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
|
@ -34,8 +34,8 @@ configMapGenerator:
|
|||||||
- name: nginx-config
|
- name: nginx-config
|
||||||
files:{% for file in "apps/nginx"|walk_templates %}
|
files:{% for file in "apps/nginx"|walk_templates %}
|
||||||
- {{ file }}{% endfor %}
|
- {{ file }}{% endfor %}
|
||||||
{% if ACTIVATE_MYSQL %}- name: mysql-config
|
- name: mysql-config
|
||||||
env: apps/mysql/auth.env{% endif %}
|
env: apps/mysql/auth.env
|
||||||
{{ patch("kustomization-configmapgenerator") }}
|
{{ patch("kustomization-configmapgenerator") }}
|
||||||
|
|
||||||
{{ patch("kustomization") }}
|
{{ patch("kustomization") }}
|
@ -19,22 +19,18 @@ services:
|
|||||||
- ../../data/mongodb:/data/db
|
- ../../data/mongodb:/data/db
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if ACTIVATE_MYSQL %}
|
|
||||||
mysql:
|
mysql:
|
||||||
image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MYSQL }}
|
image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MYSQL }}
|
||||||
|
{% if ACTIVATE_MYSQL %}
|
||||||
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
|
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
|
||||||
|
{% else %}
|
||||||
|
entrypoint: ["sh", "-e", "-c"]
|
||||||
|
command: ["echo 'ready'; while true; do sleep 60; done"]
|
||||||
|
{% endif %}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ../../data/mysql:/var/lib/mysql
|
- ../../data/mysql:/var/lib/mysql
|
||||||
env_file: ../apps/mysql/auth.env
|
env_file: ../apps/mysql/auth.env
|
||||||
{% endif %}
|
|
||||||
mysql-client:
|
|
||||||
image: {{ DOCKER_REGISTRY }}{{ DOCKER_IMAGE_MYSQL }}
|
|
||||||
entrypoint: ["sh", "-e", "-c"]
|
|
||||||
command: ["echo 'ready'; while true; do sleep 60; done"]
|
|
||||||
restart: unless-stopped
|
|
||||||
{% if ACTIVATE_MYSQL%}depends_on:
|
|
||||||
- mysql{% endif %}
|
|
||||||
|
|
||||||
{% if ACTIVATE_ELASTICSEARCH %}
|
{% if ACTIVATE_ELASTICSEARCH %}
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
@ -123,11 +119,11 @@ services:
|
|||||||
- ../../data/lms:/openedx/data
|
- ../../data/lms:/openedx/data
|
||||||
- ../../data/openedx-media:/openedx/media
|
- ../../data/openedx-media:/openedx/media
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- mysql
|
||||||
{% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %}
|
{% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %}
|
||||||
{% if ACTIVATE_FORUM %}- forum{% endif %}
|
{% if ACTIVATE_FORUM %}- forum{% endif %}
|
||||||
{% if ACTIVATE_MEMCACHED %}- memcached{% endif %}
|
{% if ACTIVATE_MEMCACHED %}- memcached{% endif %}
|
||||||
{% if ACTIVATE_MONGODB %}- mongodb{% endif %}
|
{% if ACTIVATE_MONGODB %}- mongodb{% endif %}
|
||||||
{% if ACTIVATE_MYSQL %}- mysql{% endif %}
|
|
||||||
{% if ACTIVATE_RABBITMQ %}- rabbitmq{% endif %}
|
{% if ACTIVATE_RABBITMQ %}- rabbitmq{% endif %}
|
||||||
{% if ACTIVATE_SMTP %}- smtp{% endif %}
|
{% if ACTIVATE_SMTP %}- smtp{% endif %}
|
||||||
{{ patch("local-docker-compose-lms-dependencies")|indent(6) }}
|
{{ patch("local-docker-compose-lms-dependencies")|indent(6) }}
|
||||||
@ -147,10 +143,10 @@ services:
|
|||||||
- ../../data/cms:/openedx/data
|
- ../../data/cms:/openedx/data
|
||||||
- ../../data/openedx-media:/openedx/media
|
- ../../data/openedx-media:/openedx/media
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- mysql
|
||||||
{% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %}
|
{% if ACTIVATE_ELASTICSEARCH %}- elasticsearch{% endif %}
|
||||||
{% if ACTIVATE_MEMCACHED %}- memcached{% endif %}
|
{% if ACTIVATE_MEMCACHED %}- memcached{% endif %}
|
||||||
{% if ACTIVATE_MONGODB %}- mongodb{% endif %}
|
{% if ACTIVATE_MONGODB %}- mongodb{% endif %}
|
||||||
{% if ACTIVATE_MYSQL %}- mysql{% endif %}
|
|
||||||
{% if ACTIVATE_RABBITMQ %}- rabbitmq{% endif %}
|
{% if ACTIVATE_RABBITMQ %}- rabbitmq{% endif %}
|
||||||
{% if ACTIVATE_SMTP %}- smtp{% endif %}
|
{% if ACTIVATE_SMTP %}- smtp{% endif %}
|
||||||
{{ patch("local-docker-compose-cms-dependencies")|indent(6) }}
|
{{ patch("local-docker-compose-cms-dependencies")|indent(6) }}
|
||||||
|
Loading…
Reference in New Issue
Block a user