Skip to content

Commit

Permalink
feat: extend cloudfront configuration + update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Megakuul committed Jul 7, 2024
1 parent d6cb046 commit ba0392c
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 28 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/publish_adapter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ jobs:
with:
node-version: latest
- name: publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_ACCESS_TOKEN }}" > ~/.npmrc
cd adapter-battleshiper
npm ci
npm publish --access public
12 changes: 6 additions & 6 deletions adapter-battleshiper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
"description": "",
"keywords": [
"adapter",
"deploy",
"hosting",
"svelte",
"sveltekit",
"battleshiper"
"deploy",
"hosting",
"svelte",
"sveltekit",
"battleshiper"
],
"version": "0.1.0",
"author": "Megakuul",
"license": "MIT",
"private": false,
"repository": {
"type": "git",
"url": "https://github.com/megakuul/battleshiper",
"url": "git+https://github.com/megakuul/battleshiper.git",
"directory": "adapter-battleshiper"
},
"type": "module",
Expand Down
12 changes: 0 additions & 12 deletions buildspec.yaml

This file was deleted.

63 changes: 55 additions & 8 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ Resources:
ValidationMethod: "DNS"
DomainValidationOption:
- DomainName: !Sub "*.${ApplicationDomain}"
ValidationDomain: !Ref ApplicationDomain



Expand All @@ -579,23 +580,53 @@ Resources:
Properties:
DistributionConfig:
Enabled: true
PriceClass: "PriceClass_All"
ViewerCertificate:
AcmCertificateArn: !Ref BattleshiperCertificate
SslSupportMethod: "sni-only"
MinimumProtocolVersion: "TLSv1.2_2021"
Origins:
- Id: "battleshiper-static-bucket"
DomainName: !GetAtt BattleshiperStaticBucket.DomainName
OriginAccessControlId: !GetAtt BattleshiperCoreCDNOriginAccessControl.Id
S3OriginConfig: {}
- Id: "battleshiper-project-api-gateway"
DomainName: !GetAtt
DomainName: !GetAtt BattleshiperProjectApiGateway.DistributionDomainName
CustomOriginConfig:
OriginProtocolPolicy: "https-only"


DefaultCacheBehavior:
TargetOriginId: "battleshiper-project-api-gateway"
AllowedMethods:
- GET
- HEAD
- POST
ViewerProtocolPolicy: "redirect-to-https"
Compress: true
ViewerProtocolPolicy: redirect-to-https
FunctionAssociations: !TODO
CacheBehaviors:


- PathPattern: "/_app/*"
TargetOriginId: "battleshiper-static-bucket"
AllowedMethods:
- GET
- HEAD
CacheMethods:
- GET
- HEAD
Compress: true
ViewerProtocolPolicy: redirect-to-https
FunctionAssociations: !TODO
- PathPattern: "/*.*"
TargetOriginId: "battleshiper-static-bucket"
AllowedMethods:
- GET
- HEAD
CacheMethods:
- GET
- HEAD
Compress: true
ViewerProtocolPolicy: redirect-to-https
FunctionAssociations: !TODO
Aliases:
- !Sub "*.${ApplicationDomain}"
Tags:
Expand All @@ -619,12 +650,20 @@ Resources:
Enabled: true
PriceClass: "PriceClass_All"
ViewerCertificate:
AcmCertificateArn:
AcmCertificateArn: !Ref BattleshiperCertificate
SslSupportMethod: "sni-only"
MinimumProtocolVersion: "TLSv1.2_2021"
Origins:
- Id: "battleshiper-static-bucket"
DomainName: !GetAtt BattleshiperStaticBucket.DomainName
OriginAccessControlId: !GetAtt BattleshiperPrerenderCDNOriginAccessControl.Id
S3OriginConfig: {}
DefaultCacheBehavior:
TargetOriginId: "battleshiper-static-bucket"
AllowedMethods:
- GET
- HEAD
ViewerProtocolPolicy: redirect-to-https
Aliases:
- !Sub "prerender.${ApplicationDomain}"
Tags:
Expand All @@ -637,5 +676,13 @@ Outputs:
Value: !Sub "https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/api"

BattleshiperDbAdminSecret:
Description: "Secret where the credentials of the database admin are"
Value: !Ref BattleshiperDbAdminSecret
Description: "Secret where the credentials of the database admin are stored"
Value: !Ref BattleshiperDbAdminSecret

CertificateDomainValidation:
Description: "Domain options to validate the certificate via DNS."
Value: !Join
- "\n"
- - !GetAtt BattleshiperCertificate.DomainValidationOptions[0].ResourceRecord.Name
- - !GetAtt BattleshiperCertificate.DomainValidationOptions[0].ResourceRecord.Type
- - !GetAtt BattleshiperCertificate.DomainValidationOptions[0].ResourceRecord.Value

0 comments on commit ba0392c

Please sign in to comment.