
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
[] (http://travis-ci.org/laurilehmijoki/jekyll-s3)
Deploy your jekyll site to S3.
gem install jekyll-s3
jekyll-s3
. It generates a configuration file called _jekyll_s3.yml
that looks like this:s3_id: YOUR_AWS_S3_ACCESS_KEY_ID s3_secret: YOUR_AWS_S3_SECRET_ACCESS_KEY s3_bucket: your.blog.bucket.com
Edit it with your details (you can use ERB in the file)
Run configure-s3-website --config-file _jekyll_s3.yml
This will configure
your bucket to function as an S3 website. If the bucket does not exist,
configure-s3-website
will create it for you.
Run jekyll-s3
to push your Jekyll blog to S3. Congratulations! You are live.
(If you are using jekyll-s3
on an EC2 instance with IAM
roles,
you can omit the s3_id
and s3_secret
keys in the config file.)
You can use ERB in your _jekyll_s3.yml
file which incorporates environment variables:
s3_id: <%= ENV['S3_ID'] %>
s3_secret: <%= ENV['S3_SECRET'] %>
s3_bucket: blog.example.com
You can use the max_age
configuration option to enable more effective browser
caching of your static assets. There are two possible ways to use the option:
you can specify a single age (in seconds) like so:
max_age: 300
Or you can specify a hash of globs, and all files matching those globs will have the specified age:
max_age:
"assets/*": 6000
"*": 300
Place the configuration into the file _jekyll_s3.yml
.
If you choose, you can use compress certain file types before uploading them to S3. This is a recommended practice for maximizing page speed and minimizing bandwidth usage.
To enable Gzip compression, simply add a gzip
option to your _jekyll_s3.yml
configuration file:
gzip: true
Note that you can additionally specify the file extensions you want to Gzip
(.html
, .css
, .js
, and .txt
will be compressed when gzip: true
):
gzip:
- .html
- .css
- .md
Remember that the extensions here are referring to the compiled extensions, not the pre-processed extensions.
By default, jekyll-s3
uses the US Standard Region. You can upload your Jekyll
site to other regions by adding the setting s3_endpoint
into the
_jekyll_s3.yml
file.
For example, the following line in _jekyll_s3.yml
will instruct jekyll_s3
to
push your site into the Tokyo region:
s3_endpoint: ap-northeast-1
The valid s3_endpoint
values consist of the S3 location constraint
values.
Sometimes there are files or directories you want to keep on S3, but not on your local machine. You may define a regular expression to ignore files like so:
ignore_on_server: that_folder_of_stuff_i_dont_keep_locally
You can reduce the cost of hosting your blog on S3 by using Reduced Redundancy Storage:
_jekyll_s3.yml
, set s3_reduced_redundancy: true
jekyll-s3
againIt is easy to deliver your S3-based web site via Cloudfront, the CDN of Amazon.
When you run the command configure-s3-website
, it will ask you whether you
want to deliver your website via CloudFront. If you answer yes,
configure-s3-website
will create a CloudFront distribution for you.
This feature was added into the version 1.3.0 of the configure-s3-website
gem.
For more information, see the gem's
documentation.
If you already have a CloudFront distribution that serves data from your Jekyll
S3 bucket, just add the following line into the file _jekyll_s3.yml
:
cloudfront_distribution_id: your-dist-id
Next time you run jekyll-s3
, it will invalidate the items on CloudFront and
thus force the CDN system to reload the changes from your Jekyll S3 bucket.
The gem configure-s3-website
, which is a dependency of jekyll-s3
, lets you
define custom settings for your CloudFront distribution.
For example, like this you can define a your own TTL and CNAME:
cloudfront_distribution_config:
default_cache_behavior:
min_TTL: <%= 60 * 60 * 24 %>
aliases:
quantity: 1
items:
CNAME: your.website.com
See the gem's documentation for more info.
Jekyll-s3 has a headless mode, where human interactions are disabled.
In the headless mode, jekyll-s3
will automatically delete the files on the S3
bucket that are not on your local computer.
Enable the headless mode by adding the --headless
or -h
argument after
jekyll-s3
.
You can set HTTP redirects on your Jekyll S3 website in two ways. If you only need simple "301 Moved Premanently" redirects for certain keys, use the Simple Redirects method. Otherwise, use the Routing Rules method.
For simple redirects Jekyll S3 uses Amazon S3's
x-amz-website-redirect-location
metadata. It will create zero-byte objects for each path you want
redirected with the appropriate x-amz-website-redirect-location
value.
For setting up simple redirect rules, simply list each path and target
as key-value pairs under the redirects
configuration option:
redirects:
index.php: /
about.php: about.html
music-files/promo.mp4: http://www.youtube.com/watch?v=dQw4w9WgXcQ
You can configure more complex redirect rules by adding the following
configuration into the _jekyll_s3.yml
file:
routing_rules:
- condition:
key_prefix_equals: blog/some_path
redirect:
host_name: blog.example.com
replace_key_prefix_with: some_new_path/
http_redirect_code: 301
After adding the configuration, run the command configure-s3-website --config _jekyll_s3.yml
on your command-line interface. This will apply the routing
rules on your S3 bucket.
For more information on configuring redirects, see the documentation of the
configure-s3-website
gem, which comes as a transitive dependency of the jekyll-s3
gem.
jekyll-s3
as a libraryBy nature, jekyll-s3
is a command-line interface tool. You can, however, use
it programmatically by calling the same API as the executable jekyll-s3
does:
require 'jekyll-s3'
is_headless = true
Jekyll::S3::CLI.new.run('/path/to/your/jekyll-site/_site/', is_headless)
You can also use a basic Hash
instead of a _jekyll_s3.yml
file:
config = {
"s3_id" => YOUR_AWS_S3_ACCESS_KEY_ID,
"s3_secret" => YOUR_AWS_S3_SECRET_ACCESS_KEY,
"s3_bucket" => "your.blog.bucket.com"
}
in_headless = true
Jekyll::S3::Uploader.run('/path/to/your/jekyll-site/_site/', config, in_headless)
The code above will assume that you have the _jekyll_s3.yml
in the directory
/path/to/your/jekyll-site
.
See https://github.com/laurilehmijoki/jekyll-s3/blob/master/example-configurations.md.
None. Please send a pull request if you spot any.
Jekyll-s3 uses Semantic Versioning.
bundle install
rake test
bundle exec cucumber
bundle exec rspec spec/lib/*.rb
We (users and developers of Jekyll-s3) welcome patches, pull requests and ideas for improvement.
When sending pull requests, please accompany them with tests. Favor BDD style in test descriptions. Use VCR-backed integration tests where possible. For reference, you can look at the existing Jekyll-s3 tests.
If you are not sure how to test your pull request, you can ask the gem owners to supplement the request with tests. However, by including proper tests, you increase the chances of your pull request being incorporated into future releases.
MIT
Copyright (c) 2011 VersaPay, Philippe Creux.
Contributors (in alphabetical order)
FAQs
Unknown package
We found that jekyll-s3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.