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.5.
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 upgrade
will 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 here. 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.yaml
should contain the following snippet:mongodb: image: tag: 3.6.22-debian-9-r38
To 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 upgrade
to update your installation. -
Once the
helm upgrade
has completed and MongoDB has rolled, you will need toexec
into 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 should 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.17-debian-10-r99
:mongodb: image: tag: 4.2.17-debian-10-r99
-
Run
helm upgrade
to update your installation. -
Once the
helm upgrade
has completed and MongoDB has rolled, you will need toexec
into 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 should 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 upgrade
to update your installation. -
Once the
helm upgrade
has completed and MongoDB has rolled, you will need toexec
into 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.