13
11

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.

capistrano3.3.xでbin以下に配備されなくなる

Posted at

現象

bundle updateをしてcapistrano3.3.4にupdateをしたところ、サーバー側の/binにコマンド系が配置されなくなってしまいました。そのせいで、rails_consoleなどがdeploy先でつかなくなってしまっていました。

3.3.4
INFO [565559b3] Running ~/.rbenv/bin/rbenv exec bundle install --path /mnt/app/shared/bundle --without development test --deployment --quiet as vagrant@127.0.0.1
DEBUG [565559b3] Command: cd /mnt/app/releases/20150226200217 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.3 ~/.rbenv/bin/rbenv exec bundle install --path /mnt/app/shared/bundle --without development test --deployment --quiet )
3.2.1
INFO [20972687] Running ~/.rbenv/bin/rbenv exec bundle install --binstubs /mnt/app/shared/bin --path /mnt/app/shared/bundle --without development test --deployment --quiet as vagrant@127.0.0.1
DEBUG [20972687] Command: cd /mnt/app/releases/20150226201624 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.3 ~/.rbenv/bin/rbenv exec bundle install --binstubs /mnt/app/shared/bin --path /mnt/app/shared/bundle --without development test --deployment --quiet )

比較すると
--binstubの指定がごっそり抜けていることがわかりました。

対策

config/deploy.rb
set :bundle_binstubs, -> { shared_path.join('bin') }

として無事解決しました。

原因

以下は御時間ある方どうぞ。

https://github.com/capistrano/bundler/blob/master/CHANGELOG.md

1.1.4 (22 Jan 2014)
Don’t generate binstubs by default (#61)

該当のissue#61を追っていくと
https://github.com/capistrano/bundler/pull/61

Two reasons:
1) bin/ is often checked out into repo
2) #45 (comment)

ってことらしく。
さらに該当のissue#45を追っていくと、

I have in fact checked in a bin with executables generated by Rails, but they are not used, because by default bin is symlinked to shared/bin, containing executables with bundler-generated executables. Of course it is trivial to configure bundler such that this doesn't happen, but since everyone using Rails 4 needs to do that, it would be better to just do 'the right thing' out of the box.

bin/以下については、gitにみんな入れるし、symlinkされたファイルだからいらないよね(超訳)な議論があったみたいで。

add line set :bundle_binstubs, nil
remove bin from linked dirs set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

ということみたいです。

13
11
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
13
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?