Open mserranom opened 2 weeks ago
GTM, not tested. There is a risk for these two to diverge now, e.g. the following is invalid but accepted by the Toolkit:
MONGO_VERSION=5.0.0 MONGO_IMAGE=my.registry.example.com/mongo:6.0.0
WDYT about adding
MONGO_VERSION
as tag toMONGO_IMAGE
?
Been thinking about it:
my-mongo:v6
). We can't reliably extract the version number in those cases.MONGO_VERSION
and MONGO_IMAGE
they will quickly see a problem before the app is started, as mongosh
won't work.I lean towards leaving it as it is. I've tweaked a little bit to make it fail when MONGO_VERSION
is not defined (as you suggested), and updated the error message to make it clear MONGO_IMAGE
need to be a valid version (<major>.<minor>
).
Maybe @mlevans0 can weigh in?
If I understand correctly, the MONGO_VERSION
environment variable has been introduced to help identify which MongoDB shell to use (either mongo
or mongosh
). Other than that, its not used (still using MONGO_IMAGE
in the compose file)?
The read_mongo_version
function attempts to read MONGO_VERSION
from config/overleaf.rc to set the correct MongoDB shell, but if MONGO_VERSION
is not defined, it then tries to extract the version from MONGO_IMAGE
instead and then issues a warning if it can't (in cases where it's a none-stock image).
Because of how this is handled, I think the MONGO_VERSION
environment variable is unnecessary. Couldn't we parse the MONGO_IMAGE
for the version number and show the warning if it's not a stock image (shortcutting the need for the variable)?
Adding MONGO_VERSION
to the config/overleaf.rc file will be a manual step for existing deployments, and if missed, would result in it being undefined, and therefore falling back to the MONGO_IMAGE
check anyway.
If we go with what's planned, and the MONGO_VERSION
is only used for setting the MongoDB shell, this needs to be explicitly documented. It could cause some confusion when attempting upgrades - you only need to set MONGO_IMAGE
and it must contain the version number - after MongoDB 6, you only need to set MONGO_IMAGE
(with version number), MONGO_VERSION
can be anything as long as its >= 6). It's also only really needed when going from 5 -> 6, after that there's no future requirement for it is there?
Description
Adds support for Mongo 6.0 in preparation for the next minor release. The main changes are:
mongo
shell has been replaced bymongosh
. The toolkit now reads Mongo major version fromoverleaf.rc
and sets aMONGOSH
variable that is used in different places to invoke the Mongo shell.rs.initiate()
fails in Mongo 6.0 when the replica set is already initialised. It's now checkingdb.isMaster().primary
beforehand, which should return an empty string if the replicaSet is not initialised.Upgrade instructions have been updated: https://github.com/overleaf/overleaf/wiki/Updating-Mongo-version/_compare/4e81c4348e2f8a30e2676af13ca7271493f53e75...acc881bbfc8f257d8d1b016e0ecbdd6cbc12b0ce
Test
With
MONGO_IMAGE=mongo:5.0
inoverleaf.rc
:Updated
MONGO_IMAGE=mongo:6.0
inoverleaf.rc
(previously set feature compatibility to5.0
):In both versions: tested login, project creation and compiles.
Contributor Agreement