Skip to content

Commit

Permalink
fix: Set Amazon Linux version based on Deadline Repository version (#…
Browse files Browse the repository at this point in the history
…1419)

Signed-off-by: Caden Marofke <132690522+marofke@users.noreply.github.com>
  • Loading branch information
marofke authored Jan 8, 2025
1 parent 625f322 commit 822ee19
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/aws-rfdk/lib/core/lib/mongodb-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,8 @@ export class MongoDbInstance extends Construct implements IMongoDb, IGrantable {
`bash ./setStoragePath.sh "${MongoDbInstance.MONGO_DEVICE_MOUNT_POINT}"`,
'bash ./setMongoNoAuth.sh',
'sudo service mongod start',
// Ensure the mongo service started
'sudo service mongod status',
`bash ./setAdminCredentials.sh "${this.adminUser.secretArn}"`,
);
this.adminUser.grantRead(instance.grantPrincipal);
Expand Down
1 change: 1 addition & 0 deletions packages/aws-rfdk/lib/core/test/mongodb-instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ describe('Test MongoDbInstance', () => {
'bash ./setStoragePath.sh "/var/lib/mongo"\n' +
'bash ./setMongoNoAuth.sh\n' +
'sudo service mongod start\n' +
'sudo service mongod status\n' +
'bash ./setAdminCredentials.sh \"',
{
Ref: Match.stringLikeRegexp('^MongoDbInstanceAdminUser.*'),
Expand Down
15 changes: 14 additions & 1 deletion packages/aws-rfdk/lib/deadline/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ export class Repository extends Construct implements IRepository {
this.installerGroup = new AutoScalingGroup(this, 'Installer', {
instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE),
machineImage: new AmazonLinuxImage({
generation: AmazonLinuxGeneration.AMAZON_LINUX_2023,
generation: this.getAmazonLinuxGenerationForDeadlineVersion(this.version),
}),
vpc: props.vpc,
vpcSubnets: props.vpcSubnets ?? {
Expand Down Expand Up @@ -1057,4 +1057,17 @@ export class Repository extends Construct implements IRepository {
args: installerArgs,
});
}

/**
* Return an AmazonLinuxGeneration that can run the specified version of Deadline.
*/
private getAmazonLinuxGenerationForDeadlineVersion(deadlineVersion: IVersion): AmazonLinuxGeneration {
const REMOVED_SUPPORT_FOR_AMAZON_LINUX_2 = new Version([10, 4, 0, 0]);

if (deadlineVersion.isLessThan(REMOVED_SUPPORT_FOR_AMAZON_LINUX_2)) {
return AmazonLinuxGeneration.AMAZON_LINUX_2;
} else {
return AmazonLinuxGeneration.AMAZON_LINUX_2023;
}
}
}

0 comments on commit 822ee19

Please sign in to comment.