All Projects → novemberfiveco → S3 Site Cache Optimizer

novemberfiveco / S3 Site Cache Optimizer

Licence: mit
Optimize a static website for hosting in S3, by including a fingerprint into all assets' filenames. The optimized website is uploaded into the specified S3 bucket with the right cache headers.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to S3 Site Cache Optimizer

simply-static-deploy
WordPress plugin to deploy static sites easily to an AWS S3 bucket.
Stars: ✭ 48 (+433.33%)
Mutual labels:  s3, s3-bucket, static-site
s3-proxy
S3 Reverse Proxy with GET, PUT and DELETE methods and authentication (OpenID Connect and Basic Auth)
Stars: ✭ 106 (+1077.78%)
Mutual labels:  s3, s3-bucket
Bucket-Flaws
Bucket Flaws ( S3 Bucket Mass Scanner ): A Simple Lightweight Script to Check for Common S3 Bucket Misconfigurations
Stars: ✭ 43 (+377.78%)
Mutual labels:  s3, s3-bucket
S3 Deploy Website
Deploy website to S3/CloudFront from Python
Stars: ✭ 26 (+188.89%)
Mutual labels:  s3, static-site
BlobHelper
BlobHelper is a common, consistent storage interface for Microsoft Azure, Amazon S3, Komodo, Kvpbase, and local filesystem written in C#.
Stars: ✭ 23 (+155.56%)
Mutual labels:  s3, s3-bucket
gatsby-source-s3
A Gatsby source plugin to query against an S3 bucket (including images!)
Stars: ✭ 19 (+111.11%)
Mutual labels:  s3, s3-bucket
websync
Like `aws s3 sync` with automatic CloudFront invalidations and more.
Stars: ✭ 45 (+400%)
Mutual labels:  s3, static-site
terraform-aws-s3
Terraform module to create default S3 bucket with logging and encryption type specific features.
Stars: ✭ 22 (+144.44%)
Mutual labels:  s3, s3-bucket
radio
Redundant Array of Distributed Independent Objectstores in short RADIO performs synchronous mirroring, erasure coding across multiple object stores
Stars: ✭ 25 (+177.78%)
Mutual labels:  s3, s3-bucket
terraform-aws-s3-bucket
A Terraform module to create a Simple Storage Service (S3) Bucket on Amazon Web Services (AWS). https://aws.amazon.com/s3/
Stars: ✭ 47 (+422.22%)
Mutual labels:  s3, s3-bucket
Github To S3 Lambda Deployer
⚓️ GitHub webhook extension for uploading static pages to AWS S3 directly after commiting to master via Lambda written in Node.js
Stars: ✭ 23 (+155.56%)
Mutual labels:  s3, static-site
awesome-storage
A curated list of storage open source tools. Backups, redundancy, sharing, distribution, encryption, etc.
Stars: ✭ 324 (+3500%)
Mutual labels:  s3, s3-bucket
s3cr3t
A supercharged S3 reverse proxy
Stars: ✭ 55 (+511.11%)
Mutual labels:  s3, s3-bucket
flask-drive
A simple Flask app to upload and download files off Amazon's S3
Stars: ✭ 23 (+155.56%)
Mutual labels:  s3, s3-bucket
s3recon
Amazon S3 bucket finder and crawler.
Stars: ✭ 111 (+1133.33%)
Mutual labels:  s3, s3-bucket
ionic-image-upload
Ionic Plugin for Uploading Images to Amazon S3
Stars: ✭ 26 (+188.89%)
Mutual labels:  s3, s3-bucket
Gatsby Plugin S3
Deploy your gatsby site to a S3 bucket.
Stars: ✭ 186 (+1966.67%)
Mutual labels:  s3, s3-bucket
smockin
Dynamic API, S3 & Mail mocking for web, mobile & microservice development.
Stars: ✭ 74 (+722.22%)
Mutual labels:  s3, s3-bucket
docker-aws-s3-sync
Docker container to sync a folder to Amazon S3
Stars: ✭ 21 (+133.33%)
Mutual labels:  s3, s3-bucket
Goofys
a high-performance, POSIX-ish Amazon S3 file system written in Go
Stars: ✭ 3,932 (+43588.89%)
Mutual labels:  s3, s3-bucket

s3-site-cache-optimizer

Optimize a static website for hosting in S3, by including a fingerprint into all assets' filenames. The optimized website is uploaded into the specified S3 bucket with the right cache headers.

Installation

You can install the stable version using the following pip command:

pip install --upgrade s3-site-cache-optimizer

If you want to keep up with the latest features, install the development version:

pip install --upgrade https://github.com/novemberfiveco/s3-site-cache-optimizer/archive/develop.zip

Operation

The command line tool executes the following steps:

  1. Index the (local) source dir containing the static website, and search for assets and rewritables.
  2. Calculate a hash from the contents of each asset, and rename it with the filehash in the filename.
  3. Search the contents of the rewritables for references to each of the assets, and rewrite the urls if necessary.
  4. (optional) Gzip all text-based files.
  5. (optional) Upload all files to a path in an S3 bucket, and remove all other files from that path. Assets are given a never-expiring cache header in order to optimize browser and proxy caching.

All file operations are executed in a (temporary) output directory, the source directory is not altered.

Assets and rewritables are recognized based on their file extension. Currently, the following file extensions are considered as assets:

  • css
  • svg
  • ttf
  • woff
  • woff2
  • otf
  • eot
  • png
  • jpg
  • jpeg
  • gif
  • js
  • xml
  • mp4
  • webm
  • webp

Rewritables are text-based files with one of the following extensions:

  • html
  • htm
  • js
  • css
  • xml
  • json

File a feature request if you want to see other file extensions added.

Usage

usage: s3-site-cache-optimizer [-h] [--debug] [--version]
                               [--exclude PATTERN [PATTERN ...]]
                               [-o OUTPUT_DIR]
                               [--access-key AWS_ACCESS_KEY_ID]
                               [--secret-key AWS_SECRET_ACCESS_KEY]
                               [--region REGION]
                               [--gzip]
                               [--prefix PREFIX]
                               [--domains DOMAIN [DOMAIN ...]]
                               [--skip-s3-upload]
                               source_dir destination_bucket

positional arguments:
  source_dir            Local directory containing a static website.
  destination_bucket    S3 bucket name.

optional arguments:
  -h, --help            show this help message and exit
  --debug               Enable debug output
  --version             show program's version number and exit
  --exclude PATTERN [PATTERN ...]
                        Exclude files and directories matching these patterns.
  -o OUTPUT_DIR, --output OUTPUT_DIR
                        Output directory in which local files are written.
                        When absent a temporary directory is created and used.
  --access-key AWS_ACCESS_KEY_ID
                        AWS access key. If this field is not specified,
                        credentials from environment or credentials files will
                        be used.
  --secret-key AWS_SECRET_ACCESS_KEY
                        AWS access secret. If this field is not specified,
                        credentials from environment or credentials files will
                        be used.
  --region REGION       AWS region to connect to.
  --gzip                Gzip text-based files.
  --prefix PREFIX       Subdirectory in which files are stored in the bucket.
                        Stored in the root of the bucket by default.
  --domains DOMAIN [DOMAIN ...]
                        Domain names on which the site will be hosted.
  --skip-s3-upload      Skip uploading to S3.

Example

$ s3-site-cache-optimizer ~/srv/www.example.com www.example.com --access-key XXXXXNOVEMBERFIVEXXXXX --secret-key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
$ s3-site-cache-optimizer ~/srv/www.example.com www.example.com --exclude ".git/*" ".git*" --region eu-west-1
$ s3-site-cache-optimizer ~/srv/www.example.com www.example.com --output ~/srv/example-optimized/ --skip-s3-upload
$ s3-site-cache-optimizer ~/srv/www.example.com my_bucket --domains www.example.com example.com --prefix "user/sites/www.example.com"

License

The s3-site-cache-optimizer is released under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].