Upgrade MongoDB
MongoDB is a database service used by CircleCI Server. This page describes how to upgrade MongoDB to version 4.4.15.
MongoDB 3.6.22 is shipped with CircleCI Server v4.7.
Prerequisites
-
Ensure backups have been taken. You will need a backup of MongoDB to restore to in case anything goes wrong during the upgrade progress.
-
You are prepared to modify the
values.yaml -
helm upgradewill work from your system to upgrade the cluster. -
MongoDB root password is available.
Scripted upgrade
We have created a shell script which may be used to upgrade your cluster’s MongoDB instance. See the MongoDB upgrade script. If you wish, you may use the following instructions to manually upgrade your cluster’s MongoDB
Manual upgrade
1. Upgrade from MongoDB 3.6 to 4.0
-
Your
values.yamlmust contain the following snippet:mongodb: image: tag: 3.6.22-debian-9-r38To begin the upgrade process, change the tag to
4.0.27-debian-9-r118:mongodb: image: tag: 4.0.27-debian-9-r118 -
Run
helm upgradeto update your installation. -
Once the
helm upgradehas completed and MongoDB has rolled,execinto the pod (with the root password handy) to modify the compatibility version. Be sure to replace<password>with your MongoDB root password.kubectl exec -it mongodb-0 -- mongo -u root -p <password> db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } ) -
You will get a
{ "ok" : 1 }response from Mongo. Exit out of the MongoDB shell and pod.
2. Upgrade from MongoDB 4.0 to 4.2
-
Change the tag to
4.2.21-debian-10-r8:mongodb: image: tag: 4.2.21-debian-10-r8 -
Run
helm upgradeto update your installation. -
Once the
helm upgradehas completed and MongoDB has rolled,execinto the pod (with the root password handy) to modify the compatibility version. Be sure to replace<password>with your MongoDB root password.kubectl exec -it mongodb-0 -- mongo -u root -p <password> db.adminCommand( { setFeatureCompatibilityVersion: "4.2" } ) -
You will get
{ "ok" : 1 }again. Exit out of the shell and pod.
3. Upgrade from MongoDB 4.2 to 4.4
-
Change the tag one more time to
4.4.15-debian-10-r8:mongodb: image: tag: 4.4.15-debian-10-r8 -
Run
helm upgradeto update your installation. -
Once the
helm upgradehas completed and MongoDB has rolled,execinto the pod (with the root password handy) to modify the compatibility version. Be sure to replace<password>with your MongoDB root password.kubectl exec -it mongodb-0 -- mongo -u root -p <password> db.adminCommand( { setFeatureCompatibilityVersion: "4.4" } ) -
Once you receive
{ "ok" : 1 }, you have successfully upgraded your MongoDB to 4.4.15.