Skip to content

Commit

Permalink
feat!: Update MongoDB version to 8.0
Browse files Browse the repository at this point in the history
Remove support for MongoDB 3.6 and adds support for 8.0.

Signed-off-by: Caden Marofke <[email protected]>
  • Loading branch information
marofke committed Dec 4, 2024
1 parent db0d582 commit ef65da0
Show file tree
Hide file tree
Showing 32 changed files with 72 additions and 71 deletions.
4 changes: 4 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ fi
# Packaging directory
rm -rf ./dist

# Integ test directory
rm -rf "./integ/stage"
rm -rf "./integ/.e2etemp"

echo "Done"
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class AppConfig {
public readonly deadlineVersion?: string;

/**
* A map of regions to Deadline Client Linux AMIs. As an example, the base Linux Deadline 10.3.2.1 AMI ID from us-west-2
* A map of regions to Deadline Client Linux AMIs. As an example, the base Linux Deadline 10.4.0.10 AMI ID from us-west-2
* is filled in. It can be used as-is, added to, or replaced. Ideally the version here should match the version of
* Deadline used in any connected Deadline constructs.
*/
public readonly deadlineClientLinuxAmiMap: Record<string, string> = {['us-west-2']: 'ami-0b2bbe30ea8642cdd'};
public readonly deadlineClientLinuxAmiMap: Record<string, string> = {['us-west-2']: 'ami-0927eddb98f8160b3'};

/**
* (Optional) A secret (in binary form) in SecretsManager that stores the UBL certificates in a .zip file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ export class StorageTierMongoDB extends StorageTier {
instanceType: props.databaseInstanceType,
mongoDb: {
userSsplAcceptance: props.acceptSsplLicense,
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
hostname: 'mongo',
dnsZone: props.dnsZone,
serverCertificate: serverCert,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ new RepositoryTestingTier(app, 'RFDKInteg-DL-TestingTier' + integStackTag, {
env,
integStackTag,
structs,
// Currently we test using MongoDB 3.6, which doesn't run on the
// Amazon Linux 2023 image that we use to test Deadline 10.4.0.
bastionMachineImageOverride: MachineImage.latestAmazonLinux2(),
bastionMachineImageOverride: MachineImage.latestAmazonLinux2023(),
});

// Adds IAM Policy to Instance and ASG Roles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class RepositoryTestingTier extends TestingTier {
const userSsplAcceptance =
userAcceptsSSPL.toString() === 'true' ? MongoDbSsplLicenseAcceptance.USER_ACCEPTS_SSPL : MongoDbSsplLicenseAcceptance.USER_REJECTS_SSPL;
const mongodbInstaller = new MongoDbInstaller(this, {
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
userSsplAcceptance,
});
mongodbInstaller.installOnLinuxInstance(this.testInstance.instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,5 @@ else
fi

# Mongo command to query for "deadline10db" database.
# We delete Timestamp fields from the EJSON result to avoid errors when parsing
# them in Python.
mongo --quiet --ssl --host="$DB_ADDRESS" --sslCAFile="$CERT_CA" --username="$DB_USERNAME" --password="$DB_PASS" --eval='(function(){var output=db.adminCommand({ listDatabases: 1, nameOnly: true, filter: { "name": "deadline10db" } } );delete output.onTime;delete output.operationTime;printjson(output)})()'
mongosh --quiet --tls --host="$DB_ADDRESS" --tlsCAFile="$CERT_CA" --username="$DB_USERNAME" --password="$DB_PASS" --eval='EJSON.stringify( db.adminCommand({ listDatabases: 1, nameOnly: true, filter: { "name": "deadline10db" } }) );'
exit 0
4 changes: 2 additions & 2 deletions integ/lib/storage-struct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class StorageStruct extends Construct {
masterUser: {
username: 'DocDBUser',
},
engineVersion: '3.6.0',
engineVersion: '5.0.0',
backup: {
retention: Duration.days(15),
},
Expand Down Expand Up @@ -182,7 +182,7 @@ export class StorageStruct extends Construct {
},
mongoDb: {
userSsplAcceptance,
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
dnsZone: new PrivateHostedZone(this, 'Zone', {
zoneName: 'renderfarm.local',
vpc,
Expand Down
2 changes: 1 addition & 1 deletion integ/scripts/bash/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ for COMPONENT in **/test_marker; do
rm -rf "${COMPONENT_ROOT}/cdk.out"
done

rm -rf "$INTEG_ROOT/node_modules"
rm -rf "$INTEG_ROOT/node_modules"
1 change: 1 addition & 0 deletions lambda-layers/lib/get-regions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const REGION_DENY_LIST = [
'ap-south-2',
'ap-southeast-3',
'ap-southeast-4',
'ap-southeast-5',
'ca-west-1',
'eu-south-1',
'eu-south-2',
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-rfdk/lib/core/lib/mongodb-installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import {
*/
export enum MongoDbVersion {
/**
* MongoDB 3.6 Community Edition.
* See: https://docs.mongodb.com/v3.6/introduction/
* MongoDB 8.0 Community Edition.
* See: https://www.mongodb.com/docs/v8.0/introduction/
*/
COMMUNITY_3_6 = '3.6',
COMMUNITY_8_0 = '8.0',
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-rfdk/lib/core/lib/mongodb-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ export class MongoDbInstance extends Construct implements IMongoDb, IGrantable {
vpc: props.vpc,
vpcSubnets: { subnets: [ subnet ] },
instanceType: props.instanceType ?? new InstanceType('r5.large'),
machineImage: MachineImage.latestAmazonLinux2(),
machineImage: MachineImage.latestAmazonLinux2023(),
blockDevices: [
{
deviceName: '/dev/xvda', // Root volume
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

# Script to install MongoDB Community Edition v3.6 from the Mongo.org yum repository.
# Script to install MongoDB Community Edition v8.0 from the Mongo.org yum repository.
#
# Developer note: For legal reasons we absolutely cannot distribute MongoDB in any way.
# This includes distributing the installers, or images with MongoDB pre-installed.
Expand All @@ -12,19 +12,17 @@

set -xefuo pipefail

# Installation instructions: https://docs.mongodb.com/v3.6/tutorial/install-mongodb-on-red-hat/
# Note: There are no instructions for Amazon Linux 2, but the RedHat 7 binaries are compatible.

REPO_FILENAME=mongodb-org-3.6.repo
# Installation instructions: https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-amazon/
REPO_FILENAME=mongodb-org-8.0.repo
YUM_REPOS_DIR=/etc/yum.repos.d

cat > "/tmp/${REPO_FILENAME}" << EOF
[mongodb-org-3.6]
[mongodb-org-8.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/7/mongodb-org/3.6/x86_64
baseurl=https://repo.mongodb.org/yum/amazon/2023/mongodb-org/8.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc
gpgkey=https://pgp.mongodb.com/server-8.0.asc
EOF

sudo mv "/tmp/${REPO_FILENAME}" "${YUM_REPOS_DIR}"
Expand All @@ -33,4 +31,5 @@ sudo chown root.root "${YUM_REPOS_DIR}/${REPO_FILENAME}"
sudo chmod 600 "${YUM_REPOS_DIR}/${REPO_FILENAME}"

# Do the install
sudo yum install -y mongodb-mongosh-shared-openssl3
sudo yum install -y mongodb-org
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ echo '");' >> ./temp.js
cat temp.js | tr -d '\n' > ./adminCredentials.js
rm -f ./temp.js

mongo --port 27017 --host localhost ./createAdminUser.js --quiet
mongosh --port 27017 --host localhost ./createAdminUser.js --quiet
rm -f ./adminCredentials.js
8 changes: 4 additions & 4 deletions packages/aws-rfdk/lib/core/test/asset-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export const MOUNT_FSX_SCRIPT_LINUX = {
Key: '9afc7cd192aacbc562e018fb8f9c3848df6a247d43d2486ee91c0ded179e2774',
};

export const INSTALL_MONGODB_3_6_SCRIPT_LINUX = {
export const INSTALL_MONGODB_8_0_SCRIPT_LINUX = {
Bucket: 'cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}',
Key: '80faba664ebb899d63d89c8fcea1d867475d1ddd28159f418b42af81197849e1',
Key: '9a874a982214b9def58319059eb1f977840b7d0178a9563121c03b122e4d2acd',
};

export const MONGODB_3_6_CONFIGURATION_SCRIPTS = {
export const MONGODB_8_0_CONFIGURATION_SCRIPTS = {
Bucket: 'cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}',
Key: '3b571d3659f9f47af6005ca9619c6aec2a576cea5a53b8707544df0a80e368c8',
Key: 'c1c40e6ac96769539de343b85ef12d12399dfedfdc4cb3129af6205d76953dfb',
};
34 changes: 17 additions & 17 deletions packages/aws-rfdk/lib/core/test/mongodb-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
MongoDbVersion,
} from '../lib';
import {
INSTALL_MONGODB_3_6_SCRIPT_LINUX,
INSTALL_MONGODB_8_0_SCRIPT_LINUX,
} from './asset-constants';


Expand Down Expand Up @@ -54,13 +54,13 @@ Please set the userSsplAcceptance property to USER_ACCEPTS_SSPL to signify your
// Must throw when providing no SSPL option.
expect(() => {
new MongoDbInstaller(stack, {
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
});
}).toThrow(errorString);
// Must throw when explicitly rejecting the SSPL.
expect(() => {
new MongoDbInstaller(stack, {
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
userSsplAcceptance: MongoDbSsplLicenseAcceptance.USER_REJECTS_SSPL,
});
}).toThrow(errorString);
Expand All @@ -75,7 +75,7 @@ Please set the userSsplAcceptance property to USER_ACCEPTS_SSPL to signify your
machineImage: MachineImage.latestAmazonLinux2023(),
});
const installer = new MongoDbInstaller(stack, {
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
userSsplAcceptance: MongoDbSsplLicenseAcceptance.USER_ACCEPTS_SSPL,
});

Expand Down Expand Up @@ -104,7 +104,7 @@ Please set the userSsplAcceptance property to USER_ACCEPTS_SSPL to signify your
},
':s3:::',
{
'Fn::Sub': INSTALL_MONGODB_3_6_SCRIPT_LINUX.Bucket,
'Fn::Sub': INSTALL_MONGODB_8_0_SCRIPT_LINUX.Bucket,
},
],
],
Expand All @@ -119,7 +119,7 @@ Please set the userSsplAcceptance property to USER_ACCEPTS_SSPL to signify your
},
':s3:::',
{
'Fn::Sub': INSTALL_MONGODB_3_6_SCRIPT_LINUX.Bucket,
'Fn::Sub': INSTALL_MONGODB_8_0_SCRIPT_LINUX.Bucket,
},
'/*',
],
Expand All @@ -137,11 +137,11 @@ Please set the userSsplAcceptance property to USER_ACCEPTS_SSPL to signify your
'Fn::Join': [
'',
[
`#!/bin/bash\nmkdir -p $(dirname '/tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh')\naws s3 cp 's3://`,
`#!/bin/bash\nmkdir -p $(dirname '/tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh')\naws s3 cp 's3://`,
{
'Fn::Sub': INSTALL_MONGODB_3_6_SCRIPT_LINUX.Bucket,
'Fn::Sub': INSTALL_MONGODB_8_0_SCRIPT_LINUX.Bucket,
},
`/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh' '/tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh'\nbash /tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh`,
`/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh' '/tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh'\nbash /tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh`,
],
],
},
Expand All @@ -157,7 +157,7 @@ Please set the userSsplAcceptance property to USER_ACCEPTS_SSPL to signify your
machineImage: MachineImage.latestWindows(WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_STANDARD),
});
const installer = new MongoDbInstaller(stack, {
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
userSsplAcceptance: MongoDbSsplLicenseAcceptance.USER_ACCEPTS_SSPL,
});

Expand All @@ -175,11 +175,11 @@ Please set the userSsplAcceptance property to USER_ACCEPTS_SSPL to signify your
machineImage: MachineImage.latestAmazonLinux2023(),
});
const installer1 = new MongoDbInstaller(stack, {
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
userSsplAcceptance: MongoDbSsplLicenseAcceptance.USER_ACCEPTS_SSPL,
});
const installer2 = new MongoDbInstaller(stack, {
version: MongoDbVersion.COMMUNITY_3_6,
version: MongoDbVersion.COMMUNITY_8_0,
userSsplAcceptance: MongoDbSsplLicenseAcceptance.USER_ACCEPTS_SSPL,
});

Expand All @@ -195,15 +195,15 @@ Please set the userSsplAcceptance property to USER_ACCEPTS_SSPL to signify your
'Fn::Join': [
'',
Match.arrayWith([
`#!/bin/bash\nmkdir -p $(dirname '/tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh')\naws s3 cp 's3://`,
`#!/bin/bash\nmkdir -p $(dirname '/tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh')\naws s3 cp 's3://`,
{
'Fn::Sub': INSTALL_MONGODB_3_6_SCRIPT_LINUX.Bucket,
'Fn::Sub': INSTALL_MONGODB_8_0_SCRIPT_LINUX.Bucket,
},
`/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh' '/tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh'\nbash /tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh\nmkdir -p $(dirname '/tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh')\naws s3 cp 's3://`,
`/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh' '/tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh'\nbash /tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh\nmkdir -p $(dirname '/tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh')\naws s3 cp 's3://`,
{
'Fn::Sub': INSTALL_MONGODB_3_6_SCRIPT_LINUX.Bucket,
'Fn::Sub': INSTALL_MONGODB_8_0_SCRIPT_LINUX.Bucket,
},
`/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh' '/tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh'\nbash /tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh`,
`/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh' '/tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh'\nbash /tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh`,
]),
],
},
Expand Down
20 changes: 10 additions & 10 deletions packages/aws-rfdk/lib/core/test/mongodb-instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
X509CertificatePem,
} from '../lib';
import {
CWA_ASSET_LINUX, INSTALL_MONGODB_3_6_SCRIPT_LINUX, MONGODB_3_6_CONFIGURATION_SCRIPTS, MOUNT_EBS_SCRIPT_LINUX,
CWA_ASSET_LINUX, INSTALL_MONGODB_8_0_SCRIPT_LINUX, MONGODB_8_0_CONFIGURATION_SCRIPTS, MOUNT_EBS_SCRIPT_LINUX,
} from './asset-constants';
import {
testConstructTags,
Expand All @@ -61,7 +61,7 @@ describe('Test MongoDbInstance', () => {

const hostname = 'hostname';
const zoneName = 'testZone';
const version = MongoDbVersion.COMMUNITY_3_6;
const version = MongoDbVersion.COMMUNITY_8_0;
const userSsplAcceptance = MongoDbSsplLicenseAcceptance.USER_ACCEPTS_SSPL;

beforeEach(() => {
Expand Down Expand Up @@ -397,28 +397,28 @@ describe('Test MongoDbInstance', () => {
'popd\n' +
`rm -f /tmp/${MOUNT_EBS_SCRIPT_LINUX.Key}.zip\n` +
// Install MongoDB
`mkdir -p $(dirname '/tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh')\n` +
`mkdir -p $(dirname '/tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh')\n` +
'aws s3 cp \'s3://',
{
'Fn::Sub': INSTALL_MONGODB_3_6_SCRIPT_LINUX.Bucket,
'Fn::Sub': INSTALL_MONGODB_8_0_SCRIPT_LINUX.Bucket,
},
`/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh' '/tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh'\n` +
`bash /tmp/${INSTALL_MONGODB_3_6_SCRIPT_LINUX.Key}.sh\n` +
`/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh' '/tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh'\n` +
`bash /tmp/${INSTALL_MONGODB_8_0_SCRIPT_LINUX.Key}.sh\n` +
// Fetching the MongoDB configuration scripts
`mkdir -p $(dirname '/tmp/${MONGODB_3_6_CONFIGURATION_SCRIPTS.Key}.zip')\n` +
`mkdir -p $(dirname '/tmp/${MONGODB_8_0_CONFIGURATION_SCRIPTS.Key}.zip')\n` +
'aws s3 cp \'s3://',
{
'Fn::Sub': MONGODB_3_6_CONFIGURATION_SCRIPTS.Bucket,
'Fn::Sub': MONGODB_8_0_CONFIGURATION_SCRIPTS.Bucket,
},
`/${MONGODB_3_6_CONFIGURATION_SCRIPTS.Key}.zip' '/tmp/${MONGODB_3_6_CONFIGURATION_SCRIPTS.Key}.zip'\n` +
`/${MONGODB_8_0_CONFIGURATION_SCRIPTS.Key}.zip' '/tmp/${MONGODB_8_0_CONFIGURATION_SCRIPTS.Key}.zip'\n` +
// Configure MongoDB
'which mongod && test -f /etc/mongod.conf\n' +
'sudo service mongod stop\n' +
'MONGO_SETUP_DIR=$(mktemp -d)\n' +
'mkdir -p "${MONGO_SETUP_DIR}"\n' +
'sudo mount -t tmpfs -o size=50M tmpfs "${MONGO_SETUP_DIR}"\n' +
'pushd "${MONGO_SETUP_DIR}"\n' +
`unzip /tmp/${MONGODB_3_6_CONFIGURATION_SCRIPTS.Key}.zip\n` +
`unzip /tmp/${MONGODB_8_0_CONFIGURATION_SCRIPTS.Key}.zip\n` +
'cp /etc/mongod.conf .\n' +
// Getting the server certificate
'bash serverCertFromSecrets.sh \"',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('MongoDbPostInstall', () => {
beforeEach(() => {
const hostname = 'mongodb';
const zoneName = 'testZone.internal';
const version = MongoDbVersion.COMMUNITY_3_6;
const version = MongoDbVersion.COMMUNITY_8_0;
const userSsplAcceptance = MongoDbSsplLicenseAcceptance.USER_ACCEPTS_SSPL;

stack = new Stack();
Expand Down
Loading

0 comments on commit ef65da0

Please sign in to comment.