octopressをs3で運用する時にはs3cmd
を使ったデプロイが簡単便利なんですが、s3cmd
のバージョン管理が出来ないしgz圧縮をアップする時面倒だしで調べてみたらjekyll-s3
が簡単確実打という事を知る
という訳でoctopressの設定
Gemfile
gem 'jekyll-s3'
Rakefile
require 'jekyll-s3'
deploy_default = "s3"
## -- S3 Deploy config -- #
s3_bucket = "hugehuge" # Enter your S3 bucket name here
s3_cache_secs = "3600" # Number of seconds to keep objects in cache - 3600 = 1 hour
desc "Deploy website via jekyll-s3"
task :s3 do
puts "## Deploying website via S3"
config = {
's3_id' => ENV['s3_id'],
's3_secret' => ENV['s3_secret'],
's3_endpoint' => 'ap-northeast-1',
's3_bucket' => s3_bucket,
'max_age' => s3_cache_secs,
'gzip' => ['.html', '.css', '.js', '.xml'],
's3_reduced_redundancy' => true,
}
in_headless = true
#ENV['disable_parallel_processing'] = 'true'
Jekyll::S3::Uploader.run(public_dir, config, in_headless)
end
bundle install
s3_id='YOUR_S3_ID' s3_secret='YOUR_S3_SECRET' bundle exec rake gen_deploy
macで初回のアップロードなんかでアップ対象のファイル数が多い時はエラーが発生します。
そんな時はENV['disable_parallel_processing']
を宣言しておいた方が良いです。
こんな感じ
disable_parallel_processing='true' s3_id='YOUR_S3_ID' s3_secret='YOUR_S3_SECRET' bundle exec rake gen_deploy