我試圖設置Nginx的乘客在RVM廚師使用社區食譜nginx和fnichol的RVM。一切都在Ubuntu上。RVM + Nginx +乘客在廚師
現在,我的問題是,如果我使用刀ec2引導機器並嘗試安裝一切,它會失敗。
大多數情況下,它運行良好,很好地撿起RVM和Passenger,直到它意識到Passenger沒有被編譯,試圖用默認的ruby 1.9.1中的rake來做,並且失敗。
如果我然後連接到機器並運行sudo chef-client
,所有東西都完美無瑕,並且我已正確配置機器。爲什麼它不能在第一次運行? 我在第一次運行期間丟失了什麼設置/路徑元素/環境變量?
我的食譜很簡單:
include_recipe "chef_gem"
include_recipe "rvm::system"
include_recipe "rvm::gem_package"
group "rvm" do
action :modify
members "ubuntu"
append true
end
include_recipe "nginx::source"
我的屬性有點少這樣:
# rvm
normal['rvm']['rubies'] = ['2.1.0']
normal['rvm']['default_ruby'] = node['rvm']['rubies'].first
normal['rvm']['user_default_ruby'] = node['rvm']['rubies'].first
normal['rvm']['gems'][node['rvm']['default_ruby']] = [{name: "bundler"}, {name: "rake"}]
# nginx
normal['nginx']['version'] = '1.4.5'
normal['nginx']['dir'] = '/etc/nginx'
normal['nginx']['log_dir'] = '/var/log/nginx'
normal['nginx']['binary'] = "/opt/nginx-#{node['nginx']['version']}/sbin"
normal['nginx']['source']['sbin_path'] = "#{node['nginx']['binary']}/nginx"
normal['nginx']['init_style'] = 'init'
normal['nginx']['default_site_enabled'] = false
normal['nginx']['source']['version'] = node['nginx']['version']
normal['nginx']['source']['modules'] = ["nginx::http_stub_status_module",
"nginx::http_ssl_module",
"nginx::http_gzip_static_module",
"nginx::passenger"]
normal['nginx']['source']['prefix'] = "/opt/nginx-#{node['nginx']['source']['version']}"
normal['nginx']['source']['default_configure_flags'] = ["--prefix=#{node['nginx']['source']['prefix']}",
"--conf-path=#{node['nginx']['dir']}/nginx.conf",
"--sbin-path=#{node['nginx']['source']['sbin_path']}"]
normal['nginx']['source']['url'] = "http://nginx.org/download/nginx-#{node['nginx']['source']['version']}.tar.gz"
# passenger
normal['nginx']['passenger']['version'] = '4.0.37'
normal['nginx']['passenger']['ruby'] = "#{node['rvm']['root_path']}/wrappers/ruby-#{node['rvm']['default_ruby']}/ruby"
normal['nginx']['passenger']['gem_binary'] = "#{node['rvm']['root_path']}/wrappers/ruby-#{node['rvm']['default_ruby']}/gem"
normal['nginx']['passenger']['root'] = "#{node['rvm']['root_path']}/gems/ruby-#{node['rvm']['default_ruby']}/gems/passenger-#{node['nginx']['passenger']['version']}"
normal['nginx']['configure_flags'] = ["--add-module=#{node['rvm']['root_path']}/gems/ruby-#{node['rvm']['default_ruby']}/gems/passenger-#{node['nginx']['passenger']['version']}/ext/nginx"]
有問題的一部分:
*** The Phusion Passenger support files are not yet compiled. Compiling them for you... ***
*** Running 'rake nginx CACHING=false' in /usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/ext/nginx... ***
STDERR: /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find rake (>= 0) amongst [] (Gem::LoadError)
from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
from /opt/chef/embedded/bin/rake:22:in `<main>'
---- End output of "bash" "/tmp/chef-script20140306-1255-1fqdatt" ----
Ran "bash" "/tmp/chef-script20140306-1255-1fqdatt" returned 1
[2014-03-06T11:42:13+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
導致上面的命令是:
cd nginx-1.4.5 && ./configure --prefix=/opt/nginx-1.4.5 --conf-path=/etc/nginx/nginx.conf --sbin-path=/opt/nginx-1.4.5/sbin/nginx --add-module=/usr/local/rvm/gems/ruby-2.1.0/gems/passenger-4.0.37/ext/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module && make && make install`
我發現了許多使用Passenger和RVM配置Nginx的指南,但都沒有完成。 請幫忙
我喜歡你已經設置了使用屬性的方式取代
ENV['PATH']
,我只是和你一樣開始,它爲我提供了一個很棒的指針 - 所以謝謝你! – Tim