Nginx乘客RVM食谱厨师

时间:2014-10-16 20:57:47

标签: nginx rvm chef passenger chef-recipe

无法使用chef-solo设置nginx-passenger模块.Phusion乘客编译问题。

cookbook' rvm','〜> 0.9.2'

食谱&nbspx','〜> 2.7.4'

我已经通过其他类似线程的解决方案,但没有成功......任何帮助都非常感谢..

我的配置

{
   "name": "nginx-server",
   "description": "Nginx server",
   "default_attributes": {
      "rvm": {
          "default_ruby":"ruby-2.1.2",
          "gems": {
            "2.1.2": [
              {"name": "bundler"},
              {"name": "passenger"},
              {"name": "rake"}
            ]
          }           
        },
      "nginx": {
          "version": "1.4.1",
          "dir" : "/etc/nginx",
          "log_dir" : "/var/log/nginx",
          "binary": "/opt/nginx-1.4.1/sbin",
          "user" : "www-data",
          "init_style" : "init",
          "source" :{
              "modules" : [
                  "nginx::http_stub_status_module", 
                  "nginx::http_gzip_static_module",
                  "nginx::passenger"
                  ]
              },
              "passenger" : {
                  "version": "3.0.21",
                  "ruby" : "/usr/local/rvm/rubies/ruby-2.1.2/bin/ruby", 
                  "root" : "/usr/local/rvm/gems/ruby-2.1.2/gems/passenger-3.0.21" 

              }
        }        
   },
   "json_class": "Chef::Role",
   "run_list": [
      "rvm::system",
      "rvm::gem_package", 
      "nginx::source", 
      "monit_configs-tlq::nginx"
   ],
   "chef_type": "role",
   "override_attributes": {
   }
}

错误消息:Phusion Passenger支持文件尚未编译。为您编译

adding module in /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-3.0.21/ext/nginx
*** The Phusion Passenger support files are not yet compiled. Compiling them for you... ***
*** Running 'rake nginx RELEASE=yes' in /usr/local/rvm/gems/ruby-2.1.2/gems/passenger-3.0.21/ext/nginx... ***
STDERR: /opt/chef/embedded/bin/rake:9:in `require': no such file to load -- rubygems (LoadError)
    from /opt/chef/embedded/bin/rake:9
---- End output of "bash"  "/tmp/chef-script20141016-27177-1eqrpme" ----
Ran "bash"  "/tmp/chef-script20141016-27177-1eqrpme" returned 1
[2014-10-16T20:45:43+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above. 

任何解决这个问题的想法都会有很大的帮助...... :)

非常感谢

戴夫

1 个答案:

答案 0 :(得分:1)

问题是您正在尝试使用RVM中的ruby二进制文件,但您的路径仍然设置为使用Chef omnibus install中的其他脚本。跟踪显示运行omnibus文件夹的rake,但是来自RVM的ruby。在运行rake之前,修复用于bash配方的PATH环境变量或在bash代码中获取RVM shell配置。这可能需要分配上述烹饪书,除非他们明确支持彼此。