4
4

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.

wheneverをupdateしたらopsworksのデプロイフックでコマンドが通らなくなった時の取り急ぎの対応

Last updated at Posted at 2015-05-27

wheneverをupdateして0.9.4になったらopsworksのデプロイフックでコマンドが通らなくなった。

具体的にはbundle exec whenever -wを実行すると以下のエラーがでた。

/home/deploy/.bundler/【app名】/ruby/2.1.0/gems/whenever-0.9.4/lib/whenever/numeric_seconds.rb:12:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)

ちょっと調べてみると以下の記事にLC_ALLLANGを設定すると動くよ〜という記述を発見
http://shiro-16.hatenablog.com/entry/2015/02/17/000715
※ このページ内で「invalid byte」で検索すると該当箇所がわかります。

なので、デプロイフックのソースを以下の様に修正

env = node[:deploy][【app名】][:rails_env]
current_release = release_path

execute "whenever -w" do
  cwd current_release
  command "bundle exec whenever -w"
  environment(
      'RAILS_ENV' => env
  )
end

env = node[:deploy][【app名】][:rails_env]
current_release = release_path

execute "whenever -w" do
  cwd current_release
  command "bundle exec whenever -w"
  environment(
      'RAILS_ENV' => env,
      'LANG' => 'ja_JP.UTF-8',
      'LC_ALL' => 'ja_JP.UTF-8'
  )
end

これでエラーなく通った!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?