Skip to content

Commit

Permalink
feat(deadline): version query construct
Browse files Browse the repository at this point in the history
Fixes #176
  • Loading branch information
horsmand committed Oct 28, 2020
1 parent febe741 commit 7628be4
Show file tree
Hide file tree
Showing 31 changed files with 897 additions and 714 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
ThinkboxDockerRecipes,
UsageBasedLicense,
UsageBasedLicensing,
VersionQuery,
)


Expand Down Expand Up @@ -121,10 +122,10 @@ def __init__(self, scope: Construct, stack_id: str, *, props: ServiceTierProps,
self,
'Repository',
vpc=props.vpc,
version=recipes.version,
database=props.database,
file_system=props.file_system,
repository_installation_timeout=Duration.minutes(20)
repository_installation_timeout=Duration.minutes(20),
version=recipes.version,
)

server_cert = X509CertificatePem(
Expand All @@ -142,7 +143,6 @@ def __init__(self, scope: Construct, stack_id: str, *, props: ServiceTierProps,
self,
'RenderQueue',
vpc=props.vpc,
version=recipes.version,
images=recipes.render_queue_images,
repository=repository,
hostname=RenderQueueHostNameProps(
Expand All @@ -155,6 +155,7 @@ def __init__(self, scope: Construct, stack_id: str, *, props: ServiceTierProps,
),
internal_protocol=ApplicationProtocol.HTTPS
),
version=recipes.version,
# TODO - Evaluate deletion protection for your own needs. This is set to false to
# cleanly remove everything when this stack is destroyed. If you would like to ensure
# that this resource is not accidentally deleted, you should set this to true.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
IPrivateHostedZone,
} from '@aws-cdk/aws-route53';
import * as cdk from '@aws-cdk/core';
import {
import {
IMountableLinuxFilesystem,
X509CertificatePem,
} from 'aws-rfdk';
Expand All @@ -30,8 +30,8 @@ import {
UsageBasedLicense,
UsageBasedLicensing,
} from 'aws-rfdk/deadline';
import {
Secret
import {
Secret,
} from '@aws-cdk/aws-secretsmanager';
import { Duration } from '@aws-cdk/core';

Expand Down Expand Up @@ -150,7 +150,6 @@ export class ServiceTier extends cdk.Stack {
});
this.renderQueue = new RenderQueue(this, 'RenderQueue', {
vpc: props.vpc,
version: recipes.version,
images: recipes.renderQueueImages,
repository: repository,
hostname: {
Expand All @@ -163,14 +162,15 @@ export class ServiceTier extends cdk.Stack {
},
internalProtocol: ApplicationProtocol.HTTPS,
},
version: recipes.version,
// TODO - Evaluate deletion protection for your own needs. This is set to false to
// cleanly remove everything when this stack is destroyed. If you would like to ensure
// that this resource is not accidentally deleted, you should set this to true.
deletionProtection: false,
});
this.renderQueue.connections.allowDefaultPortFrom(this.bastion);

const ublCertSecret = Secret.fromSecretArn(this, 'UBLCertsSecret', props.ublCertsSecretArn);
const ublCertSecret = Secret.fromSecretArn(this, 'UBLCertsSecret', props.ublCertsSecretArn);
this.ublLicensing = new UsageBasedLicensing(this, 'UBLLicensing', {
vpc: props.vpc,
images: recipes.ublImages,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/

import { App, Stack } from '@aws-cdk/core';
import { VersionQuery } from 'aws-rfdk/deadline';

import { DatabaseType, StorageStruct } from '../../../../lib/storage-struct';
import { RepositoryTestingTier } from '../lib/repository-testing-tier';

Expand All @@ -17,17 +19,23 @@ const integStackTag = process.env.INTEG_STACK_TAG!.toString();

const componentTier = new Stack(app, 'RFDKInteg-DL-ComponentTier' + integStackTag, {env});

// This will get the installers for the latest version of Deadline
const version = new VersionQuery(componentTier, 'VersionQuery');

const structs: Array<StorageStruct> = [
new StorageStruct(componentTier, 'StorageStruct1', {
integStackTag,
version,
}),
new StorageStruct(componentTier, 'StorageStruct2', {
integStackTag,
databaseType: DatabaseType.DocDB,
version,
}),
new StorageStruct(componentTier, 'StorageStruct3', {
integStackTag,
databaseType: DatabaseType.MongoDB,
version,
}),
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/

import { App, Stack } from '@aws-cdk/core';
import { VersionQuery } from 'aws-rfdk/deadline';

import { RenderStruct } from '../../../../lib/render-struct';
import { DatabaseType, StorageStruct } from '../../../../lib/storage-struct';
import { RenderQueueTestingTier } from '../lib/renderQueue-testing-tier';
Expand All @@ -20,10 +22,14 @@ const integStackTag = process.env.INTEG_STACK_TAG!.toString();
// Create component stack
const componentTier = new Stack(app, 'RFDKInteg-RQ-ComponentTier' + integStackTag, {env});

// This will get the installers for the latest version of Deadline
const version = new VersionQuery(componentTier, 'VersionQuery');

// Add struct containing Deadline repository (the same repo is used for all test configurations)
const storage = new StorageStruct(componentTier, 'StorageStruct', {
integStackTag,
databaseType: DatabaseType.DocDB,
version,
});

const structs: Array<RenderStruct> = [
Expand All @@ -32,12 +38,14 @@ const structs: Array<RenderStruct> = [
integStackTag,
repository: storage.repo,
protocol: 'http',
version,
}),
//Create test struct for Render Queue in https mode
new RenderStruct(componentTier, 'RenderStructRQ2', {
integStackTag,
repository: storage.repo,
protocol: 'https',
version,
}),
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/

import { App, Stack } from '@aws-cdk/core';
import { VersionQuery } from 'aws-rfdk/deadline';

import { RenderStruct } from '../../../../lib/render-struct';
import { DatabaseType, StorageStruct } from '../../../../lib/storage-struct';
import { WorkerStruct } from '../../../../lib/worker-struct';
Expand All @@ -29,16 +31,22 @@ oss.forEach( os => {
const testId = 'WF' + i.toString();
// Create component stack for structs
const componentTier = new Stack(app, 'RFDKInteg-' + testId + '-ComponentTier' + integStackTag, {env});

// This will get the installers for the latest version of Deadline
const version = new VersionQuery(componentTier, 'VersionQuery');

// Create StorageStruct with repository
const storage = new StorageStruct(componentTier, 'StorageStruct' + testId, {
integStackTag,
databaseType: DatabaseType.DocDB,
version,
});
// Create render queue with either HTTP or HTTPS protocol
const render = new RenderStruct(componentTier, 'RenderStruct' + testId, {
integStackTag,
repository: storage.repo,
protocol,
version,
});
// Create worker struct containing three nodes using either Linux or Windows
structs.push(new WorkerStruct(componentTier, 'WorkerStruct' + testId, {
Expand Down
11 changes: 9 additions & 2 deletions integ/lib/render-struct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ import { ApplicationProtocol } from '@aws-cdk/aws-elasticloadbalancingv2';
import { PrivateHostedZone } from '@aws-cdk/aws-route53';
import { Construct, Stack } from '@aws-cdk/core';
import { X509CertificatePem } from 'aws-rfdk';
import { IRepository, RenderQueue, Stage, ThinkboxDockerRecipes } from 'aws-rfdk/deadline';
import {
IRepository,
IVersion,
RenderQueue,
Stage,
ThinkboxDockerRecipes,
} from 'aws-rfdk/deadline';

export interface RenderStructProps {
readonly integStackTag: string;
readonly repository: IRepository;
readonly protocol: string;
readonly version: IVersion
}

export class RenderStruct extends Construct {
Expand Down Expand Up @@ -79,11 +86,11 @@ export class RenderStruct extends Construct {
vpc,
repository: props.repository,
images: recipes.renderQueueImages,
version: recipes.version,
logGroupProps: {
logGroupPrefix: Stack.of(this).stackName + '-' + id,
},
hostname,
version: props.version,
trafficEncryption,
deletionProtection: false,
};
Expand Down
41 changes: 29 additions & 12 deletions integ/lib/storage-struct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,36 @@
*/

import { DatabaseCluster } from '@aws-cdk/aws-docdb';
import { InstanceClass, InstanceSize, InstanceType, Vpc, SubnetType } from '@aws-cdk/aws-ec2';
import {
InstanceClass,
InstanceSize,
InstanceType,
Vpc,
SubnetType,
} from '@aws-cdk/aws-ec2';
import { FileSystem } from '@aws-cdk/aws-efs';
import { PrivateHostedZone } from '@aws-cdk/aws-route53';
import { ISecret } from '@aws-cdk/aws-secretsmanager';
import { Construct, Duration, RemovalPolicy, Stack } from '@aws-cdk/core';
import { MongoDbInstance, MongoDbPostInstallSetup, MongoDbSsplLicenseAcceptance, MongoDbVersion, MountableEfs, X509CertificatePem, X509CertificatePkcs12 } from 'aws-rfdk';
import { DatabaseConnection, Repository, Stage, ThinkboxDockerRecipes } from 'aws-rfdk/deadline';
import {
Construct,
Duration,
RemovalPolicy,
Stack,
} from '@aws-cdk/core';
import {
MongoDbInstance,
MongoDbPostInstallSetup,
MongoDbSsplLicenseAcceptance,
MongoDbVersion,
MountableEfs,
X509CertificatePem,
X509CertificatePkcs12,
} from 'aws-rfdk';
import {
DatabaseConnection,
IVersion,
Repository,
} from 'aws-rfdk/deadline';


// Interface for supplying database connection and accompanying secret for credentials
Expand All @@ -27,6 +50,7 @@ export enum DatabaseType {

export interface StorageStructProps {
readonly integStackTag: string;
readonly version: IVersion;
readonly databaseType?: DatabaseType;
}

Expand All @@ -44,17 +68,10 @@ export class StorageStruct extends Construct {
userAcceptsSSPL === 'true' ? MongoDbSsplLicenseAcceptance.USER_ACCEPTS_SSPL : MongoDbSsplLicenseAcceptance.USER_REJECTS_SSPL;

const infrastructureStackName = 'RFDKIntegInfrastructure' + props.integStackTag;
const stagePath = process.env.DEADLINE_STAGING_PATH!.toString();

// Get farm VPC from lookup
const vpc = Vpc.fromLookup(this, 'Vpc', { tags: { StackName: infrastructureStackName }}) as Vpc;

// Create recipes object used to prepare the Deadline installers
const recipes = new ThinkboxDockerRecipes(this, 'DockerRecipes', {
stage: Stage.fromDirectory(stagePath),
});
const version = recipes.version;

let cacert;
let database;
let databaseConnection;
Expand Down Expand Up @@ -188,7 +205,7 @@ export class StorageStruct extends Construct {
vpc,
database: databaseConnection,
fileSystem: deadlineMountableEfs,
version: version,
version: props.version,
repositoryInstallationTimeout: Duration.minutes(20),
logGroupProps: {
logGroupPrefix: Stack.of(this).stackName + '-' + id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
* SPDX-License-Identifier: Apache-2.0
*/

export * from './version-provider';
export * from './version';
export * from './version-provider';
File renamed without changes.
Loading

0 comments on commit 7628be4

Please sign in to comment.