我无法运行我的Rails应用程序与守护进程宝石 [英] I can't run my Rails application with daemons gem

查看:148
本文介绍了我无法运行我的Rails应用程序与守护进程宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Daemons宝石与我的Rails项目,所以我可以轻松地监视它与Monit,这个宝石将允许我创建PID,并使用命令,如开始和停止。



无论如何,我似乎无法使用rails,我创建一个文件并命名为admin:

  require 'rubygems'
require'daemons'

ROOT_PATH = File.expand_path(#{File.dirname __FILE __} /../)

require# {ROOT_PATH} / config / environment

Daemons.run(#{ROOT_PATH} / script / rails,
:dir_mode =>:system,
:log_output = > true

当我尝试运行它:

  bundle exec ./bin/admin run  -  s 

我收到此错误:

  /Users/info/.rvm/gems/ruby- 1.9.3-p286 / gems / rake-0.8.7 / lib / rake / alt_system.rb:32:使用RbConfig代替过时和不推荐使用的配置。 
=>启动WEBrick
=> Rails 3.0.5应用程序开始于http://0.0.0.0:3000
=>调用-d来分离
=> Ctrl-C关闭服务器
配置/config.ru未找到
退出

config.ru文件是肯定的。当我尝试使用命令行手动执行时,我可以运行应用程序,但由于某种原因,我可以对rails应用程序进行后台处理。



我很乐意任何帮助,因为我花了一整天的时间试图解决这个问题。



干杯

解决方案

可能是因为守护程序不在您的应用程序根目录中运行服务器?



更新



要从您的根应用程序目录的另一个路径启动Rails服务器,请使用 -c 选项 rails server 命令需要您的 config.ru 文件的确切路径。


I want to use Daemons gem with my Rails project so I can easily monitore it with Monit, this gem will allow me to create PIDs and use commands like start and stop .

Anyways it seems I can't use it with rails somehow, I create a file and named it admin :

require 'rubygems'
require 'daemons'

ROOT_PATH = File.expand_path("#{File.dirname __FILE__}/../")

require "#{ROOT_PATH}/config/environment"

Daemons.run("#{ROOT_PATH}/script/rails" , 
    :dir_mode => :system, 
    :log_output => true 
)

When I try to run it with :

bundle exec ./bin/admin run -- s

I get this error :

/Users/info/.rvm/gems/ruby-1.9.3-p286/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
configuration /config.ru not found
Exiting

The config.ru file is there for sure. and I can run the application when I try to do it manually with command line, but for some reason I can daemonize the rails app .

I would appreciate any help since I spent all my day trying to iron this out .

Cheers

解决方案

May it be because daemons is not running the server in your application root directory ?

UPDATE

To launch Rails server from another path than your root app directory, use the -c option of rails server command which need the exact path to your config.ru file.

这篇关于我无法运行我的Rails应用程序与守护进程宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆