This repository was archived by the owner on Aug 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ services:
177
177
command : mongod --nojournal --storageEngine wiredTiger
178
178
container_name : " edx.${COMPOSE_PROJECT_NAME:-devstack}.mongo"
179
179
hostname : mongo.devstack.edx
180
- image : mongo:${MONGO_VERSION:-4.4.18 }
180
+ image : mongo:${MONGO_VERSION:-5.0.24 }
181
181
networks :
182
182
default :
183
183
aliases :
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -eu -o pipefail
3
+
4
+ # This script will upgrade a devstack that was previosly running Mongo DB 4.4 to MongoDB 5.0.24
5
+
6
+ . scripts/colors.sh
7
+
8
+ # Upgrade to mongo 5.0.24
9
+ export MONGO_VERSION=5.0.24
10
+
11
+ echo
12
+ echo -e " ${GREEN} Restarting Mongo on version ${MONGO_VERSION}${NC} "
13
+ make dev.up.mongo
14
+ mongo_container=" $( make --silent --no-print-directory dev.print-container.mongo) "
15
+
16
+ echo -e " ${GREEN} Waiting for MongoDB...${NC} "
17
+ until docker exec " $mongo_container " mongo --eval ' db.serverStatus()' & > /dev/null
18
+ do
19
+ printf " ."
20
+ sleep 1
21
+ done
22
+
23
+ echo -e " ${GREEN} MongoDB ready.${NC} "
24
+ MONGO_VERSION_LIVE=$( docker exec -it " $mongo_container " mongo --quiet --eval " printjson(db.version())" )
25
+ MONGO_VERSION_COMPAT=$( docker exec -it " $mongo_container " mongo --quiet \
26
+ --eval " printjson(db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )['featureCompatibilityVersion'])" )
27
+ echo -e " ${GREEN} Mongo Server version: ${MONGO_VERSION_LIVE}${NC} "
28
+ echo -e " ${GREEN} Mongo FeatureCompatibilityVersion version: ${MONGO_VERSION_COMPAT}${NC} "
29
+
30
+ if echo " ${MONGO_VERSION_COMPAT} " | grep -q " 5\.0" ; then
31
+ echo -e " ${GREEN} Upgrading FeatureCompatibilityVersion to 5.0${NC} "
32
+ docker exec -it " $mongo_container " mongo --eval " db.adminCommand( { setFeatureCompatibilityVersion: \" 5.0\" } )"
33
+ else
34
+ echo -e " ${GREEN} FeatureCompatibilityVersion already set to 5.0${NC} "
35
+ fi
You can’t perform that action at this time.
0 commit comments