mirror of
https://github.com/overleaf/toolkit.git
synced 2025-04-19 07:18:06 +02:00
Add support for Mongo 6
This commit is contained in:
parent
49ca0914f3
commit
73661ed2b1
6 changed files with 73 additions and 9 deletions
|
@ -4,7 +4,7 @@ services:
|
|||
|
||||
mongo:
|
||||
restart: always
|
||||
image: "${MONGO_IMAGE}"
|
||||
image: "${MONGO_DOCKER_IMAGE}"
|
||||
command: "${MONGO_ARGS}"
|
||||
container_name: mongo
|
||||
volumes:
|
||||
|
@ -12,7 +12,7 @@ services:
|
|||
expose:
|
||||
- 27017
|
||||
healthcheck:
|
||||
test: echo 'db.stats().ok' | mongo localhost:27017/test --quiet
|
||||
test: echo 'db.stats().ok' | ${MONGOSH} localhost:27017/test --quiet
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
|
|
|
@ -19,6 +19,54 @@ function read_image_version() {
|
|||
IMAGE_VERSION_PATCH=${BASH_REMATCH[3]}
|
||||
}
|
||||
|
||||
function read_mongo_version() {
|
||||
local mongo_image=$(read_configuration "MONGO_IMAGE")
|
||||
local mongo_version=$(read_configuration "MONGO_VERSION")
|
||||
if [ -z "${mongo_version}" ]; then
|
||||
if [[ "$mongo_image" =~ ^mongo:([0-9]+)\.(.*)$ ]]; then
|
||||
# when running a chain of commands (example: bin/up -> bin/docker-compose) we're passing
|
||||
# SKIP_WARNINGS=true to prevent the warning message to be printed several times
|
||||
if [[ -z ${SKIP_WARNINGS:-} ]]; then
|
||||
echo "------------------- WARNING ----------------------"
|
||||
echo " Deprecation warning: the mongo image is now split between MONGO_IMAGE"
|
||||
echo " and MONGO_VERSION configurations. Please update your config/overleaf.rc as"
|
||||
echo " your current configuration may stop working in future versions of the toolkit."
|
||||
echo " Example: MONGO_IMAGE=mongo"
|
||||
echo " MONGO_VERSION=6.0"
|
||||
fi
|
||||
MONGO_VERSION_MAJOR=${BASH_REMATCH[1]}
|
||||
MONGO_DOCKER_IMAGE="$mongo_image"
|
||||
else
|
||||
echo "--------------------- ERROR -----------------------"
|
||||
echo " The mongo image is now split between MONGO_IMAGE and MONGO_VERSION configurations."
|
||||
echo " Please update your config/overleaf.rc."
|
||||
echo ""
|
||||
echo " MONGO_VERSION must start with the actual major version of mongo, followed by a dot."
|
||||
echo " Example: MONGO_IMAGE=my.dockerhub.com/mongo"
|
||||
echo " MONGO_VERSION=6.0-custom"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if [[ ! "$mongo_version" =~ ^([0-9]+)\.(.+)$ ]]; then
|
||||
echo "--------------------- ERROR -----------------------"
|
||||
echo " Invalid MONGO_VERSION: $mongo_version"
|
||||
echo ""
|
||||
echo " MONGO_VERSION must start with the actual major version of mongo, followed by a dot."
|
||||
echo " Example: MONGO_IMAGE=my.dockerhub.com/custom-mongo"
|
||||
echo " MONGO_VERSION=6.0.hotfix-1"
|
||||
exit 1
|
||||
fi
|
||||
MONGO_VERSION_MAJOR=${BASH_REMATCH[1]}
|
||||
MONGO_DOCKER_IMAGE="$mongo_image:$mongo_version"
|
||||
fi
|
||||
|
||||
if [[ "$MONGO_VERSION_MAJOR" -lt 6 ]]; then
|
||||
MONGOSH="mongo"
|
||||
else
|
||||
MONGOSH="mongosh"
|
||||
fi
|
||||
}
|
||||
|
||||
function check_retracted_version() {
|
||||
if [[ "${OVERLEAF_SKIP_RETRACTION_CHECK:-null}" == "$IMAGE_VERSION" ]]; then
|
||||
return
|
||||
|
@ -131,3 +179,9 @@ function read_variable() {
|
|||
grep -E "^$name=" "$TOOLKIT_ROOT/config/variables.env" \
|
||||
| sed -r "s/^$name=([\"']*)(.+)\1*\$/\2/"
|
||||
}
|
||||
|
||||
function read_configuration() {
|
||||
local name=$1
|
||||
grep -E "^$name=" "$TOOLKIT_ROOT/config/overleaf.rc" \
|
||||
| sed -r "s/^$name=([\"']*)(.+)\1*\$/\2/"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue