Open sawyerh opened 1 year ago
cc @daphnegold @SammySteiner @acouch in case y'all go this route on your project
@sawyerh thanks sawyer. added my thoughts on technical design
I implemented most of this today on a project. I did it quickly so probably room for improvement, but hopefully a useful starting point
awesome! might need to pick your brain later to see how it works and what we can use.
some initial questions:
@lorenyu Good questions.
is it best practice these days to push static assets to s3 and then put the cdn in front of it? for my own understanding, is it also common to have the cdn pull from the server directly, or is that not ideal due to cache stampede issues?
I initially had the S3 bucket because I couldn't figure out how to get Django to serve the static assets but finally figured that out. In the latest changes on the repo I linked, the S3 bucket is no longer part of the infra. I think having the CDN pull from the server directly seems fine but I haven't researched it too deeply. Seems fine if it is a relatively long cache.
is the idea that eventually if we want to use a custom domain that the assets would be served from that domain, or would we keep the cdn domain?
I think using the default Cloudfront domain would suffice for the template and most teams could get away with just using the default. A custom domain would be useful is if it's a static site and you are also putting the static site behind Cloudfront.
Web applications include static assets (images, fonts, css, client-side JS bundles) and can also include static HTML pages. A CDN, like Cloudfront, provides a caching layer that can improve the performance and scaleability of these web applications. It could be helpful if the Infra template provided a quick way to setup a CDN on a project.
Technical design
Proposed design
has_cdn
to app-configinfra/modules/cdn
infra/app/service
module ifapp_config.has_cdn
is trueCan reference a variation of this approach here.
Alternatives considered
infra/modules/service
— this adds complexity to the service module and is not relevant for some services, such as API services.Testing
Release management