0
votes

I am trying to setup a cookbook for RVM with Chef-solo.

My run_list looks like:

  "run_list": [
    "recipe[apt]",
    "recipe[build-essential]",
    "recipe[curl]",
    "recipe[users]",
    "recipe[rvm::vagrant]",
    "recipe[rvm::system]",
    "recipe[nginx::passenger]",
    "recipe[nginx::source]",
    "recipe[postgresql::server]",
    "recipe[postgresql::client]"
  ]

My attributes for RVM and Nginx:

  "rvm": {
    "rubies": ["1.9.3-p0"],
    "global": ["1.9.3-p0"],
    "vagrant": { "system_chef_solo" : "/opt/ruby/bin/chef-solo" },
    "gems": {
      "1.9.3-p0": [
        {"name": "bundler"},
        {"name": "passenger"},
        {"name": "rake"}
      ]
    }
  },

  "nginx": {
    "version": "1.2.5",
    "user": "deploy",
    "init_style": "init",
    "modules": [
      "http_stub_status_module",
      "http_ssl_module",
      "http_gzip_static_module"
    ],
    "passenger": {
      "version": "3.0.18"
    },
    "configure_flags": [
      "--add-module=/var/lib/gems/1.9.1/gems/passenger-3.0.18/ext/nginx"
    ],
    "gzip_types": [
      "text/plain",
      "text/html",
      "text/css",
      "text/xml",
      "text/javascript",
      "application/json",
      "application/x-javascript",
      "application/xml",
      "application/xml+rss"
    ]
  },

However, the conversion breaks with:


================================================================================

Error executing action `install` on resource 'gem_package[passenger]'

================================================================================


Gem::InstallError

-----------------

passenger requires rake (>= 0.8.1)


Resource Declaration:

---------------------

# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nginx/recipes/passenger.rb

 53: gem_package 'passenger' do
 54:   action :install
 55:   version node["nginx"]["passenger"]["version"]
 56:   gem_binary node["nginx"]["passenger"]["gem_binary"] if node["nginx"]["passenger"]["gem_binary"]
 57: end
 58: 

Compiled Resource:

------------------

# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nginx/recipes/passenger.rb:53:in `from_file'

gem_package("passenger") do
  version "3.0.18"
  package_name "passenger"
  provider Chef::Provider::Package::Rubygems
  retry_delay 2
  action [:install]
  retries 0
  recipe_name "passenger"
  cookbook_name :nginx
end

....

/opt/ruby/lib/ruby/gems/1.8/gems/chef-10.18.2/bin/../lib/chef/application/solo.rb:216:in `run_application'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-10.18.2/bin/../lib/chef/application.rb:72:in `run'
/opt/ruby/lib/ruby/gems/1.8/gems/chef-10.18.2/bin/chef-solo:25
/opt/ruby/bin/chef-solo:19:in `load'
/opt/ruby/bin/chef-solo:19
[2013-02-26T14:22:18+00:00] FATAL: Gem::InstallError: gem_package[passenger] (nginx::passenger line 53) had an error: Gem::InstallError: passenger requires rake (>= 0.8.1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

What can be done?

2

2 Answers

5
votes

here is a guide a wrote, installing nginx with passenger using chef: https://coderwall.com/p/r4lv7w

1
votes

Nginx needs to be compiled from source, whereas Apache can use a Passenger module. What it means is, that the Nginx needs to know the source of the Passenger extension which is within the RVM gem.

Override: gem_binary with

"passenger": {
      "version": "3.0.18",
      "gem_binary": "/usr/local/rvm/wrappers/ruby-1.9.3-p0/gem"
    },

should do the trick.