Skip to content

Commit

Permalink
Upgrade mongo from 4.4. to 5.0 (#1704)
Browse files Browse the repository at this point in the history
Includes:
* Replace mongo calls with mongosh
* Remove unused package versions from Ansible
* Remove unused database specifications from aws-login chart

Co-authored-by: Jim Grady <jimgrady.jg@gmail.com>
  • Loading branch information
imnasnainaec and jmgrady authored Aug 2, 2022
1 parent a8f8ffc commit 2620b87
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 27 deletions.
18 changes: 0 additions & 18 deletions deploy/ansible/vars/packages.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
---
###############################
# This file defines package versions where specific packages version are
# specified in the playbooks. To update a package, change the version in
# this file and rerun the specified playbook
###############################

# MongoDB version
mongodb_version: 4.4

# Packages installed by playbook_docker.yml
docker_compose_version: 1.28.5

# Version for aws-cli installed by aws_access role
aws_cli_version: 2.1.28

# Version for cert_manager.io
cert_manager_version: v1.7.1

# Packages required for targets
required_packages:
- python3
Expand Down
4 changes: 0 additions & 4 deletions deploy/helm/aws-login/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,3 @@ awsEcr:
serviceAccount: account-ecr-login
role: role-ecr-login
roleBinding: role-ecr-login-binding

database:
mongo_image_tag: 4.4
data_size: 16Gi
2 changes: 1 addition & 1 deletion deploy/helm/thecombine/charts/database/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

mongoImageTag: "4.4"
mongoImageTag: "5.0"
persistentVolumeSize: 16Gi
4 changes: 2 additions & 2 deletions maintenance/scripts/combine_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def db_cmd(self, cmd: str) -> Optional[Dict[str, Any]]:
"""
db_results = self.exec(
self.get_pod_id(CombineApp.Component.Database),
["/usr/bin/mongo", "--quiet", "CombineDatabase", "--eval", cmd],
["/usr/bin/mongosh", "--quiet", "CombineDatabase", "--eval", cmd],
)
result_str = self.object_id_to_str(db_results.stdout)
if result_str != "":
Expand All @@ -129,7 +129,7 @@ def db_query(
cmd = f"db.{collection}.find({query}, {projection}).toArray()"
db_results = self.exec(
self.get_pod_id(CombineApp.Component.Database),
["/usr/bin/mongo", "--quiet", "CombineDatabase", "--eval", cmd],
["/usr/bin/mongosh", "--quiet", "CombineDatabase", "--eval", cmd],
)
result_str = self.object_id_to_str(db_results.stdout)
if result_str != "":
Expand Down
2 changes: 1 addition & 1 deletion scripts/dropDB.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { spawnSync } from "child_process";

const cmd = spawnSync("mongo", [
const cmd = spawnSync("mongosh", [
"-eval",
"db.getSiblingDB('CombineDatabase').dropDatabase()",
]);
Expand Down
6 changes: 5 additions & 1 deletion scripts/setAdminUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ if (args.length > 0) {
const user = args[0];
const updateCommand = `db.UsersCollection.updateOne({username: "${user}"}, {$set: {isAdmin: true}});`;

const cmd = spawnSync("mongo", ["--eval", updateCommand, "CombineDatabase"]);
const cmd = spawnSync("mongosh", [
"--eval",
updateCommand,
"CombineDatabase",
]);
console.log(`stderr: ${cmd.stderr.toString()}`);
console.log(`stdout: ${cmd.stdout.toString()}`);
} else {
Expand Down

0 comments on commit 2620b87

Please sign in to comment.