Skip to content

Commit 4896cd8

Browse files
committed
use same s3 bucket for frontend and swagger
1 parent b0d0e70 commit 4896cd8

File tree

3 files changed

+3
-31
lines changed

3 files changed

+3
-31
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ local:
7373
postdeploy:
7474
@echo "Syncing S3 UI bucket..."
7575
aws s3 sync $(dist_ui_directory_root) s3://$(ui_s3_bucket)/ --delete
76-
@echo "Syncing S3 Docs bucket..."
77-
aws s3 sync $(dist_docs_directory_root) s3://$(docs_s3_bucket)/ --delete
7876
make invalidate_cloudfront
7977

8078
deploy_prod: check_account_prod

cloudformation/main.yml

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,6 @@ Resources:
609609
Properties:
610610
BucketName: !Sub ${S3BucketPrefix}-ui
611611

612-
AppDocsS3Bucket:
613-
Type: AWS::S3::Bucket
614-
Properties:
615-
BucketName: !Sub ${S3BucketPrefix}-docs
616-
617612
AppCloudfrontS3OAC:
618613
Type: AWS::CloudFront::OriginAccessControl
619614
Properties:
@@ -634,11 +629,6 @@ Resources:
634629
S3OriginConfig:
635630
OriginAccessIdentity: ''
636631
OriginAccessControlId: !GetAtt AppCloudfrontS3OAC.Id
637-
- Id: S3DocsOrigin
638-
DomainName: !GetAtt AppDocsS3Bucket.RegionalDomainName
639-
S3OriginConfig:
640-
OriginAccessIdentity: ''
641-
OriginAccessControlId: !GetAtt AppCloudfrontS3OAC.Id
642632
- Id: LambdaOrigin
643633
DomainName: !Select [0, !Split ['/', !Select [1, !Split ['https://', !GetAtt AppLambdaUrl.FunctionUrl]]]]
644634
CustomOriginConfig:
@@ -711,7 +701,8 @@ Resources:
711701
Compress: true
712702
- PathPattern: "/api/documentation*"
713703
Compress: true
714-
TargetOriginId: S3DocsOrigin
704+
OriginPath: "/swagger"
705+
TargetOriginId: S3WebsiteOrigin
715706
ViewerProtocolPolicy: redirect-to-https
716707
AllowedMethods:
717708
- GET
@@ -770,23 +761,6 @@ Resources:
770761
StringEquals:
771762
AWS:SourceArn: !Sub "arn:aws:cloudfront::${AWS::AccountId}:distribution/${AppFrontendCloudfrontDistribution}"
772763

773-
AppDocsS3BucketPolicy:
774-
Type: AWS::S3::BucketPolicy
775-
Properties:
776-
Bucket: !Ref AppDocsS3Bucket
777-
PolicyDocument:
778-
Version: "2012-10-17"
779-
Statement:
780-
- Effect: Allow
781-
Principal:
782-
Service: cloudfront.amazonaws.com
783-
Action: s3:GetObject
784-
Resource: !Sub "${AppDocsS3Bucket.Arn}/*"
785-
Condition:
786-
StringEquals:
787-
AWS:SourceArn: !Sub "arn:aws:cloudfront::${AWS::AccountId}:distribution/${AppFrontendCloudfrontDistribution}"
788-
789-
790764
CloudfrontNoCachePolicy:
791765
Type: AWS::CloudFront::CachePolicy
792766
Properties:

src/api/createSwagger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async function createSwaggerFiles() {
3737
console.log("App is ready. Generating specs...");
3838
const __filename = fileURLToPath(import.meta.url);
3939
const __dirname = path.dirname(__filename);
40-
const outputDir = path.resolve(__dirname, "..", "..", "dist", "swagger");
40+
const outputDir = path.resolve(__dirname, "..", "..", "dist_ui", "swagger");
4141
await mkdir(outputDir, { recursive: true });
4242
const jsonSpec = JSON.stringify(app.swagger(), null, 2);
4343
const yamlSpec = app.swagger({ yaml: true });

0 commit comments

Comments
 (0)