feat: upgrade mongodb to 4.4

This is for
https://github.com/openedx/wg-build-test-release/issues/288

Note that we also upgrade mongodb from 4.0 to 4.2, because somehow this
hasn't been done in olive.
This commit is contained in:
Régis Behmo 2023-05-30 16:01:17 +02:00
parent cac8530481
commit 189bfb2a7a
5 changed files with 40 additions and 56 deletions

View File

@ -16,3 +16,4 @@
- [Improvement] Auto-complete the image names in the `images build/pull/push/printtag` commands.
- [Deprecation] For local installations, Docker v20.10.15 and Compose v2.0.0 are now the minimum required versions.
- [Bugfix] Make `tutor config printvalue ...` print actual yaml-formatted values, such as "true" and "null"
- 💥[Improvement] MongoDb was upgraded to 4.4.

View File

@ -75,7 +75,7 @@ This configuration paramater defines which Caddy Docker image to use.
This configuration parameter defines which Elasticsearch Docker image to use.
- ``DOCKER_IMAGE_MONGODB`` (default: ``"docker.io/mongo:4.2.24"``)
- ``DOCKER_IMAGE_MONGODB`` (default: ``"docker.io/mongo:4.4.22"``)
This configuration parameter defines which MongoDB Docker image to use.

View File

@ -40,7 +40,7 @@ def upgrade_from(context: click.Context, from_release: str) -> None:
running_release = "olive"
if running_release == "olive":
upgrade_from_olive(context)
upgrade_from_olive(context, config)
running_release = "palm"
@ -51,18 +51,8 @@ def upgrade_from_ironwood(context: click.Context, config: Config) -> None:
click.echo(fmt.title("Stopping any existing platform"))
context.invoke(compose.stop)
if not config["RUN_MONGODB"]:
fmt.echo_info(
"You are not running MongoDB (RUN_MONGODB=false). It is your "
"responsibility to upgrade your MongoDb instance to v3.6. There is "
"nothing left to do to upgrade from Ironwood to Juniper."
)
return
upgrade_mongodb(context, config, "3.4", "3.4")
context.invoke(compose.stop)
upgrade_mongodb(context, config, "3.6", "3.6")
context.invoke(compose.stop)
def upgrade_from_juniper(context: click.Context, config: Config) -> None:
@ -150,7 +140,7 @@ def upgrade_from_maple(context: click.Context, config: Config) -> None:
)
def upgrade_from_olive(context: click.Context) -> None:
def upgrade_from_olive(context: click.Context, config: Config) -> None:
# Note that we need to exec because the ora2 folder is not bind-mounted in the job
# services.
context.invoke(compose.start, detach=True, services=["lms"])
@ -158,7 +148,8 @@ def upgrade_from_olive(context: click.Context) -> None:
compose.execute,
args=["lms", "sh", "-e", "-c", common_upgrade.PALM_RENAME_ORA2_FOLDER_COMMAND],
)
context.invoke(compose.stop)
upgrade_mongodb(context, config, "4.2.17", "4.2")
upgrade_mongodb(context, config, "4.4.22", "4.4")
def upgrade_mongodb(
@ -167,6 +158,13 @@ def upgrade_mongodb(
to_docker_version: str,
to_compatibility_version: str,
) -> None:
if not config["RUN_MONGODB"]:
fmt.echo_info(
f"You are not running MongoDB (RUN_MONGODB=false). It is your "
f"responsibility to upgrade your MongoDb instance to {to_docker_version}."
)
return
click.echo(fmt.title(f"Upgrading MongoDb to v{to_docker_version}"))
# Note that the DOCKER_IMAGE_MONGODB value is never saved, because we only save the
# environment, not the configuration.

View File

@ -44,30 +44,8 @@ def upgrade_from(context: click.Context, from_release: str) -> None:
def upgrade_from_ironwood(config: Config) -> None:
if not config["RUN_MONGODB"]:
fmt.echo_info(
"You are not running MongoDB (RUN_MONGODB=false). It is your "
"responsibility to upgrade your MongoDb instance to v3.6. There is "
"nothing left to do to upgrade from Ironwood."
)
return
message = """Automatic release upgrade is unsupported in Kubernetes. To upgrade from Ironwood, you should upgrade
your MongoDb cluster from v3.2 to v3.6. You should run something similar to:
# Upgrade from v3.2 to v3.4
tutor k8s stop
tutor config save --set DOCKER_IMAGE_MONGODB=mongo:3.4.24
tutor k8s start
tutor k8s exec mongodb mongo --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "3.4" })'
# Upgrade from v3.4 to v3.6
tutor k8s stop
tutor config save --set DOCKER_IMAGE_MONGODB=mongo:3.6.18
tutor k8s start
tutor k8s exec mongodb mongo --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "3.6" })'
tutor config save --unset DOCKER_IMAGE_MONGODB"""
fmt.echo_info(message)
upgrade_mongodb(config, "3.4.24", "3.4")
upgrade_mongodb(config, "3.6.18", "3.6")
def upgrade_from_juniper(config: Config) -> None:
@ -91,23 +69,7 @@ your MySQL database from v5.6 to v5.7. You should run something similar to:
def upgrade_from_koa(config: Config) -> None:
if not config["RUN_MONGODB"]:
fmt.echo_info(
"You are not running MongoDB (RUN_MONGODB=false). It is your "
"responsibility to upgrade your MongoDb instance to v4.0. There is "
"nothing left to do to upgrade to Lilac from Koa."
)
return
message = """Automatic release upgrade is unsupported in Kubernetes. To upgrade from Koa to Lilac, you should upgrade
your MongoDb cluster from v3.6 to v4.0. You should run something similar to:
tutor k8s stop
tutor config save --set DOCKER_IMAGE_MONGODB=mongo:4.0.25
tutor k8s start
tutor k8s exec mongodb mongo --eval 'db.adminCommand({ setFeatureCompatibilityVersion: "4.0" })'
tutor config save --unset DOCKER_IMAGE_MONGODB
"""
fmt.echo_info(message)
upgrade_mongodb(config, "4.0.25", "4.0")
def upgrade_from_lilac(config: Config) -> None:
@ -193,3 +155,26 @@ def upgrade_from_olive(context: Context, config: Config) -> None:
"lms",
["sh", "-e", "-c", common_upgrade.PALM_RENAME_ORA2_FOLDER_COMMAND],
)
upgrade_mongodb(config, "4.2.17", "4.2")
upgrade_mongodb(config, "4.4.22", "4.4")
def upgrade_mongodb(
config: Config, to_docker_version: str, to_compatibility_version: str
) -> None:
if not config["RUN_MONGODB"]:
fmt.echo_info(
"You are not running MongoDB (RUN_MONGODB=false). It is your "
"responsibility to upgrade your MongoDb instance to {to_docker_version}."
)
return
message = f"""Automatic release upgrade is unsupported in Kubernetes. You should manually upgrade
your MongoDb cluster to {to_docker_version} by running something similar to:
tutor k8s stop
tutor config save --set DOCKER_IMAGE_MONGODB=mongo:{to_docker_version}
tutor k8s start
tutor k8s exec mongodb mongo --eval 'db.adminCommand({{ setFeatureCompatibilityVersion: "{to_compatibility_version}" }})'
tutor config save --unset DOCKER_IMAGE_MONGODB
"""
fmt.echo_info(message)

View File

@ -14,7 +14,7 @@ DOCKER_IMAGE_OPENEDX: "{{ DOCKER_REGISTRY }}overhangio/openedx:{{ TUTOR_VERSION
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.2.24"
DOCKER_IMAGE_MONGODB: "docker.io/mongo:4.4.22"
DOCKER_IMAGE_MYSQL: "docker.io/mysql:8.0.33"
DOCKER_IMAGE_PERMISSIONS: "{{ DOCKER_REGISTRY }}overhangio/openedx-permissions:{{ TUTOR_VERSION }}"
DOCKER_IMAGE_REDIS: "docker.io/redis:7.0.11"