mirror of
https://github.com/ChristianLight/tutor.git
synced 2025-01-06 07:30:40 +00:00
fix: mongodb upgrade error when upgrading from koa
ref: https://discuss.overhang.io/t/mongo-db-error-warning-on-koa-lilac-upgrade/1744 Close #469
This commit is contained in:
parent
4f8f0fe006
commit
db5852e9c4
@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥".
|
||||
|
||||
## Unreleased
|
||||
|
||||
- [Bugfix] Fix "Invalid command argument" during upgrade from Koa to Lilac.
|
||||
- [Bugfix] Fix mysql initialisation in docker-compose==2.0.0beta4.
|
||||
- [Improvement] Tutor is now published on pypi as "tutor".
|
||||
|
||||
|
@ -475,7 +475,7 @@ def upgrade_from_koa(config: Config) -> None:
|
||||
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
|
||||
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
|
||||
|
@ -137,9 +137,9 @@ def upgrade_from_ironwood(context: click.Context, config: Config) -> None:
|
||||
)
|
||||
return
|
||||
|
||||
upgrade_mongodb(context, config, "3.4")
|
||||
upgrade_mongodb(context, config, "3.4", "3.4")
|
||||
context.invoke(compose.stop)
|
||||
upgrade_mongodb(context, config, "3.6")
|
||||
upgrade_mongodb(context, config, "3.6", "3.6")
|
||||
context.invoke(compose.stop)
|
||||
|
||||
|
||||
@ -183,14 +183,19 @@ def upgrade_from_koa(context: click.Context, config: Config) -> None:
|
||||
"nothing left to do to upgrade from Koa to Lilac."
|
||||
)
|
||||
return
|
||||
upgrade_mongodb(context, config, "4.0.25")
|
||||
upgrade_mongodb(context, config, "4.0.25", "4.0")
|
||||
|
||||
|
||||
def upgrade_mongodb(context: click.Context, config: Config, to_version: str) -> None:
|
||||
click.echo(fmt.title("Upgrading MongoDb to v{}".format(to_version)))
|
||||
def upgrade_mongodb(
|
||||
context: click.Context,
|
||||
config: Config,
|
||||
to_docker_version: str,
|
||||
to_compatibility_version: str,
|
||||
) -> None:
|
||||
click.echo(fmt.title("Upgrading MongoDb to v{}".format(to_docker_version)))
|
||||
# Note that the DOCKER_IMAGE_MONGODB value is never saved, because we only save the
|
||||
# environment, not the configuration.
|
||||
config["DOCKER_IMAGE_MONGODB"] = "mongo:{}".format(to_version)
|
||||
config["DOCKER_IMAGE_MONGODB"] = "mongo:{}".format(to_docker_version)
|
||||
tutor_env.save(context.obj.root, config)
|
||||
context.invoke(compose.start, detach=True, services=["mongodb"])
|
||||
context.invoke(
|
||||
@ -199,7 +204,8 @@ def upgrade_mongodb(context: click.Context, config: Config, to_version: str) ->
|
||||
"mongodb",
|
||||
"mongo",
|
||||
"--eval",
|
||||
'db.adminCommand({ setFeatureCompatibilityVersion: "%s" })' % to_version,
|
||||
'db.adminCommand({ setFeatureCompatibilityVersion: "%s" })'
|
||||
% to_compatibility_version,
|
||||
],
|
||||
)
|
||||
context.invoke(compose.stop)
|
||||
|
Loading…
Reference in New Issue
Block a user