ruby - 使用主管运行 'bundle exec middleman server'

标签 ruby ubuntu supervisord

我正在使用 slate ,它使用 bundle exec middleman server 运行 Web 服务器。我想和主管一起坚持这个,但我不知道怎么做。从目录中正常运行命令就可以了。我尝试过的配置如下,运行它时出现的错误也是如此。

我怎样才能正确地将它作为守护进程运行?

主管 .conf 文件:

[program:slate]
directory=/home/vaindil/slate
command=/home/vaindil/.rvm/gems/ruby-2.3.1/bin/bundle exec middleman server
autostart=true
autorestart=true
stderr_logfile=/var/log/slate.err.log
stdout_logfile=/var/log/slate.out.log

错误:
/usr/bin/env: ruby_executable_hooks: No such file or directory

更新: 根据 Matt 在评论中的要求,我尝试运行 Foreman 并导出到 supervisord。我得到了一个不同的错误。

输出supervisord配置:
[program:app-web-1]
command=bundle exec middleman server
autostart=true
autorestart=true
stopsignal=QUIT
stdout_logfile=/var/log/web-1.log
stderr_logfile=/var/log/web-1.error.log
directory=/home/vaindil/slate
environment=PORT="4567"

[group:app]
programs=app-web-1

错误:
Warning: the running version of Bundler is older than /
the version that created the lockfile. We suggest you /
upgrade to the latest version of Bundler by running `gem install bundler`.
bundler: command not found: middleman
Install missing gem executables with `bundle install`

最佳答案

这是我为使其正常工作所做的工作:
rvm wrapper ruby-version-here executable-hooks
例如:rvm wrapper ruby-2.3.1 executable-hooks
一旦我将它添加到包装器中,然后将包装器路径添加到我的 supervisor配置一切都开始工作了。

你的命令现在可能是这样的:
command=/home/vaindil/.rvm/wrappers/ruby-2.3.1/bundle exec middleman server

关于ruby - 使用主管运行 'bundle exec middleman server',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39730806/

相关文章:

ruby - Rails 3 与 Sequel 集成?

c - 使用 pthread.h 发布编译程序

linux - 我可以用 supervisord 监控守护进程/服务吗?

Ruby 元编程 : instance_eval and class_eval

ruby-on-rails - 如何在 procfile 和 foreman 中使用 Rails 服务器和机器人?

ruby-on-rails - 如何将其移动到基类,它是一个 Ruby 枚举

node.js - 无法在 Ubuntu 13.04 上运行 lessc。连 "command not found"都没有

Ubuntu 找不到包

python - 在 virtualenv 中找不到 Gunicorn

python - 关于主管的错误