Skip to content

Commit

Permalink
feat(cdk): upgrade cdk version, refactor ad-hoc example directory
Browse files Browse the repository at this point in the history
  • Loading branch information
briancaffey committed Feb 25, 2024
1 parent dd6c331 commit 7bf723b
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .projen/deps.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .projenrc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
authorUrl: 'https://briancaffey.github.io',
license: 'MIT',
copyrightOwner: 'Brian Caffey',
cdkVersion: '2.49.0',
cdkVersion: '2.130.0',
defaultReleaseBranch: 'main',
name: 'cdk-django',
repositoryUrl: 'git@github.com:briancaffey/cdk-django.git',
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
## ad hoc base cdk commands
ad-hoc-base-synth:
cdk synth --app='lib/examples/ad-hoc/base/index.js' -e ExampleAdHocBaseStack
cdk synth --app='lib/examples/ad-hoc/index.js' -e ExampleAdHocBaseStack

ad-hoc-base-diff:
cdk diff --app='./lib/examples/ad-hoc/base/index.js' -e ExampleAdHocBaseStack
cdk diff --app='./lib/examples/ad-hoc/index.js' -e ExampleAdHocBaseStack

ad-hoc-base-deploy:
cdk deploy --app='./lib/examples/ad-hoc/base/index.js' -e ExampleAdHocBaseStack
cdk deploy --app='./lib/examples/ad-hoc/index.js' -e ExampleAdHocBaseStack

ad-hoc-base-deploy-approve:
cdk deploy --app='./lib/examples/ad-hoc/base/index.js' --require-approval never -e ExampleAdHocBaseStack
cdk deploy --app='./lib/examples/ad-hoc/index.js' --require-approval never -e ExampleAdHocBaseStack

ad-hoc-base-destroy:
cdk destroy --app='./lib/examples/ad-hoc/base/index.js' --require-approval never -e ExampleAdHocBaseStack
yes | cdk destroy --app='./lib/examples/ad-hoc/index.js' -e ExampleAdHocBaseStack

## ad hoc app cdk commands
ad-hoc-app-synth:
cdk synth --app='./lib/examples/ad-hoc/base/index.js' -e ExampleAdHocAppStack
cdk synth --app='./lib/examples/ad-hoc/index.js' -e ExampleAdHocAppStack

ad-hoc-app-diff:
cdk diff --app='./lib/examples/ad-hoc/base/index.js' -e ExampleAdHocAppStack
cdk diff --app='./lib/examples/ad-hoc/index.js' -e ExampleAdHocAppStack

ad-hoc-app-deploy:
cdk deploy --app='./lib/examples/ad-hoc/base/index.js' -e ExampleAdHocAppStack
cdk deploy --app='./lib/examples/ad-hoc/index.js' -e ExampleAdHocAppStack

# TODO: make sure this includes all services including beat
ad-hoc-app-delete-services:
Expand All @@ -33,4 +33,4 @@ ad-hoc-app-delete-services:
aws ecs delete-service --cluster alpha-cluster --service alpha-gunicorn --force

ad-hoc-app-destroy: ad-hoc-app-delete-services
cdk destroy --app='./lib/examples/ad-hoc/base/index.js' -e ExampleAdHocAppStack
cdk destroy --app='./lib/examples/ad-hoc/index.js' -e ExampleAdHocAppStack
4 changes: 2 additions & 2 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/constructs/internal/rds/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class RdsInstance extends Construct {
const rdsInstance = new DatabaseInstance(this, 'RdsInstance', {
instanceIdentifier: `${stackName}RdsInstance`,
vpc: props.vpc,
engine: DatabaseInstanceEngine.postgres({ version: PostgresEngineVersion.VER_13_4 }),
engine: DatabaseInstanceEngine.postgres({ version: PostgresEngineVersion.of('16.1', '16') }),
credentials: Credentials.fromSecret(secret),
instanceType,
port: 5432,
Expand Down
3 changes: 3 additions & 0 deletions src/examples/ad-hoc/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# copy this file to .env in this directory and run before using cdk commands
export ACM_CERTIFICATE_ARN=arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012
export DOMAIN_NAME=example.com
File renamed without changes.
6 changes: 0 additions & 6 deletions src/examples/ad-hoc/app/config/alpha.json

This file was deleted.

Empty file removed src/examples/ad-hoc/app/index.ts
Empty file.
3 changes: 0 additions & 3 deletions src/examples/ad-hoc/base/.env.example

This file was deleted.

1 change: 1 addition & 0 deletions src/examples/ad-hoc/config/alpha.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as fs from 'fs';
import { App, Stack, Tags } from 'aws-cdk-lib';
import { AdHocApp } from '../../../constructs/ad-hoc/app';
import { AdHocBase } from '../../../constructs/ad-hoc/base';
import { AdHocApp } from '../../constructs/ad-hoc/app';
import { AdHocBase } from '../../constructs/ad-hoc/base';

const adHocBaseEnvName = process.env.AD_HOC_BASE_NAME || 'dev';
const adHocAppEnvName = process.env.AD_HOC_APP_NAME || 'alpha';

// TODO: define interfaces for these config and type check them
var adHocBaseEnvConfig = JSON.parse(fs.readFileSync(`src/examples/ad-hoc/base/config/${adHocBaseEnvName}.json`, 'utf8'));
var adHocAppEnvConfig = JSON.parse(fs.readFileSync(`src/examples/ad-hoc/app/config/${adHocAppEnvName}.json`, 'utf8'));
var adHocBaseEnvConfig = JSON.parse(fs.readFileSync(`src/examples/ad-hoc/config/${adHocBaseEnvName}.json`, 'utf8'));
var adHocAppEnvConfig = JSON.parse(fs.readFileSync(`src/examples/ad-hoc/config/${adHocAppEnvName}.json`, 'utf8'));

// https://docs.aws.amazon.com/cdk/v2/guide/stack_how_to_create_multiple_stacks.html
const app = new App();
Expand Down
100 changes: 72 additions & 28 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7bf723b

Please sign in to comment.