0

我正在尝试使用-d交换机将 rails 服务器作为守护进程启动。我已经安装了瘦服务器并在 Ubuntu 上工作。如果它作为正常进程启动,它可以工作,但是当使用-d开关时,它会抱怨服务器 pid 文件/tmp/pids/server.pid

即使我删除文件并尝试使用-d开关启动服务器,它也不会启动。请帮忙。

错误说:

/usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:33:in `block in setup': You have already activated daemons 1.1.9, but your Gemfile requires daemons 1.1.8. Using bundle exec may solve this. (Gem::LoadError)

        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:19:in `setup'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
        from /usr/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `require'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:110:in `rescue in require'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:35:in `require'
        from /home/ubuntu/deploys/releases/20131001113746/config/boot.rb:6:in `<top (required)>'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /home/ubuntu/deploys/releases/20131001113746/config/application.rb:1:in `<top (required)>'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /home/ubuntu/deploys/releases/20131001113746/config/environment.rb:2:in `<top (required)>'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /home/ubuntu/deploys/releases/20131001113746/config.ru:3:in `block in <main>'
        from /usr/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
        from /usr/lib/ruby/gems/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
        from /home/ubuntu/deploys/releases/20131001113746/config.ru:1:in `new'
        from /home/ubuntu/deploys/releases/20131001113746/config.ru:1:in `<main>'
        from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `eval'
        from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `load'
        from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/rack/adapter/loader.rb:42:in `for'
        from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:169:in `load_adapter'
        from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/controllers/controller.rb:73:in `start'
        from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
        from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!'
        from /usr/lib/ruby/gems/1.9.1/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
        from /usr/bin/thin:23:in `load'
        from /usr/bin/thin:23:in `<main>'
4

1 回答 1

1

在开始时使用“bundle exec”运行服务器,例如:

bundle exec rails s -d

或者,您的异常跟踪表明激活的守护程序 gem 不匹配。要解决此问题,请将 daemons gem 的版本设置为大于(而不是等于)1.1.8 并尝试。

于 2013-10-07T15:12:10.027 回答