LoginSignup
4
4

More than 5 years have passed since last update.

octopressのs3デプロイをs3cmdを使わない方法

Posted at

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
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4