Puppet Master 在 nginx+passenger 配置下无法作为 rack app 运行,作为系统服务运行时可以运行

Puppet Master 在 nginx+passenger 配置下无法作为 rack app 运行,作为系统服务运行时可以运行

我得到了错误

[anadi@bangda ~]# tail -f /var/log/nginx/error.log 
[ pid=19741 thr=23597654217140 file=utils.rb:176 time=2012-09-17 12:52:43.307 ]: *** Exception LoadError in PhusionPassenger::Rack::ApplicationSpawner (no such file to load -- puppet/application/master) (process 19741, thread #<Thread:0x2aec83982368>):
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
    from config.ru:13
    from /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
    from /usr/local/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1

当我启动配置了 Passenger 模块的 nginx 服务器时,Puppet Master 配置为通过 rack 运行。

这是 config.ru

[anadi@bangda ~]# cat /etc/puppet/rack/config.ru
# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.

# if puppet is not in your RUBYLIB:
#$:.unshift('/usr/share/puppet/lib')

$0 = "master"

# if you want debugging:
# ARGV << "--debug"

ARGV << "--rack"
require 'puppet/application/master'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
run Puppet::Application[:master].run

Puppet Master 的 nginx 配置如下

[anadi@bangda ~]# cat /etc/nginx/conf.d/puppet-master.conf 
server {
  listen                     8140 ssl;
  server_name                bangda.mycompany.com;

  passenger_enabled          on;
  passenger_set_cgi_param    HTTP_X_CLIENT_DN $ssl_client_s_dn; 
  passenger_set_cgi_param    HTTP_X_CLIENT_VERIFY $ssl_client_verify; 

  access_log                 /var/log/nginx/puppet/master.access.log;
  error_log                  /var/log/nginx/puppet/master.error.log;

  root                       /etc/puppet/rack/public;

  ssl_certificate            /var/lib/puppet/ssl/certs/bangda.mycompany.com.pem;
  ssl_certificate_key        /var/lib/puppet/ssl/private_keys/bangda.mycompany.com.pem;
  ssl_crl                    /var/lib/puppet/ssl/ca/ca_crl.pem;
  ssl_client_certificate     /var/lib/puppet/ssl/certs/ca.pem;
  ssl_ciphers                SSLv2:-LOW:-EXPORT:RC4+RSA;
  ssl_prefer_server_ciphers  on;
  ssl_verify_client          optional;
  ssl_verify_depth           1;
  ssl_session_cache          shared:SSL:128m;
  ssl_session_timeout        5m;
}

然而,当我通过常用的 puppetmasterd 守护进程运行 puppet 时,它运行完美,没有任何错误。

我可以看到 nginx+passenger+rack 设置初始化失败,而运行 natvie puppetmaster 守护程序时却可以正常工作。

我遗漏了什么配置吗?

更新解决了 感谢@Shane Madden 的评论,它得以正常工作

puppet 位于

/usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb

而 ruby​​ libs 期望它从

/usr/local/lib/ruby/site_ruby/1.8/

因此像这样更改了 config.ru

# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.

# if puppet is not in your RUBYLIB:
$:.unshift('/usr/lib/ruby/site_ruby/1.8/')

$0 = "master"

# if you want debugging:
# ARGV << "--debug"

ARGV << "--rack"
require 'puppet/application/master'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
run Puppet::Application[:master].run

现在有效。

答案1

解决了感谢@Shane Madden 的评论,它得以正常工作

puppet 位于

/usr/lib/ruby/site_ruby/1.8/puppet/application/master.rb

而 ruby​​ libs 期望它从

/usr/local/lib/ruby/site_ruby/1.8/

因此像这样更改了 config.ru

# a config.ru, for use with every rack-compatible webserver.
# SSL needs to be handled outside this, though.

# if puppet is not in your RUBYLIB:
$:.unshift('/usr/lib/ruby/site_ruby/1.8/')

$0 = "master"

# if you want debugging:
# ARGV << "--debug"

ARGV << "--rack"
require 'puppet/application/master'
# we're usually running inside a Rack::Builder.new {} block,
# therefore we need to call run *here*.
run Puppet::Application[:master].run

现在有效。

相关内容