mdn / stumptown-deployer

🚢 those static Stumptown sites
Mozilla Public License 2.0
4 stars 6 forks source link

One bucket to rule them all? #10

Open peterbe opened 5 years ago

peterbe commented 5 years ago

In its current form stumptown-deployer upload /path/to/build will figure out what the S3 bucket name should be based on the current git branch name and some other stuff (e.g. the username). This means, that you get something like this:

Screen Shot 2019-10-16 at 11 58 39 PM

I.e. one S3 bucket for every single possible branch name.

How about that there's just one "master bucket" for all of stumptown-deployer instead. And instead, within that bucket you start having the first level of folders that reflect names such as git branch names. E.g.

Less pollution of S3 buckets and no need to write a thing that scans for now-empty S3 buckets when all files within it have been deleted.

Big question; Can CloudFront point to a prefix folder in an S3 bucket (configured as a website)??

peterbe commented 5 years ago

@escattone What do you think?

peterbe commented 5 years ago

"Origin Path" seems like the right thing!

Screen Shot 2019-10-17 at 3 50 46 PM
peterbe commented 5 years ago

Also, perhaps @limed has some insights here.

peterbe commented 5 years ago

Suppose that we put ALL stumptown static site deployments all in the same folder but with individual root folder names (that'd be depend on the git branch for example), then you'd have just 1 S3 bucket and every single deployed site would need to share any bucket configuration.

For stuff like expirations, I don't think that's a problem because expiration is on a per-key basis.

We're still going to need a script that cleans up. Instead of deleting S3 buckets that are no empty (because all keys within have expired), we're going to need to write a script that disables and deletes all CloudFront distributions whose S3 websites are expired. That's a task we'd need to do anyway.

Are there security implications to consider? One day, there'll (possibly, if Stumptown succeeds) be a static site deployment for the production site of https://developer.mozilla.org. Do we want to run that differently from how we run deployments of PR branches?