Deploy your static sites to S3. Supports Cloudront object invalidation, file gzipping, and configuration of cache control headers.
Until upstatic is released on rubygems, please clone the repository and install with:
Create a file named Upstatic in the directory you want to deploy and specify at least the S3 bucket name:
Upstatic tries to read your AWS credentials from the following
You can also specify them in the Upstatic file as:
access_key_id "MY_AWS_KEY_ID" secret_access_key "MY_AWS_SECRET_ACCESS_KEY"
Once the bucket and credentials are setup, you can deploy by running:
For more configuration options, keep reading.
If you want to gzip certain files, just specify which file extensions you'd like gzipped. Note that gzipping files means that they'll always be served compressed. S3 does not support serving different files based on the Accept-Encoding header.
gzip_extensions ".html", ".js", ".css"
By default no files are gzipped.
You can also specify Cache-Control headers for specific file extensions.
For example, you might want Cloudfront (and proxies) to cache HTML files for 600 seconds, but tell the browser not to cache them:
cache_control ".html", "public, s-maxage=600, max-age=0"
You can also specify the default for all other files:
default_cache_control "public, max-age=691200"
The default is to serve every file with
If you are serving some or all your files from Cloudfront, you probably want to invalidate the newly updated objects. Just specify your Cloudfront distribution ID and it will be taken care of when you deploy.
This extension keeps track of every deployed file in a
the root of the bucket. This is a private file that contains a SHA-1 sum
of the uploaded file, followed by a SHA-1 sum of its upload options and
finally the filename. This file is used to know if a file needs to be
Everything is tested by actually deploying to S3 and requesting the deployed files.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request