Skip to content

server-side-website with additional S3 Origin behaviour#325

Open
aran112000 wants to merge 12 commits intogetlift:masterfrom
aran112000:server-side-website-merge-custom-s3-origins
Open

server-side-website with additional S3 Origin behaviour#325
aran112000 wants to merge 12 commits intogetlift:masterfrom
aran112000:server-side-website-merge-custom-s3-origins

Conversation

@aran112000
Copy link
Copy Markdown
Contributor

@aran112000 aran112000 commented Apr 24, 2023

This adds support to create additional CloudFront Origins & Behaviours so you can map additional paths to alternative, existing S3 buckets.

Includes updated documentation to show how this can be used.

Comment thread docs/server-side-website.md Outdated
Comment thread docs/server-side-website.md Outdated
Comment thread docs/server-side-website.md Outdated
Copy link
Copy Markdown
Member

@mnapoli mnapoli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, that looks like a great idea that will benefit many! (the "/uploads/" example is very common)

I added some suggestions inline. Could you also add some tests? This is a large feature so we want to make sure it is covered.

Comment thread src/constructs/aws/ServerSideWebsite.ts Outdated
Comment thread src/constructs/aws/ServerSideWebsite.ts Outdated
@aran112000 aran112000 requested a review from mnapoli April 27, 2023 07:49
Comment thread docs/server-side-website.md Outdated
@aran112000 aran112000 requested a review from mnapoli June 8, 2023 16:20
@mnapoli
Copy link
Copy Markdown
Member

mnapoli commented Jun 16, 2023

Hi, just bumping here regarding my last comment: I think the only thing missing here for a merge are tests? Especially since you discovered plenty of edge cases, maintaining this feature sounds like it will be quite some effort, so the tests will help minimize the effort 😅

@aran112000
Copy link
Copy Markdown
Contributor Author

Hi, just bumping here regarding my last comment: I think the only thing missing here for a merge are tests? Especially since you discovered plenty of edge cases, maintaining this feature sounds like it will be quite some effort, so the tests will help minimize the effort 😅

Sure thing, @robchett just added these now :)

@evo-chris
Copy link
Copy Markdown

@mnapoli Just wondering if there is a plan in mind for the next release and will it include this PR? If there's anything we can help with, let us know. Thanks.

@aran112000
Copy link
Copy Markdown
Contributor Author

Hey @fredericbarthelet, @mnapoli

Any chance this could be reviewed / merged if you're happy with the change & tests added here please?

@robchett robchett force-pushed the server-side-website-merge-custom-s3-origins branch from 14993f6 to fba77bd Compare December 12, 2023 13:24
@kevincerro
Copy link
Copy Markdown
Contributor

kevincerro commented Dec 17, 2023

Hope that this will be finally merged.
I need to host under a subpath /blog a static-website using a server-side-website construct

@vikivyas
Copy link
Copy Markdown

Aran Reeks (@aran112000) while It is not being approved, how can we use this?

will uploaded files to the bucket be removed on the next deployment?

@aran112000
Copy link
Copy Markdown
Contributor Author

Aran Reeks (@aran112000) while It is not being approved, how can we use this?

will uploaded files to the bucket be removed on the next deployment?

Feel free to use my fork of Lift, we use this on production on a number of sites successfully. It doesn't clear any assets from other buckets on deployment. They're just added as origins to your Cloudfront distributions.

@mnapoli - is it possible to complete the review and get this merged, please?

@hschimpf
Copy link
Copy Markdown

hschimpf commented Dec 6, 2024

This is just what I need! 🚀

I was adding an additional Origin+Behavior to the distribution manually.

Any updates on this? We'll really love this to be merged.

@vikivyas
Copy link
Copy Markdown

Aran Reeks (@aran112000) while It is not being approved, how can we use this?
will uploaded files to the bucket be removed on the next deployment?

Feel free to use my fork of Lift, we use this on production on a number of sites successfully. It doesn't clear any assets from other buckets on deployment. They're just added as origins to your Cloudfront distributions.

@mnapoli - is it possible to complete the review and get this merged, please?

can you share any of your serverless.yml as an example? I am looking for best example for my laravel application.

@hschimpf
Copy link
Copy Markdown

can you share any of your serverless.yml as an example? I am looking for best example for my laravel application.

Hey @vikivyas, here is mine from a currently live production application: serverless.yml

I have two buckets, one is created for the frontend assets, and another is private for customer's uploads. There are some uploads that should be able to be publicly accessible (like profile pics, personalized banners, etc), those files are uploaded to a folder called c/ on the private bucket, and that folder is specified as another Origin+Behavior on the server-side-website construct:

constructs:
  assets:
    type: server-side-website
    domain: ${param:domain}
    certificate: ${param:certificateArn}
    assets:
      '/build/*': public/build
      '/robots.txt': public/robots.txt
      '/c/*': 's3://${param:UUID}-${aws:region}-storage'
    extensions:
      bucket:
        Properties:
          BucketName: '${param:UUID}-${aws:region}-assets'

  storage:
    type: storage
    extensions:
      bucket:
        DeletionPolicy: Retain
        Properties:
          BucketName: '${param:UUID}-${aws:region}-storage'
          AccessControl: Private

Let me know if it helps you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants