我正在與Chef部署我的Rails應用服務器。剛從Ruby的源代碼安裝交換到RVM(因爲我的部署用戶遇到問題)。用Runit和用戶的RVM啓動Unicorn
現在我有我的部署排序,資產編譯和打包機的所有我的寶石。
我已經與Runit監督獨角獸的問題..
RVM未安裝爲root用戶 - 僅作爲我的部署用戶,如下所示:
$ rvm list
rvm rubies
=* ruby-2.0.0-p247 [ x86_64 ]
我可以手動從我的部署用戶成功啓動Unicorn。但是,它不會作爲runit的一部分啓動。
我的運行文件看起來像這樣。我自己也嘗試在這SO question不成功的解決方案..
#!/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
如果我手動運行它,我得到這個錯誤:它不以root身份運行
/usr/bin/env: ruby_noexec_wrapper: No such file or directory
我創建了一個小腳本(gist here) 。但是,如果我把這個從runit,我看到工開始,但我得到了runit兩個過程,我不能停止或重新啓動服務:
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哪個工作很好?
感謝您的回答。我以部署用戶身份運行了包裝器和別名(假設這是因爲root無權訪問rvm)。然而,runit仍然不會啓動它,如果我以root身份手動運行,它會提供:ruby_noexec_wrapper找不到。 – simonmorley
這實際上完成了它。需要幾次殺死守護進程。謝謝,快樂的日子:) – simonmorley