Dan Van Brunt
03/02/2022, 3:34 PMSST v0.60.2
Dan Van Brunt
03/02/2022, 4:31 PMDan Van Brunt
03/02/2022, 4:35 PMDerek Kershner
03/02/2022, 5:31 PMDerek Kershner
03/02/2022, 5:34 PMDan Van Brunt
03/02/2022, 6:32 PMDan Van Brunt
03/03/2022, 12:35 AMDan Van Brunt
03/03/2022, 12:35 AMFrank
Frank
0.66.4-next.2
Frank
removeOldFiles
flag to StaticSite
(default to true
). So I don’t think u need to change ur code, the default behavior will be removing old files.Dan Van Brunt
03/03/2022, 1:13 PMDan Van Brunt
03/03/2022, 1:13 PMDan Van Brunt
03/03/2022, 1:14 PMFrank
Frank
Dan Van Brunt
03/03/2022, 1:16 PMaws s3 sync -d
Frank
aws s3 sync --delete
given how StaticSite
is grouping files into multiple zips to get around Lambda’s 500MB disk space limitFrank
StaticSite
now creates a file with all the file names, then at deploy time gets all the files in the bucket, cross check with the file names, and removes the ones that no long exists.Frank
aws s3 sync --delete
does behind the scene.Dan Van Brunt
03/03/2022, 1:25 PMDan Van Brunt
03/03/2022, 3:08 PMDan Van Brunt
03/03/2022, 3:11 PMthdxr
03/03/2022, 3:12 PMDan Van Brunt
03/03/2022, 3:47 PMthdxr
03/03/2022, 3:48 PMDan Van Brunt
03/03/2022, 3:49 PMthdxr
03/03/2022, 3:49 PMDerek Kershner
03/03/2022, 4:46 PMDerek Kershner
03/03/2022, 4:47 PMDan Van Brunt
03/03/2022, 4:47 PMDerek Kershner
03/03/2022, 4:48 PMDan Van Brunt
03/03/2022, 4:48 PMDerek Kershner
03/03/2022, 4:49 PMDan Van Brunt
03/03/2022, 4:49 PMDan Van Brunt
03/03/2022, 4:50 PMDan Van Brunt
03/03/2022, 4:51 PMDan Van Brunt
03/03/2022, 4:51 PMDerek Kershner
03/03/2022, 4:53 PMDan Van Brunt
03/03/2022, 4:54 PMDerek Kershner
03/03/2022, 4:54 PMDan Van Brunt
03/03/2022, 4:55 PMDerek Kershner
03/03/2022, 4:55 PMDan Van Brunt
03/03/2022, 4:56 PMDerek Kershner
03/03/2022, 5:00 PMstatic-deploy1234.js
). These ones will be requested based on whatever the client currently has open, and cause the downtime if deleted.Derek Kershner
03/03/2022, 5:02 PMthdxr
03/03/2022, 5:06 PMthdxr
03/03/2022, 5:07 PMDan Van Brunt
03/03/2022, 5:12 PMDerek Kershner
03/03/2022, 5:24 PMThose that want #1 above would have to handle that outside of this construct as it would need deployment cutover handling for sticky sessions.This was actually Frank’s reason for the tactic-switch on this construct in the first place, but with
framework-specific knowledge
in place of sticky sessions
. And, as before, I am still good with it and like the direction for the framework specific constructs. I just have an absolutely critical static site that needs to be 100% available (just a few files, no real framework), so I need to watch this default closely if it switches to breaking the deployment.Dan Van Brunt
03/03/2022, 5:25 PMDerek Kershner
03/03/2022, 5:28 PMDan Van Brunt
03/03/2022, 5:28 PMDan Van Brunt
03/03/2022, 5:29 PMDerek Kershner
03/03/2022, 5:29 PMDerek Kershner
03/03/2022, 5:30 PMDerek Kershner
03/03/2022, 5:30 PMDerek Kershner
03/03/2022, 5:34 PMtrue
. Fight the battle in the specific frameworks.Dan Van Brunt
03/03/2022, 6:02 PMDerek Kershner
03/03/2022, 6:03 PMDan Van Brunt
03/03/2022, 6:04 PMDerek Kershner
03/03/2022, 6:04 PMDan Van Brunt
03/03/2022, 6:04 PMDan Van Brunt
03/03/2022, 6:06 PMDan Van Brunt
03/03/2022, 7:11 PM.build/
that the staticSite package showed that file removed
• confirmed that file WAS in the s3 bucket before deploy
• confirmed that file was STILL there after deploy that should have removed it.
• As I understand its true by default, I made NO changes to my StaticSite props.
"@serverless-stack/cli": "0.66.4-next.2",
"@serverless-stack/resources": "0.66.4-next.2",
Frank
sst deploy
not sst start
right?Frank
First checkGo into
.build
and look for a folder called StaticSite-xxxxxx-xxxxxxxxxx
. Do u see a file named filenames
? Open it up and see if about/index.html
is in there. (This file is what the Custom Resource will look at and remove all files in the S3 bucket that are not listed in this file.)
about/index.html
should NOT be listed in filenames
.Frank
Second checkIf first check passes, go to CFN console, find this stack, and go to the
Template
tab. Search for Custom::SSTBucketDeployment
and can you paste the resource here?
It should have a Filenames
property.Frank
Frank
StaticSite
simple and not do too much magic around deployment. We will tackle how a site is deployed in a framework specific way.
For example, for CRA apps, u’d want to override index.html
and keep static
assets around. So for users that have the old index.html
open, all the js/css files are still reachable. Next.js apps work in a similar way.
And to get fancy, we can generate a unique url for each deploy, similar to what Netlify does.Derek Kershner
03/09/2022, 8:20 PMDan Van Brunt
03/09/2022, 8:22 PMDerek Kershner
03/09/2022, 8:23 PMDan Van Brunt
03/09/2022, 8:24 PMDan Van Brunt
03/09/2022, 8:24 PMDerek Kershner
03/09/2022, 8:25 PMDerek Kershner
03/09/2022, 8:25 PMFrank
Frank
0.66.4-next.2
? A removeOldFiles
flag was added to StaticSite
(default to true
).Derek Kershner
03/15/2022, 10:26 PMFileListOptions
(that is from memory, not exact) props to manage whether certain file patterns get deleted.
That way it could be extended to deleting some, but keeping others, like you want to do in the other StaticSites.Derek Kershner
03/15/2022, 10:27 PMFrank
FileListOptions
woudl look like?Derek Kershner
03/15/2022, 10:29 PMexport interface StaticSiteFileOption {
readonly exclude: string | string[];
readonly include: string | string[];
readonly cacheControl: string;
}
new:
export interface StaticSiteFileOption {
readonly exclude: string | string[];
readonly include: string | string[];
readonly cacheControl: string;
readonly removeOldFiles?: boolean;
}
Derek Kershner
03/15/2022, 10:31 PMDerek Kershner
03/15/2022, 10:33 PMFrank
Dan Van Brunt
03/16/2022, 1:18 PMFrank
Frank
First checkGo into
.build
and look for a folder called StaticSite-xxxxxx-xxxxxxxxxx
. Do u see a file named filenames
? Open it up and see if about/index.html
is in there. (This file is what the Custom Resource will look at and remove all files in the S3 bucket that are not listed in this file.)
about/index.html
should NOT be listed in filenames
. (edited)
Second checkIf first check passes, go to CFN console, find this stack, and go to the
Template
tab. Search for Custom::SSTBucketDeployment
and can you paste the resource here?
It should have a Filenames
property.Dan Van Brunt
03/16/2022, 6:37 PM0.66.4-next.2
Frank
Dan Van Brunt
03/16/2022, 6:37 PMDan Van Brunt
03/16/2022, 6:37 PMDan Van Brunt
03/16/2022, 6:40 PM0.66.4-next.2
Frank
Dan Van Brunt
03/16/2022, 7:16 PMDan Van Brunt
03/16/2022, 7:24 PMFrank
Frank
Derek Kershner
03/16/2022, 7:32 PMNextjsStaticSite
and the extra files dont cause issues for me, other than storage, because the CloudfrontFunction
will still return a 404 on its own, even if the file is there.Derek Kershner
03/16/2022, 7:32 PMFrank
purgeFiles
, default to true
.Dan Van Brunt
03/18/2022, 12:19 AM