Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: upgrade mysql charset and collation to utf8mb4 #1065

Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/20240503_115445_dawoud.sheraz_redwood.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 💥[Feature] Upgrade to redwood (by @dawoudsheraz)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- 💥[Feature] Upgrade default charset and collation of mysql to utf8mb4 and utf8mb4_unicode_ci respectively (by @Danyal-Faheem)
Danyal-Faheem marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,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/quince.1"``, or ``master`` in :ref:`nightly <nightly>`)
- ``OPENEDX_COMMON_VERSION`` (default: ``"open-release/redwood.master"``, or ``master`` in :ref:`nightly <nightly>`)

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

Expand Down Expand Up @@ -378,9 +378,9 @@ Note that your edx-platform version must be a fork of the latest release **tag**

If you don't create your fork from this tag, you *will* have important compatibility issues with other services. In particular:

- Do not try to run a fork from an older (pre-Quince) version of edx-platform: this will simply not work.
- Do not try to run a fork from an older (pre-Redwood) version of edx-platform: this will simply not work.
- Do not try to run a fork from the edx-platform master branch: there is a 99% probability that it will fail.
- Do not try to run a fork from the open-release/quince.master branch: Tutor will attempt to apply security and bug fix patches that might already be included in the open-release/quince.master but which were not yet applied to the latest release tag. Patch application will thus fail if you base your fork from the open-release/quince.master branch.
- Do not try to run a fork from the open-release/redwood.master branch: Tutor will attempt to apply security and bug fix patches that might already be included in the open-release/redwood.master but which were not yet applied to the latest release tag. Patch application will thus fail if you base your fork from the open-release/redwood.master branch.

.. _i18n:

Expand Down
2 changes: 1 addition & 1 deletion docs/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ The ``openedx-dev`` Docker image is based on the same ``openedx`` image used by

- The user that runs inside the container has the same UID as the user on the host, to avoid permission problems inside mounted volumes (and in particular in the edx-platform repository).
- Additional Python and system requirements are installed for convenient debugging: `ipython <https://ipython.org/>`__, `ipdb <https://pypi.org/project/ipdb/>`__, vim, telnet.
- The edx-platform `development requirements <https://github.com/openedx/edx-platform/blob/open-release/quince.master/requirements/edx/development.in>`__ are installed.
- The edx-platform `development requirements <https://github.com/openedx/edx-platform/blob/open-release/redwood.master/requirements/edx/development.in>`__ are installed.


If you are using a custom ``openedx`` image, then you will need to rebuild ``openedx-dev`` every time you modify ``openedx``. To so, run::
Expand Down
4 changes: 2 additions & 2 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ Major Open edX releases are published twice a year, in June and December, by the
4. Test the new release in a sandboxed environment.
5. If you are running edx-platform, or some other repository from a custom branch, then you should rebase (and test) your changes on top of the latest release tag (see :ref:`edx_platform_fork`).

The process for upgrading from one major release to the next works similarly to any other upgrade, with the ``launch`` command (see above). The single difference is that if the ``launch`` command detects that your tutor environment was generated with an older release, it will perform a few release-specific upgrade steps. These extra upgrade steps will be performed just once. But they will be ignored if you updated your local environment (for instance: with ``tutor config save``) before running ``launch``. This situation typically occurs if you need to re-build some Docker images (see above). In such a case, you should make use of the ``upgrade`` command. For instance, to upgrade a local installation from Palm to Quince and rebuild some Docker images, run::
The process for upgrading from one major release to the next works similarly to any other upgrade, with the ``launch`` command (see above). The single difference is that if the ``launch`` command detects that your tutor environment was generated with an older release, it will perform a few release-specific upgrade steps. These extra upgrade steps will be performed just once. But they will be ignored if you updated your local environment (for instance: with ``tutor config save``) before running ``launch``. This situation typically occurs if you need to re-build some Docker images (see above). In such a case, you should make use of the ``upgrade`` command. For instance, to upgrade a local installation from Quince to Redwood and rebuild some Docker images, run::

tutor config save
tutor images build all # list the images that should be rebuilt here
tutor local upgrade --from=palm
tutor local upgrade --from=quince
tutor local launch

.. _autocomplete:
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Yes :) This is what happens when you run ``tutor local launch``:
2. Configuration files are generated from templates.
3. Docker images are downloaded.
4. Docker containers are provisioned.
5. A full, production-ready Open edX platform (`Quince <https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/open-release-quince.master/platform_releases/quince.html>`__ release) is run with docker-compose.
5. A full, production-ready Open edX platform (`Redwood <https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/open-release-redwood.master/platform_releases/redwood.html>`__ release) is run with docker-compose.

The whole procedure should require less than 10 minutes, on a server with good bandwidth. Note that your host environment will not be affected in any way, since everything runs inside docker containers. Root access is not even necessary.

Expand Down
10 changes: 5 additions & 5 deletions docs/reference/indexes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Plugin indexes are a great way to have your plugins discovered by other users. P
Index file paths
================

A plugin index is a yaml-formatted file. It can be stored on the web or on your computer. In both cases, the index file location must end with "<current release name>/plugins.yml". For instance, the following are valid index locations if you run the Open edX "Quince" release:
A plugin index is a yaml-formatted file. It can be stored on the web or on your computer. In both cases, the index file location must end with "<current release name>/plugins.yml". For instance, the following are valid index locations if you run the Open edX "Redwood" release:

- https://overhang.io/tutor/main/quince/plugins.yml
- ``/path/to/your/local/index/quince/plugins.yml``
- https://overhang.io/tutor/main/redwood/plugins.yml
- ``/path/to/your/local/index/redwood/plugins.yml``

To add either indexes, run the ``tutor plugins index add`` command without the suffix. For instance::

Expand Down Expand Up @@ -106,9 +106,9 @@ Manage plugins in development
Plugin developers and maintainers often want to install local versions of their plugins. They usually achieve this with ``pip install -e /path/to/tutor-plugin``. We can improve that workflow by creating an index for local plugins::

# Create the plugin index directory
mkdir -p ~/localindex/quince/
mkdir -p ~/localindex/redwood/
# Edit the index
vim ~/localindex/quince/plugins.yml
vim ~/localindex/redwood/plugins.yml

Add the following to the index::

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/edx-platform.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Quite often, developers don't want to work on edx-platform directly, but on a de
cd /my/workspace/edx-ora2
git clone https://github.com/openedx/edx-ora2 .

Then, check out the right version of the package. This is the version that is indicated in the `edx-platform/requirements/edx/base.txt <https://github.com/openedx/edx-platform/blob/open-release/quince.master/requirements/edx/base.txt>`__. Be careful that the version that is currently in use in your version of edx-platform is **not necessarily the head of the master branch**::
Then, check out the right version of the package. This is the version that is indicated in the `edx-platform/requirements/edx/base.txt <https://github.com/openedx/edx-platform/blob/open-release/redwood.master/requirements/edx/base.txt>`__. Be careful that the version that is currently in use in your version of edx-platform is **not necessarily the head of the master branch**::

git checkout <my-version-tag-or-branch>

Expand Down
28 changes: 14 additions & 14 deletions requirements/plugins.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# change version ranges when upgrading from quince
tutor-android>=17.0.0,<18.0.0
tutor-cairn>=17.0.0,<18.0.0
tutor-credentials>=17.0.0,<18.0.0
tutor-discovery>=17.0.0,<18.0.0
tutor-ecommerce>=17.0.0,<18.0.0
tutor-forum>=17.0.0,<18.0.0
tutor-indigo>=17.0.0,<18.0.0
tutor-jupyter>=17.0.0,<18.0.0
tutor-mfe>=17.0.0,<18.0.0
tutor-minio>=17.0.0,<18.0.0
tutor-notes>=17.0.0,<18.0.0
tutor-webui>=17.0.0,<18.0.0
tutor-xqueue>=17.0.0,<18.0.0
# change version ranges when upgrading from redwood
tutor-android>=18.0.0,<19.0.0
tutor-cairn>=18.0.0,<19.0.0
tutor-credentials>=18.0.0,<19.0.0
tutor-discovery>=18.0.0,<19.0.0
tutor-ecommerce>=18.0.0,<19.0.0
tutor-forum>=18.0.0,<19.0.0
tutor-indigo>=18.0.0,<19.0.0
tutor-jupyter>=18.0.0,<19.0.0
tutor-mfe>=18.0.0,<19.0.0
tutor-minio>=18.0.0,<19.0.0
tutor-notes>=18.0.0,<19.0.0
tutor-webui>=18.0.0,<19.0.0
tutor-xqueue>=18.0.0,<19.0.0
2 changes: 1 addition & 1 deletion tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def test_current_version_in_latest_env(self) -> None:
) as f:
f.write(__version__)
self.assertEqual(__version__, env.current_version(root))
self.assertEqual("quince", env.get_env_release(root))
self.assertEqual("redwood", env.get_env_release(root))
self.assertIsNone(env.should_upgrade_from_release(root))
self.assertTrue(env.is_up_to_date(root))

Expand Down
4 changes: 2 additions & 2 deletions tutor/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

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

# 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
# the versions from other branches. For instance: set the suffix to "nightly" in
# the nightly branch.
# The suffix is cleanly separated from the __version__ in this module to avoid
# conflicts when merging branches.
__version_suffix__ = "nightly"
__version_suffix__ = ""

# The app name will be used to define the name of the default tutor root and
# plugin directory. To avoid conflicts between multiple locally-installed
Expand Down
3 changes: 2 additions & 1 deletion tutor/commands/upgrade/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Note: don't forget to change this when we upgrade from quince
# Note: don't forget to change this when we upgrade from redwood
OPENEDX_RELEASE_NAMES = [
"ironwood",
"juniper",
Expand All @@ -9,4 +9,5 @@
"olive",
"palm",
"quince",
"redwood",
]
1 change: 1 addition & 0 deletions tutor/commands/upgrade/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def upgrade_from(context: click.Context, from_release: str) -> None:

if running_release == "quince":
upgrade_from_quince(context, config)
running_release = "redwood"


def upgrade_from_ironwood(context: click.Context, config: Config) -> None:
Expand Down
1 change: 1 addition & 0 deletions tutor/commands/upgrade/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def upgrade_from(context: click.Context, from_release: str) -> None:

if running_release == "quince":
upgrade_from_quince(config)
running_release = "redwood"


def upgrade_from_ironwood(config: Config) -> None:
Expand Down
1 change: 1 addition & 0 deletions tutor/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ def get_release(version: str) -> str:
"15": "olive",
"16": "palm",
"17": "quince",
"18": "redwood",
}[version.split(".", maxsplit=1)[0]]


Expand Down
2 changes: 1 addition & 1 deletion tutor/templates/apps/openedx/config/partials/auth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DATABASES:
OPTIONS:
init_command: "SET sql_mode='STRICT_TRANS_TABLES'"
{%- if RUN_MYSQL %}
charset: "utf8mb3"
charset: "utf8mb4"
{%- endif %}
EMAIL_HOST_USER: "{{ SMTP_USERNAME }}"
EMAIL_HOST_PASSWORD: "{{ SMTP_PASSWORD }}"
9 changes: 1 addition & 8 deletions tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ RUN git config --global user.email "[email protected]" \
# Patches in nightly node
{%- else %}
# Patches in non-nightly mode
# Prevent course structure cache infinite growth
# https://github.com/openedx/edx-platform/pull/34210
RUN curl -fsSL https://github.com/openedx/edx-platform/commit/ad201cd664b6c722cbefcbda23ae390c06daf621.patch | git am
# Security patch for "Privilege re-escalation in Studio after staff access removed"
# https://github.com/openedx/edx-platform/security/advisories/GHSA-99vw-2wrq-xh9x
# https://discuss.openedx.org/t/upcoming-security-fix-for-edx-platform-on-2024-05-17/13004
RUN curl -fsSL https://github.com/openedx/edx-platform/commit/3ff69fd5813256f935f19c237ea0c42d4c16edbf.patch | git am
{%- endif %}

{# Example: RUN curl -fsSL https://github.com/openedx/edx-platform/commit/<GITSHA1>.patch | git am #}
Expand Down Expand Up @@ -111,7 +104,7 @@ RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
{{ patch("openedx-dockerfile-post-python-requirements") }}

# Install scorm xblock
RUN pip install "openedx-scorm-xblock>=17.0.0,<18.0.0"
RUN pip install "openedx-scorm-xblock>=18.0.0,<19.0.0"

{% for extra_requirements in OPENEDX_EXTRA_PIP_REQUIREMENTS %}
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared \
Expand Down
2 changes: 1 addition & 1 deletion tutor/templates/build/openedx/revisions.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
EDX_PLATFORM_REVISION: quince
EDX_PLATFORM_REVISION: redwood
2 changes: 1 addition & 1 deletion tutor/templates/config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ OPENEDX_LMS_UWSGI_WORKERS: 2
OPENEDX_MYSQL_DATABASE: "openedx"
OPENEDX_MYSQL_USERNAME: "openedx"
# the common version will be automatically set to "master" in the nightly branch
OPENEDX_COMMON_VERSION: "open-release/quince.3"
OPENEDX_COMMON_VERSION: "open-release/redwood.master"
OPENEDX_EXTRA_PIP_REQUIREMENTS: []
MYSQL_HOST: "mysql"
MYSQL_PORT: 3306
Expand Down
4 changes: 2 additions & 2 deletions tutor/templates/k8s/deployments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ spec:
image: {{ DOCKER_IMAGE_MYSQL }}
args:
- "mysqld"
- "--character-set-server=utf8mb3"
- "--collation-server=utf8mb3_general_ci"
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_general_ci"
- "--binlog-expire-logs-seconds=259200"
env:
- name: MYSQL_ROOT_PASSWORD
Expand Down
4 changes: 2 additions & 2 deletions tutor/templates/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ services:
image: {{ DOCKER_IMAGE_MYSQL }}
command: >
mysqld
--character-set-server=utf8mb3
--collation-server=utf8mb3_general_ci
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--binlog-expire-logs-seconds=259200
restart: unless-stopped
user: "999:999"
Expand Down