-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: #2519 deploy pipeline for web-components
- Loading branch information
Showing
7 changed files
with
197 additions
and
271 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# https://www.npmjs.com/package/serverless-single-page-app-plugin | ||
service: cloud-web-components | ||
|
||
plugins: | ||
- serverless-single-page-app-plugin | ||
- serverless-plugin-ifelse | ||
- serverless-deployment-bucket | ||
- serverless-s3-remover | ||
- serverless-s3-deploy | ||
|
||
custom: | ||
s3WebAppBucket: cloud-web-components-web-app-${opt:stage, 'dev'} | ||
s3CloudFormBucket: cloud-deployment-cloudform-templates-${opt:stage, 'dev'} | ||
remover: | ||
buckets: | ||
- ${self:custom.s3WebAppBucket} | ||
assets: | ||
auto: true | ||
targets: | ||
- bucket: ${self:custom.s3WebAppBucket} | ||
files: | ||
- source: ./public/dist/ | ||
globs: '**/*' | ||
|
||
provider: | ||
name: aws | ||
runtime: nodejs12.x | ||
stage: ${opt:stage, 'dev'} | ||
region: eu-west-2 | ||
deploymentBucket: | ||
name: ${self:custom.s3CloudFormBucket} | ||
|
||
resources: | ||
Resources: | ||
## Specifying the S3 Bucket | ||
WebAppS3Bucket: | ||
Type: AWS::S3::Bucket | ||
Properties: | ||
BucketName: ${self:custom.s3WebAppBucket} | ||
AccessControl: PublicRead | ||
WebsiteConfiguration: | ||
IndexDocument: index.html | ||
ErrorDocument: error.html | ||
|
||
## Specifying the policies to make sure all files inside the Bucket are available to CloudFront | ||
WebAppS3BucketPolicy: | ||
Type: AWS::S3::BucketPolicy | ||
Properties: | ||
Bucket: | ||
Ref: WebAppS3Bucket | ||
PolicyDocument: | ||
Statement: | ||
- Sid: PublicReadGetObject | ||
Effect: Allow | ||
Principal: "*" | ||
Action: | ||
- s3:GetObject | ||
Resource: | ||
Fn::Join: [ | ||
"", [ | ||
"arn:aws:s3:::", | ||
{ "Ref": "WebAppS3Bucket" }, | ||
"/*" | ||
] | ||
] | ||
|
||
## Specifying the CloudFront Distribution to server your Web Application | ||
WebAppCloudFrontDistribution: | ||
Type: AWS::CloudFront::Distribution | ||
Properties: | ||
DistributionConfig: | ||
Origins: | ||
- DomainName: | ||
Fn::Join: [ | ||
"", [ | ||
{ "Ref": "WebAppS3Bucket" }, | ||
".s3.amazonaws.com" | ||
] | ||
] | ||
Id: S3-${self:custom.s3WebAppBucket} | ||
CustomOriginConfig: | ||
HTTPPort: 80 | ||
HTTPSPort: 443 | ||
OriginProtocolPolicy: https-only | ||
## In case you want to restrict the bucket access use S3OriginConfig and remove CustomOriginConfig | ||
# S3OriginConfig: | ||
# OriginAccessIdentity: origin-access-identity/cloudfront/E127EXAMPLE51Z | ||
Enabled: 'true' | ||
## Uncomment the following section in case you are using a custom domain | ||
# Aliases: | ||
# If: '"${opt:stage, 'dev'}" == "dev"' | ||
# Set: | ||
# - dev.admin-portal.reapit.cloud | ||
# ElseSet: | ||
# - admin-portal.reapit.cloud | ||
DefaultRootObject: index.html | ||
CustomErrorResponses: | ||
- ErrorCode: 404 | ||
ResponseCode: 200 | ||
ResponsePagePath: /index.html | ||
- ErrorCode: 403 | ||
ResponseCode: 200 | ||
ResponsePagePath: /index.html | ||
- ErrorCode: 400 | ||
ResponseCode: 200 | ||
ResponsePagePath: /index.html | ||
DefaultCacheBehavior: | ||
AllowedMethods: | ||
- GET | ||
- HEAD | ||
- OPTIONS | ||
TargetOriginId: S3-${self:custom.s3WebAppBucket} | ||
ForwardedValues: | ||
QueryString: 'false' | ||
Cookies: | ||
Forward: none | ||
ViewerProtocolPolicy: redirect-to-https | ||
ViewerCertificate: | ||
CloudFrontDefaultCertificate: 'true' | ||
# Logging: | ||
# IncludeCookies: 'false' | ||
# Bucket: mylogs.s3.amazonaws.com | ||
# Prefix: myprefix | ||
Outputs: | ||
WebAppCloudFrontDistributionOutput: | ||
Value: | ||
'Fn::GetAtt': [ WebAppCloudFrontDistribution, DomainName ] |
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
Oops, something went wrong.