-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update deployment workflows --------- Signed-off-by: Roy Scheeren <[email protected]>
- Loading branch information
1 parent
523bf5f
commit debc11b
Showing
9 changed files
with
141 additions
and
63 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,32 @@ | ||
{ | ||
"app": "npx ts-node cdk/bin/cdk.ts", | ||
"output": "../../dist/packages/docs.siwt.xyz/cdk", | ||
"requireApproval": "never", | ||
"watch": { | ||
"include": ["**"], | ||
"exclude": [ | ||
"README.md", | ||
"cdk*.json", | ||
"**/*.d.ts", | ||
"**/*.js", | ||
"tsconfig.json", | ||
"package*.json", | ||
"yarn.lock", | ||
"node_modules", | ||
"test" | ||
] | ||
}, | ||
"context": { | ||
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, | ||
"@aws-cdk/core:stackRelativeExports": true, | ||
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true, | ||
"@aws-cdk/aws-lambda:recognizeVersionProps": true, | ||
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, | ||
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, | ||
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, | ||
"@aws-cdk/core:checkSecretUsage": true, | ||
"@aws-cdk/aws-iam:minimizePolicies": true, | ||
"@aws-cdk/core:target-partitions": ["aws", "aws-cn"], | ||
"@aws-cdk/customresources:installLatestAwsSdkDefault": false | ||
} | ||
} |
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,12 @@ | ||
import { App } from 'aws-cdk-lib' | ||
|
||
import { AppStack } from '../lib/stack' | ||
|
||
const environment = process.env.ENV || 'staging' | ||
|
||
const app = new App() | ||
new AppStack(app, `docs-siwt-xyz-${environment}`, { | ||
env: { | ||
region: 'eu-central-1', | ||
}, | ||
}) |
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,64 @@ | ||
import { | ||
aws_certificatemanager as ACM, | ||
App, | ||
aws_cloudfront as Cloudfront, | ||
aws_cloudfront_origins as CloudfrontOrigins, | ||
Duration, | ||
RemovalPolicy, | ||
aws_s3 as S3, | ||
aws_s3_deployment as S3Deployment, | ||
Stack, | ||
StackProps, | ||
} from 'aws-cdk-lib' | ||
|
||
const environment = process.env.ENV || 'staging' | ||
|
||
export class AppStack extends Stack { | ||
constructor(scope: App, id: string, props?: StackProps) { | ||
super(scope, id, props) | ||
|
||
const bucket = new S3.Bucket(this, `docs-siwt-xyz-ui-bucket-${environment}`, { | ||
blockPublicAccess: S3.BlockPublicAccess.BLOCK_ALL, | ||
removalPolicy: RemovalPolicy.DESTROY, | ||
}) | ||
|
||
new S3Deployment.BucketDeployment(this, `docs-siwt-xyz-ui-bucket-deployment-${environment}`, { | ||
sources: [S3Deployment.Source.asset('../../dist/packages/docs.siwt.xyz', { exclude: ['cdk/**/*'] })], | ||
destinationBucket: bucket, | ||
}) | ||
|
||
const originAccessIdentity = new Cloudfront.OriginAccessIdentity(this, `docs-siwt-xyz-ui-oai-${environment}`) | ||
bucket.grantRead(originAccessIdentity) | ||
|
||
const certificate = ACM.Certificate.fromCertificateArn( | ||
this, | ||
`siwt-xyz-certificate-${environment}`, | ||
process.env.SSL_CERTIFICATE_ARN || '', | ||
) | ||
|
||
let distributionConfig: Cloudfront.DistributionProps = { | ||
defaultRootObject: 'index.html', | ||
defaultBehavior: { | ||
origin: new CloudfrontOrigins.S3Origin(bucket, { | ||
originAccessIdentity: originAccessIdentity, | ||
}), | ||
compress: true, | ||
allowedMethods: Cloudfront.AllowedMethods.ALLOW_GET_HEAD_OPTIONS, | ||
viewerProtocolPolicy: Cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS, | ||
cachePolicy: Cloudfront.CachePolicy.CACHING_OPTIMIZED, | ||
edgeLambdas: [], | ||
}, | ||
errorResponses: [ | ||
{ | ||
httpStatus: 404, | ||
responsePagePath: '/404.html', | ||
ttl: Duration.seconds(10), | ||
}, | ||
], | ||
domainNames: ['docs.siwt.xyz'], | ||
certificate, | ||
} | ||
|
||
new Cloudfront.Distribution(this, `siwt-xyz-ui-distribution-${environment}`, distributionConfig) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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