Rails App サーバーを Chef でデプロイしています。Ruby のソース インストールから RVM にスワップしたところです (デプロイ ユーザーに問題があったため)。
これで、デプロイがソートされ、アセットがコンパイルされ、バンドラーがすべての gem をインストールしました。
私が抱えている問題は、Runit で Unicorn を監督することです..
RVM は root ユーザーとしてインストールされません。次のように、デプロイ ユーザーが持っている場合にのみインストールされます。
$ rvm list
rvm rubies
=* ruby-2.0.0-p247 [ x86_64 ]
deploy ユーザーから手動で Unicorn を正常に起動できます。ただし、runit の一部としては開始されません。
私の実行ファイルは次のようになります。私はこのSOの質問の解決策も試しましたが失敗しました..
#!/bin/bash
cd /var/www/html/deploy/production/current
exec 2>&1
exec chpst -u deploy:deploy /home/deploy/.rvm/gems/ruby-2.0.0-p247/bin/unicorn -E production -c config/unicorn_production.rb
手動で実行すると、次のエラーが発生します。
/usr/bin/env: ruby_noexec_wrapper: No such file or directory
root として実行される小さなスクリプト ( gist here ) を作成しました。ただし、これを runit から呼び出すと、ワーカーが開始されますが、runit 用に 2 つのプロセスが取得され、サービスを停止または再起動できません。
ps の出力:
1001 29062 1 0 00:08 ? 00:00:00 unicorn master -D -E production -c /var/www/html/deploy/production/current/config/unicorn_production.rb
1001 29065 29062 9 00:08 ? 00:00:12 unicorn worker[0] -D -E production -c /var/www/html/deploy/production/current/config/unicorn_production.rb
root 29076 920 0 00:08 ? 00:00:00 su - deploy -c cd /var/www/html/deploy/production/current; export GEM_HOME=/home/deploy/.rvm/gems/ruby-2.0.0-p247; /home/deploy/.rvm/gems/ruby-2.0.0-p247/bin/unicorn -D -E production -c /var/www/html/deploy/production/current/config/unicorn_production.rb
1001 29083 29076 0 00:08 ? 00:00:00 -su -c cd /var/www/html/deploy/production/current; export GEM_HOME=/home/deploy/.rvm/gems/ruby-2.0.0-p247; /home/deploy/.rvm/gems/ruby-2.0.0-p247/bin/unicorn -D -E production -c /var/www/html/deploy/production/current/config/unicorn_production.rb
ここで何をすべきですか?うまく機能したmonitに戻りますか?