0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OpsWorks で使うunicornのバージョンを変更する

Posted at

Cookbookを見てみると、変数に設定してあり、customize.rbで上書きできそうです。

default[:unicorn][:worker_processes] = node[:rails][:max_pool_size] ? node[:rails][:max_pool_size] : 4
default[:unicorn][:backlog] = 1024
default[:unicorn][:timeout] = 60
default[:unicorn][:preload_app] = true
default[:unicorn][:version] = '4.7.0'
default[:unicorn][:tcp_nodelay] = true
default[:unicorn][:tcp_nopush] = false
default[:unicorn][:tries] = 5
default[:unicorn][:delay] = 0.5
default[:unicorn][:accept_filter] = "httpready"

以前書いたのと同様にして変更してみます。

OpsWorks customize.rbでbuilt-in cookbooksの設定値を変更する

手順

1. Custom Chef Cookbooksのリポジトリを作成

すでにプロジェクトのカスタムCookbooksがある場合はそちらに追加していくので個別に作成する必要はありません。

2. unicorn/attributes/customize.rb

こんな感じで作成します。

###
# This is the place to override the unicorn cookbook's default attributes.
#
# Do not edit THIS file directly. Instead, create
# "unicorn/attributes/customize.rb" in your cookbook repository and
# put the overrides in YOUR customize.rb file.
###

# The following shows how to override the Unicorn timout:
#
# normal[:unicorn][:timeout] = 30
normal[:unicorn][:version] = '4.9.0' # Gemfile.lockと合わせる

versionの値は(通常Railsだと思いますが)Gemfile.lockのunicornバージョンとあわせます。

バージョンが合わないとき … Bundlerでエラーになります

Gemfile側にunicornがないとき … Rails Appのデプロイ時に起動やリロードができません

3. StackにCustom Chef Cookbooksのリポジトリ登録・更新

すでに(ry

4. Update Custom Cookbooks

スタックのRun CommandでカスタムCookbooksを更新します。AppのデプロイだけではカスタムCookbooksは更新されないので注意。

5. Setup

スタックのRun CommandでSetupします。これでシステムRubyのUnicornが再インストールされます。

以上、そんな感じです。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?