【问题标题】:How do I tell Unicorn to run Rails using "bundle exec"?如何告诉 Unicorn 使用“bundle exec”运行 Rails?
【发布时间】:2017-04-05 23:45:33
【问题描述】:

我在 Ubuntu 14.04 上使用 Rails 5 运行 Unicorn。我正在运行 Unicorn 作为守护进程,使用脚本 /etc/init.d/unicorn,

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/default/unicorn 中,我定义了 DAEMON 和 UNICORN_OPTS 变量...

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

我的问题是,我如何告诉 Unicorn 在运行 rails 时为其添加“bundle exec”前缀?我需要 bundle exec,因为我在我的独角兽日志中收到了所有这些抱怨,抱怨 gem 版本以及 bundle exec 将如何节省时间。

【问题讨论】:

    标签: ruby-on-rails exec bundle ruby-on-rails-5 unicorn


    【解决方案1】:

    Bundle 需要从应用根目录运行。

    您的DAEMON 应该类似于cd $APP_ROOT && $GEM_PATH/bin/bundle exec unicorn

    【讨论】:

      猜你喜欢
      • 2020-05-11
      • 1970-01-01
      • 2016-02-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-02
      相关资源
      最近更新 更多