Skip to content

Commit

Permalink
Merge branch 'master' into nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
regisb committed Aug 16, 2023
2 parents 1e0f714 + 2a47100 commit 021a305
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 26 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ instructions, because git commits are used to generate release notes:

<!-- scriv-insert-here -->

<a id='changelog-16.0.5'></a>
## v16.0.5 (2023-08-09)

- [Improvement] Upgrade the Open edX default version to open-release/palm.2. (by @regisb)

<a id='changelog-16.0.4'></a>
## v16.0.4 (2023-08-03)

Expand Down Expand Up @@ -248,6 +253,7 @@ pen-release/palm.master --repo-dir=test-course/course`. (by @regisb)
- [Bugfix] Build openedx-dev Docker image even when the host user is root, for instance on Windows. (by @regisb)
- [Bugfix] Patch nutmeg.1 release with [LTI 1.3 fix](https://github.com/openedx/edx-platform/pull/30716). (by @ormsbee)
- [Improvement] Make it possible to override k8s resources in plugins using `k8s-override` patch. (by @foadlind)
- [Bugfix] Fix a race condition that could prevent a newly provisioned Studio container from starting due to a FileExistsError when creating logs directory.

## v14.0.2 (2022-06-27)

Expand Down
4 changes: 4 additions & 0 deletions changelog.d/20230731_110301_regis_fix_non_buildkit_build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [Improvement] Improve support of legacy non-BuildKit mode: (by @regisb)
- [Bugfix] Fix building of openedx Docker image.
- [Improvement] Remove `--cache-from` build option.
- [Improvement] Add a warning concerning the lack of support of the `--build-context` option.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- 💥[Bugfix] Fix mysql crash after upgrade to Palm. After an upgrade to Palm, the mysql client run by Django defaults to a utf8mb4 character set and collation, but the mysql server still runs with utf8mb3. This causes broken data during migration from Olive to Palm, and more generally when data is written to the database. To resolve this issue, we explicitely set the utf8mb3 charset and collation in the client. Users who were running Palm might have to fix their data manually. In the future we will upgrade the mysql server to utf8mb4. (by @regisb)
- [Improvement] We upgrade to MySQL 8.1.0 to avoid having to restart the server after the upgrade.
1 change: 1 addition & 0 deletions changelog.d/20230816_184458_regis_fix_local_non_prod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Bugfix] Ask whether user wants to run locally during `tutor local launch`. (by @regisb)
4 changes: 2 additions & 2 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This configuration parameter defines which MongoDB Docker image to use.

.. https://hub.docker.com/_/mysql/tags?page=1&name=8.0
- ``DOCKER_IMAGE_MYSQL`` (default: ``"docker.io/mysql:8.0.33"``)
- ``DOCKER_IMAGE_MYSQL`` (default: ``"docker.io/mysql:8.1.0"``)

This configuration parameter defines which MySQL Docker image to use.

Expand Down Expand Up @@ -136,7 +136,7 @@ Open edX customisation

This defines the git repository from which you install Open edX platform code. If you run an Open edX fork with custom patches, set this to your own git repository. You may also override this configuration parameter at build time, by providing a ``--build-arg`` option.

- ``OPENEDX_COMMON_VERSION`` (default: ``"open-release/palm.1"``)
- ``OPENEDX_COMMON_VERSION`` (default: ``"open-release/palm.2"``)

This defines the default version that will be pulled from all Open edX git repositories.

Expand Down
3 changes: 1 addition & 2 deletions tests/commands/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_images_pull_all_vendor_images(self, image_pull: Mock) -> None:
self.assertIsNone(result.exception)
self.assertEqual(0, result.exit_code)
# Note: we should update this tag whenever the mysql image is updated
image_pull.assert_called_once_with("docker.io/mysql:8.0.33")
image_pull.assert_called_once_with("docker.io/mysql:8.1.0")

def test_images_printtag_image(self) -> None:
result = self.invoke(["images", "printtag", "openedx"])
Expand Down Expand Up @@ -147,7 +147,6 @@ def test_images_build_plugin_with_args(self, image_build: Mock) -> None:
"--target",
"target",
"docker_args",
"--cache-from=type=registry,ref=service1:1.0.0-cache",
],
list(image_build.call_args[0][1:]),
)
Expand Down
2 changes: 1 addition & 1 deletion tutor/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Increment this version number to trigger a new release. See
# docs/tutor.html#versioning for information on the versioning scheme.
__version__ = "16.0.4"
__version__ = "16.0.5"

# The version suffix will be appended to the actual version, separated by a
# dash. Use this suffix to differentiate between the actual released version and
Expand Down
10 changes: 5 additions & 5 deletions tutor/commands/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ def launch(
skip_build: bool,
) -> None:
context_name = context.obj.NAME
run_for_prod = context_name != "dev"
run_for_prod = False if context_name == "dev" else None

utils.warn_macos_docker_memory()

# Upgrade has to run before configuration
interactive_upgrade(context, not non_interactive, run_for_prod)
interactive_configuration(context, not non_interactive, run_for_prod)
interactive_upgrade(context, not non_interactive, run_for_prod=run_for_prod)
interactive_configuration(context, not non_interactive, run_for_prod=run_for_prod)

config = tutor_config.load(context.obj.root)

Expand Down Expand Up @@ -136,7 +136,7 @@ def launch(


def interactive_upgrade(
context: click.Context, interactive: bool, run_for_prod: bool
context: click.Context, interactive: bool, run_for_prod: t.Optional[bool]
) -> None:
"""
Piece of code that is only used in launch.
Expand Down Expand Up @@ -187,7 +187,7 @@ def interactive_upgrade(


def interactive_configuration(
context: click.Context, interactive: bool, run_for_prod: bool
context: click.Context, interactive: bool, run_for_prod: t.Optional[bool] = None
) -> None:
click.echo(fmt.title("Interactive platform configuration"))
config = tutor_config.load_minimal(context.obj.root)
Expand Down
28 changes: 18 additions & 10 deletions tutor/commands/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,27 @@ def build(
image_build_args = [*command_args, *custom_args]

# Registry cache
if not no_registry_cache:
image_build_args.append(f"--cache-from=type=registry,ref={tag}-cache")
if cache_to_registry:
image_build_args.append(
f"--cache-to=type=registry,mode=max,ref={tag}-cache"
)
if utils.is_buildkit_enabled():
if not no_registry_cache:
image_build_args.append(
f"--cache-from=type=registry,ref={tag}-cache"
)
if cache_to_registry:
image_build_args.append(
f"--cache-to=type=registry,mode=max,ref={tag}-cache"
)

# Build contexts
for host_path, stage_name in build_contexts.get(name, []):
image_build_args.append(f"--build-context={stage_name}={host_path}")
if utils.is_buildkit_enabled():
fmt.echo_info(
f"Adding {host_path} to the build context '{stage_name}' of image '{image}'"
)
image_build_args.append(f"--build-context={stage_name}={host_path}")
else:
fmt.echo_alert(
f"Unable to add {host_path} to the build context '{stage_name}' of image '{host_path}' because BuildKit is disabled."
)

# Build
images.build(
Expand All @@ -257,9 +268,6 @@ def get_image_build_contexts(config: Config) -> dict[str, list[tuple[str, str]]]
for image_name, stage_name in hooks.Filters.IMAGES_BUILD_MOUNTS.iterate(
user_mount
):
fmt.echo_info(
f"Adding {user_mount} to the build context '{stage_name}' of image '{image_name}'"
)
if image_name not in build_contexts:
build_contexts[image_name] = []
build_contexts[image_name].append((user_mount, stage_name))
Expand Down
2 changes: 1 addition & 1 deletion tutor/commands/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def sqlshell(args: list[str]) -> t.Iterable[tuple[str, str]]:
Extra arguments will be passed to the `mysql` command verbatim. For instance, to
show tables from the "openedx" database, run `do sqlshell openedx -e 'show tables'`.
"""
command = "mysql --user={{ MYSQL_ROOT_USERNAME }} --password={{ MYSQL_ROOT_PASSWORD }} --host={{ MYSQL_HOST }} --port={{ MYSQL_PORT }}"
command = "mysql --user={{ MYSQL_ROOT_USERNAME }} --password={{ MYSQL_ROOT_PASSWORD }} --host={{ MYSQL_HOST }} --port={{ MYSQL_PORT }} --default-character-set=utf8mb3"
if args:
command += " " + shlex.join(args) # pylint: disable=protected-access
yield ("lms", command)
Expand Down
4 changes: 2 additions & 2 deletions tutor/hooks/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ def your_filter_callback(some_data):
instance, you can add a "hello" to the init task of the lms container by modifying
the :py:data:`CLI_DO_INIT_TASKS` filter::
hooks.CLI_DO_INIT_TASKS.add_item(("lms", "echo hello"))
hooks.Filters.CLI_DO_INIT_TASKS.add_item(("lms", "echo hello"))
To add multiple items at a time, use ``add_items``::
hooks.CLI_DO_INIT_TASKS.add_items(
hooks.Filters.CLI_DO_INIT_TASKS.add_items(
("lms", "echo 'hello from lms'"),
("cms", "echo 'hello from cms'"),
)
Expand Down
3 changes: 3 additions & 0 deletions tutor/templates/apps/openedx/config/partials/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@ DATABASES:
ATOMIC_REQUESTS: true
OPTIONS:
init_command: "SET sql_mode='STRICT_TRANS_TABLES'"
{%- if RUN_MYSQL %}
charset: "utf8mb3"
{%- endif %}
EMAIL_HOST_USER: "{{ SMTP_USERNAME }}"
EMAIL_HOST_PASSWORD: "{{ SMTP_PASSWORD }}"
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# Create folders if necessary
for folder in [LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE]:
if not os.path.exists(folder):
os.makedirs(folder)
os.makedirs(folder, exist_ok=True)

{{ patch("openedx-cms-common-settings") }}

Expand Down
7 changes: 7 additions & 0 deletions tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,
setuptools==67.6.1 pip==23.0.1. wheel==0.40.0

# Install base requirements
{% if not is_buildkit_enabled() %}
COPY --from=edx-platform /requirements/edx/base.txt /openedx/edx-platform/requirements/edx/base.txt
{% endif %}
RUN {% if is_buildkit_enabled() %}--mount=type=bind,from=edx-platform,source=/requirements/edx/base.txt,target=/openedx/edx-platform/requirements/edx/base.txt \
--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install -r /openedx/edx-platform/requirements/edx/base.txt

Expand Down Expand Up @@ -123,6 +126,10 @@ RUN nodeenv /openedx/nodeenv --node=16.14.0 --prebuilt
# Install nodejs requirements
ARG NPM_REGISTRY={{ NPM_REGISTRY }}
WORKDIR /openedx/edx-platform
{% if not is_buildkit_enabled() %}
COPY --from=edx-platform /package.json /openedx/edx-platform/package.json
COPY --from=edx-platform /package-lock.json /openedx/edx-platform/package-lock.json
{% endif %}
RUN {% if is_buildkit_enabled() %}--mount=type=bind,from=edx-platform,source=/package.json,target=/openedx/edx-platform/package.json \
--mount=type=bind,from=edx-platform,source=/package-lock.json,target=/openedx/edx-platform/package-lock.json \
--mount=type=bind,from=edx-platform,source=/scripts/copy-node-modules.sh,target=/openedx/edx-platform/scripts/copy-node-modules.sh \
Expand Down
2 changes: 1 addition & 1 deletion tutor/templates/config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DOCKER_IMAGE_OPENEDX_DEV: "openedx-dev:{{ TUTOR_VERSION }}"
DOCKER_IMAGE_CADDY: "docker.io/caddy:2.6.4"
DOCKER_IMAGE_ELASTICSEARCH: "docker.io/elasticsearch:7.17.9"
DOCKER_IMAGE_MONGODB: "docker.io/mongo:4.4.22"
DOCKER_IMAGE_MYSQL: "docker.io/mysql:8.0.33"
DOCKER_IMAGE_MYSQL: "docker.io/mysql:8.1.0"
DOCKER_IMAGE_PERMISSIONS: "{{ DOCKER_REGISTRY }}overhangio/openedx-permissions:{{ TUTOR_VERSION }}"
DOCKER_IMAGE_REDIS: "docker.io/redis:7.0.11"
DOCKER_IMAGE_SMTP: "docker.io/devture/exim-relay:4.96-r1-0"
Expand Down
2 changes: 1 addition & 1 deletion tutor/templates/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
{% if RUN_MYSQL -%}
mysql:
image: {{ DOCKER_IMAGE_MYSQL }}
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
command: mysqld --character-set-server=utf8mb3 --collation-server=utf8mb3_general_ci
restart: unless-stopped
user: "999:999"
volumes:
Expand Down

0 comments on commit 021a305

Please sign in to comment.