Skip to content

Commit

Permalink
feat(deadline): versionquery construct (#175)
Browse files Browse the repository at this point in the history
Fixes #176
  • Loading branch information
horsmand authored Nov 5, 2020
1 parent 0c1b37c commit 78dcd86
Show file tree
Hide file tree
Showing 33 changed files with 1,035 additions and 755 deletions.
37 changes: 26 additions & 11 deletions examples/deadline/All-In-AWS-Infrastructure-Basic/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,45 @@ These instructions assume that your working directory is `examples/deadline/All-

---

1. Install the dependencies of the sample app:
1. This sample app on the `mainline` branch may contain features that have not yet been officially released, and may not be available in the `aws-rfdk` package installed through pip from PyPI. To work from an example of the latest release, please switch to the `release` branch. If you would like to try out unreleased features, you can stay on `mainline` and follow the instructions for building, packing, and installing the `aws-rfdk` from your local repository.
2. Install the dependencies of the sample app:

```bash
pip install -r requirements.txt
```
2. Change the value in the `deadline_client_linux_ami_map` variable in `package/config.py` to include the region + AMI ID mapping of your EC2 AMI(s) with Deadline Worker.
3. If working on the `release` branch, this step can be skipped. If working on `mainline`, navigate to the base directory where the build and packaging scripts are, then run them and install the result over top of the `aws-rfdk` version that was installed in the previous step:
```bash
# Navigate to the root directory of the RFDK repository
pushd ../../../..
# Enter the Docker container to run the build and pack scripts
./scripts/rfdk_build_environment.sh
./build.sh
./pack.sh
# Exit the Docker container
exit
# Navigate back to the example directory
popd
pip install ../../../../dist/python/aws-rfdk-<version>.tar.gz
```
4. Change the value in the `deadline_client_linux_ami_map` variable in `package/config.py` to include the region + AMI ID mapping of your EC2 AMI(s) with Deadline Worker.

```python
# For example, in the us-west-2 region
self.deadline_client_linux_ami_map: Mapping[str, str] = {
'us-west-2': '<your ami id>'
}
```
3. Create a binary secret in [SecretsManager](https://aws.amazon.com/secrets-manager/) that contains your [Usage-Based Licensing](https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/aws-portal/licensing-setup.html?highlight=usage%20based%20licensing) certificates in a `.zip` file:
5. Create a binary secret in [SecretsManager](https://aws.amazon.com/secrets-manager/) that contains your [Usage-Based Licensing](https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/aws-portal/licensing-setup.html?highlight=usage%20based%20licensing) certificates in a `.zip` file:

```bash
aws secretsmanager create-secret --name <name> --secret-binary fileb://<path-to-zip-file>
```
4. The output from the previous step will contain the secret's ARN. Change the value of the `ubl_certificate_secret_arn` variable in `package/config.py` to the secret's ARN:
6. The output from the previous step will contain the secret's ARN. Change the value of the `ubl_certificate_secret_arn` variable in `package/config.py` to the secret's ARN:

```python
self.ubl_certificate_secret_arn: str = '<your secret arn>'
```
5. Choose your UBL limits and change the value of the `ubl_licenses` variable in `package/config.py` accordingly. For example:
7. Choose your UBL limits and change the value of the `ubl_licenses` variable in `package/config.py` accordingly. For example:

```python
self.ubl_licenses: List[UsageBasedLicense] = [
Expand All @@ -54,33 +69,33 @@ These instructions assume that your working directory is `examples/deadline/All-
**Note:** The next two steps are optional. You may skip these if you do not need SSH access into your render farm.

---
6. Create an EC2 key pair to give you SSH access to the render farm:
8. Create an EC2 key pair to give you SSH access to the render farm:

```bash
aws ec2 create-key-pair --key-name <key-name>
```
7. Change the value of the `key_pair_name` variable in `package/config.py` to your value for `<key-name>` in the previous step:
9. Change the value of the `key_pair_name` variable in `package/config.py` to your value for `<key-name>` in the previous step:

**Note:** Save the value of the `"KeyMaterial"` field as a file in a secure location. This is your private key that you can use to SSH into the render farm.

```python
self.key_pair_name: Optional[str] = '<your key pair name>'
```
8. Choose the type of database you would like to deploy (AWS DocumentDB or MongoDB).
10. Choose the type of database you would like to deploy (AWS DocumentDB or MongoDB).
If you would like to use MongoDB, you will need to accept the Mongo SSPL (see next step).
Once you've decided on a database type, change the value of the `deploy_mongo_db` variable in `package/config.py` accordingly:
```python
# True = MongoDB, False = Amazon DocumentDB
self.deploy_mongo_db: bool = False
```
9. If you set `deploy_mongo_db` to `True`, then you must accept the [SSPL license](https://www.mongodb.com/licensing/server-side-public-license) to successfully deploy MongoDB. To do so, change the value of `accept_sspl_license` in `package/config.py`:
11. If you set `deploy_mongo_db` to `True`, then you must accept the [SSPL license](https://www.mongodb.com/licensing/server-side-public-license) to successfully deploy MongoDB. To do so, change the value of `accept_sspl_license` in `package/config.py`:
```python
# To accept the MongoDB SSPL, change from USER_REJECTS_SSPL to USER_ACCEPTS_SSPL
self.accept_sspl_license: MongoDbSsplLicenseAcceptance = MongoDbSsplLicenseAcceptance.USER_REJECTS_SSPL
```
10. Stage the Docker recipes for `RenderQueue` and `UBLLicensing`:
12. Stage the Docker recipes for `RenderQueue` and `UBLLicensing`:
```bash
# Set this value to the version of RFDK your application targets
Expand All @@ -94,7 +109,7 @@ These instructions assume that your working directory is `examples/deadline/All-
--dockerRecipesURI s3://thinkbox-installers/DeadlineDocker/${RFDK_DEADLINE_VERSION}/DeadlineDocker-${RFDK_DEADLINE_VERSION}.tar.gz \
--output stage
```
11. Deploy all the stacks in the sample app:
12. Deploy all the stacks in the sample app:
```bash
cdk deploy "*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,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 +142,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 +154,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
39 changes: 24 additions & 15 deletions examples/deadline/All-In-AWS-Infrastructure-Basic/ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ These instructions assume that your working directory is `examples/deadline/All-

---

1. Install the dependencies of the sample app:
1. This sample app on the `mainline` branch may contain features that have not yet been officially released, and may not be available in the `aws-rfdk` package installed through npm from npmjs. To work from an example of the latest release, please switch to the `release` branch. If you would like to try out unreleased features, you can stay on `mainline` and follow the instructions for building and using the `aws-rfdk` from your local repository.
2. Install the dependencies of the sample app:

```
yarn install
```
2. Change the value in the `deadlineClientLinuxAmiMap` variable in `bin/config.ts` to include the region + AMI ID mapping of your EC2 AMI(s) with Deadline Worker.
3. Change the value in the `deadlineClientLinuxAmiMap` variable in `bin/config.ts` to include the region + AMI ID mapping of your EC2 AMI(s) with Deadline Worker.

```ts
// For example, in the us-west-2 region
Expand All @@ -26,17 +27,17 @@ These instructions assume that your working directory is `examples/deadline/All-
// ...
};
```
3. Create a binary secret in [SecretsManager](https://aws.amazon.com/secrets-manager/) that contains your [Usage-Based Licensing](https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/aws-portal/licensing-setup.html?highlight=usage%20based%20licensing) certificates in a `.zip` file:
4. Create a binary secret in [SecretsManager](https://aws.amazon.com/secrets-manager/) that contains your [Usage-Based Licensing](https://docs.thinkboxsoftware.com/products/deadline/10.1/1_User%20Manual/manual/aws-portal/licensing-setup.html?highlight=usage%20based%20licensing) certificates in a `.zip` file:

```
aws secretsmanager create-secret --name <name> --secret-binary fileb://<path-to-zip-file>
```
4. The output from the previous step will contain the secret's ARN. Change the value of the `ublCertificatesSecretArn` variable in `bin/config.ts` to the secret's ARN:
5. The output from the previous step will contain the secret's ARN. Change the value of the `ublCertificatesSecretArn` variable in `bin/config.ts` to the secret's ARN:

```ts
public readonly ublCertificatesSecretArn: string = '<your-secret-arn>';
```
5. Choose your UBL limits and change the value of the `ublLicenses` variable in `bin/config.ts` accordingly. For example:
6. Choose your UBL limits and change the value of the `ublLicenses` variable in `bin/config.ts` accordingly. For example:

```ts
public readonly ublLicenses: UsageBasedLicense[] = [
Expand All @@ -55,48 +56,56 @@ These instructions assume that your working directory is `examples/deadline/All-
**Note:** The next two steps are optional. You may skip these if you do not need SSH access into your render farm.

---
6. Create an EC2 key pair to give you SSH access to the render farm:
7. Create an EC2 key pair to give you SSH access to the render farm:

```
aws ec2 create-key-pair --key-name <key-name>
```
7. Change the value of the `keyPairName` variable in `bin/config.ts` to your value for `<key-name>` in the previous step:
8. Change the value of the `keyPairName` variable in `bin/config.ts` to your value for `<key-name>` in the previous step:

**Note:** Save the value of the `"KeyMaterial"` field as a file in a secure location. This is your private key that you can use to SSH into the render farm.

```ts
public readonly keyPairName: string = '<key-name>';
```
8. Choose the type of database you would like to deploy (AWS DocumentDB or MongoDB).
9. Choose the type of database you would like to deploy (AWS DocumentDB or MongoDB).
If you would like to use MongoDB, you will need to accept the Mongo SSPL (see next step).
Once you've decided on a database type, change the value of the `deployMongoDB` variable in `bin/config.ts` accordingly:

```ts
// true = MongoDB, false = Amazon DocumentDB
public readonly deployMongoDB: boolean = false;
```
9. If you set `deployMongoDB` to `true`, then you must accept the [SSPL license](https://www.mongodb.com/licensing/server-side-public-license) to successfully deploy MongoDB. To do so, change the value of `acceptSsplLicense` in `bin/config.ts`:
10. If you set `deployMongoDB` to `true`, then you must accept the [SSPL license](https://www.mongodb.com/licensing/server-side-public-license) to successfully deploy MongoDB. To do so, change the value of `acceptSsplLicense` in `bin/config.ts`:

```ts
// To accept the MongoDB SSPL, change from USER_REJECTS_SSPL to USER_ACCEPTS_SSPL
public readonly acceptSsplLicense: MongoDbSsplLicenseAcceptance = MongoDbSsplLicenseAcceptance.USER_REJECTS_SSPL;
```
10. Modify the `deadline_ver` field in the `config` block of `package.json` as desired (Deadline 10.1.9 and up are supported), then stage the Docker recipes for `RenderQueue` and `UBLLicensing`:
11. Modify the `deadline_ver` field in the `config` block of `package.json` as desired (Deadline 10.1.9 and up are supported), then stage the Docker recipes for `RenderQueue` and `UBLLicensing`:

```
yarn stage
```
11. Build the sample app:

```
12. Build the `aws-rfdk` package, and then build the sample app. There is some magic in the way yarn workspaces and lerna packages work that will link the built `aws-rfdk` from the base directory as the dependency to be used in the example's directory:
```bash
# Navigate to the root directory of the RFDK repository (assumes you started in the example's directory)
pushd ../../../..
# Enter the Docker container, run the build, and then exit
./scripts/rfdk_build_environment.sh
./build.sh
exit
# Navigate back to the example directory
popd
# Run the example's build
yarn build
```
12. Deploy all the stacks in the sample app:
13. Deploy all the stacks in the sample app:

```
cdk deploy "*"
```
13. Once you are finished with the sample app, you can tear it down by running:
14. Once you are finished with the sample app, you can tear it down by running:

```
cdk destroy "*"
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,11 @@
*/

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

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

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

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

const stagePath = process.env.DEADLINE_STAGING_PATH!.toString();
// Stage docker recipes, which include the repo installer in (`recipes.version`)
const recipes = new ThinkboxDockerRecipes(componentTier, 'DockerRecipes', {
stage: Stage.fromDirectory(stagePath),
});

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

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

import { App, Stack } from '@aws-cdk/core';
import {
Stage,
ThinkboxDockerRecipes,
} 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 +25,18 @@ const integStackTag = process.env.INTEG_STACK_TAG!.toString();
// Create component stack
const componentTier = new Stack(app, 'RFDKInteg-RQ-ComponentTier' + integStackTag, {env});

const stagePath = process.env.DEADLINE_STAGING_PATH!.toString();
// Stage docker recipes, which include the image used for the render queue instance and the repo
// installer (in `recipes.version`)
const recipes = new ThinkboxDockerRecipes(componentTier, 'DockerRecipes', {
stage: Stage.fromDirectory(stagePath),
});

// 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: recipes.version,
});

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

Expand Down
Loading

0 comments on commit 78dcd86

Please sign in to comment.