2017-04-05 86 views
1

我在Ubuntu 14.04上運行Unicorn和Rails 5。我跑獨角獸作爲守護程序,使用腳本,/etc/init.d/unicorn,如何告訴Unicorn使用「bundle exec」運行Rails?

case "$1" in 
    start) 
     check_config 
     check_app_root 

     log_daemon_msg "Starting $DESC" $NAME || true 
     if start-stop-daemon --start --quiet --oknodo --pidfile $PID --exec $DAEMON -- $UNICORN_OPTS; then 

在一個單獨的文件/ etc默認/麒麟,我有DAEMON和UNICORN_OPTS變量定義/。 ..

UNICORN_OPTS="-D -c $CONFIG_RB -E $RAILS_ENV" 
... 
DAEMON="$GEM_PATH/bin/unicorn" 

我的問題是,我如何告訴Unicorn,當它運行軌道前綴爲「bundle exec」?我需要bundle exec,因爲我在我的獨角獸日誌中收到抱怨gem版本的所有投訴,以及bundle exec如何節省一天。

回答

1

Bundle需要從應用程序根目錄運行。

您的DAEMON應該看起來像cd $APP_ROOT && $GEM_PATH/bin/bundle exec unicorn

相關問題