Sam Wrigley
01/28/2022, 1:07 PMAWS::CloudFront::Distribution
.
Anything that would help speed up deployments would be hugely helpful for us.Frank
1. updating the distribution to point to the new S3 folderLet me discuss about it w/ the team and keep you posted.
Frank
Sam Wrigley
01/31/2022, 2:55 PMSam Wrigley
01/31/2022, 3:05 PMFrank
Sam Wrigley
02/03/2022, 9:31 AMupdating the distribution to point to the new S3 folderIs that something you're still looking into?
Frank
StaticSite
, the site is uploaded to a new folder inside the S3 bucket. While this makes each deploy “atomic/clean”, as in u don’t have old files from previous deploys, this also makes the deploy A LOT slower. The slowness comes from updating the CF Distribution to point to a different S3 origin.Frank
Derek Kershner
02/06/2022, 7:55 PMDevStaticSite
?). While this may take some busy work to create a base class and such, it saves the question of how do we switch from one setting to the other?
, which seems difficult to do perfectly and more work. It also makes intention VERY explicit.
As to the merit of the concept, I get why this would be attractive in certain use cases, but I am not sure the goal will be fully achieved, because you will still need to invalidate the cache, and that seems like at least part of the time sink. If I had to call which took longer, I would have said that invalidation takes longer than switching origin targets, but I could be wrong.Derek Kershner
02/06/2022, 7:56 PMDevStaticSite
route, and remove Cloudfront
entirely. That seems cheap (for low traffic volume and lots of deploys), fast (would be almost instant, S3 only), and to accomplish the goal most effectively.
@FrankFrank
this deployment method will take the site down temporarilyDK’^ deploying to bucket root is what CDK’s s3Deployment construct do
Derek Kershner
02/07/2022, 9:48 PMx
(most frontends attach a code to deploys to keep em unique). If you deploy a new site with code y
, deleting the files with code x
, and a page is currently cached with code x
as a requested static, the site will be down for any users that show up in between the origin update and cache invalidation.Derek Kershner
02/07/2022, 9:49 PMDerek Kershner
02/07/2022, 9:49 PMFrank
x
. For example, the old index.html
will be replaced, since it doesn’t have a code. Old js/css files that have a code will not be deleted.Derek Kershner
02/07/2022, 9:53 PMDerek Kershner
02/07/2022, 9:55 PMFrank
StaticSite
has a similar flaw, users can have index.html
open from a previous deployed version. Now they try. to request a js file with code x
, but since the CF now points to the new deployed folder with code y
, the user will get an error.Frank
index.html
are deployed to subfolders, and the js/css files are deployed to a shared folder with all historical versions. ^ that’s how they can give u a unique url to each historical version of index.html
Derek Kershner
02/07/2022, 10:01 PMDerek Kershner
02/07/2022, 10:02 PMDerek Kershner
02/07/2022, 10:02 PMFrank
Frank
StaticSite
more flexible over time to handle custom deployment strategies (u can deploy to subfolder; u can invalidate certain files; u can prune old files, etc);
• and invest in framework specific constructs like ReactStaticSite
and ViteStaticSite
to implement atomic deploy properlyFrank
Derek Kershner
02/09/2022, 2:27 AMDan Van Brunt
03/02/2022, 6:28 PM