-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #878 from aehrc/deploy-transform
Add transform endpoint on ehr proxy deployment
- Loading branch information
Showing
10 changed files
with
179 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.js | ||
!jest.config.js | ||
*.d.ts | ||
node_modules | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.ts | ||
!*.d.ts | ||
|
||
# CDK asset staging directory | ||
.cdk.staging | ||
cdk.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Welcome to your CDK TypeScript project | ||
|
||
This is a blank project for CDK development with TypeScript. | ||
|
||
The `cdk.json` file tells the CDK Toolkit how to execute your app. | ||
|
||
## Useful commands | ||
|
||
* `npm run build` compile typescript to js | ||
* `npm run watch` watch for changes and compile | ||
* `npm run test` perform the jest unit tests | ||
* `cdk deploy` deploy this stack to your default AWS account/region | ||
* `cdk diff` compare deployed stack with current state | ||
* `cdk synth` emits the synthesized CloudFormation template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
testEnvironment: 'node', | ||
roots: ['<rootDir>/test'], | ||
testMatch: ['**/*.test.ts'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { | ||
AwsLogDriver, | ||
Cluster, | ||
Compatibility, | ||
ContainerImage, | ||
FargateService, | ||
TaskDefinition | ||
} from 'aws-cdk-lib/aws-ecs'; | ||
import { Construct } from 'constructs'; | ||
import { RetentionDays } from 'aws-cdk-lib/aws-logs'; | ||
|
||
export interface TransformEndpointProps { | ||
cluster: Cluster; | ||
} | ||
|
||
export class TransformEndpoint extends Construct { | ||
containerName = 'ehr-proxy-transform'; | ||
containerPort = 80; | ||
service: FargateService; | ||
|
||
constructor(scope: Construct, id: string, props: TransformEndpointProps) { | ||
super(scope, id); | ||
|
||
const { cluster } = props; | ||
|
||
// Create a task definition that contains both the application and cache containers. | ||
const taskDefinition = new TaskDefinition(this, 'EhrProxyTransformTaskDefinition', { | ||
compatibility: Compatibility.FARGATE, | ||
cpu: '256', | ||
memoryMiB: '512' | ||
}); | ||
|
||
// Create the cache container. | ||
taskDefinition.addContainer('EhrProxyTransformContainer', { | ||
containerName: this.containerName, | ||
image: ContainerImage.fromRegistry('yeexianfong/demo-map-server:latest'), | ||
portMappings: [{ containerPort: this.containerPort }], | ||
logging: AwsLogDriver.awsLogs({ | ||
streamPrefix: 'ehr-proxy-transform', | ||
logRetention: RetentionDays.ONE_MONTH | ||
}) | ||
}); | ||
|
||
this.service = new FargateService(this, 'EhrProxyTransformService', { | ||
cluster, | ||
taskDefinition | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "ehr-proxy-transform-endpoint", | ||
"version": "0.1.0", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
"build": "tsc", | ||
"watch": "tsc -w", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.5", | ||
"@types/node": "20.14.2", | ||
"aws-cdk-lib": "2.104.0", | ||
"constructs": "^10.0.0", | ||
"jest": "^29.7.0", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "~5.2.2" | ||
}, | ||
"dependencies": { | ||
"aws-cdk-lib": "2.104.0", | ||
"constructs": "^10.0.0", | ||
"source-map-support": "^0.5.21" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"module": "commonjs", | ||
"lib": ["es2020", "dom"], | ||
"declaration": true, | ||
"strict": true, | ||
"noImplicitAny": true, | ||
"strictNullChecks": true, | ||
"noImplicitThis": true, | ||
"alwaysStrict": true, | ||
"noUnusedLocals": false, | ||
"noUnusedParameters": false, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": false, | ||
"inlineSourceMap": true, | ||
"inlineSources": true, | ||
"experimentalDecorators": true, | ||
"strictPropertyInitialization": false, | ||
"typeRoots": ["./node_modules/@types"] | ||
}, | ||
"exclude": ["node_modules", "cdk.out"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.