与流浪汉和厨师一起建立Nginx

与流浪汉和厨师一起建立Nginx,nginx,chef-infra,vagrant,Nginx,Chef Infra,Vagrant,重新开始P@crum2尝试了apt获取更新,但没有成功:我确实和我的朋友谈过,他说我用的是他的一盒不是最可靠的。有办法保存一个盒子吗?是在通过厨师等进行供应之后?需要做更多的阅读。。。明显地因此,我改为: 流浪汉档案 # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = "http:

重新开始P@crum2尝试了apt获取更新,但没有成功:我确实和我的朋友谈过,他说我用的是他的一盒不是最可靠的。有办法保存一个盒子吗?是在通过厨师等进行供应之后?需要做更多的阅读。。。明显地因此,我改为:

流浪汉档案

  # -*- mode: ruby -*-
  # vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "precise64"

  config.vm.box_url = "http://files.vagrantup.com/precise64.box"

  config.vm.network :public_network

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory", "1024"]
  end

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "cookbooks"
    chef.add_recipe "nginx"
  end

end
我已经创建了自己的烹饪书目录,并根据以下内容下载了我认为需要的内容:

食谱

   |__build-essential
   |__nginx
   |__ohai
   |__runit
终端输出

mac-mini:test admin$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise64'...
[default] Matching MAC address for NAT networking...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Available bridged network interfaces:
1) en0: Ethernet
2) en1: Wi-Fi (AirPort)
What interface should the network bridge to? 1
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Running any VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] Running provisioner: VagrantPlugins::Chef::Provisioner::ChefSolo...
Generating chef JSON and uploading...
Running chef-solo...
stdin: is not a tty
[2013-04-15T23:42:59+00:00] INFO: *** Chef 10.14.2 ***
[2013-04-15T23:42:59+00:00] INFO: Setting the run_list to ["recipe[nginx]"] from JSON
[2013-04-15T23:42:59+00:00] INFO: Run List is [recipe[nginx]]
[2013-04-15T23:42:59+00:00] INFO: Run List expands to [nginx]
[2013-04-15T23:42:59+00:00] INFO: Starting Chef Run for precise64
[2013-04-15T23:42:59+00:00] INFO: Running start handlers
[2013-04-15T23:42:59+00:00] INFO: Start handlers complete.
[2013-04-15T23:43:00+00:00] INFO: ohai plugins will be at: /etc/chef/ohai_plugins
[2013-04-15T23:43:00+00:00] INFO: Processing remote_directory[/etc/chef/ohai_plugins] action create (ohai::default line 30)
[2013-04-15T23:43:00+00:00] INFO: Processing directory[/etc/chef/ohai_plugins] action create (dynamically defined)
[2013-04-15T23:43:00+00:00] INFO: directory[/etc/chef/ohai_plugins] created directory /etc/chef/ohai_plugins
[2013-04-15T23:43:00+00:00] INFO: directory[/etc/chef/ohai_plugins] mode changed to 755
[2013-04-15T23:43:00+00:00] INFO: Processing cookbook_file[/etc/chef/ohai_plugins/README] action create (dynamically defined)
[2013-04-15T23:43:00+00:00] INFO: cookbook_file[/etc/chef/ohai_plugins/README] mode changed to 644
[2013-04-15T23:43:00+00:00] INFO: cookbook_file[/etc/chef/ohai_plugins/README] created file /etc/chef/ohai_plugins/README
[2013-04-15T23:43:00+00:00] INFO: remote_directory[/etc/chef/ohai_plugins] created directory /etc/chef/ohai_plugins
[2013-04-15T23:43:00+00:00] INFO: remote_directory[/etc/chef/ohai_plugins] mode changed to 755
[2013-04-15T23:43:00+00:00] INFO: Processing ohai[custom_plugins] action reload (ohai::default line 44)
[2013-04-15T23:43:00+00:00] INFO: ohai[custom_plugins] reloaded
[2013-04-15T23:43:00+00:00] INFO: Processing ohai[reload_nginx] action nothing (nginx::ohai_plugin line 22)
[2013-04-15T23:43:00+00:00] INFO: Processing template[/etc/chef/ohai_plugins/nginx.rb] action create (nginx::ohai_plugin line 27)
[2013-04-15T23:43:00+00:00] INFO: template[/etc/chef/ohai_plugins/nginx.rb] updated content
[2013-04-15T23:43:00+00:00] INFO: template[/etc/chef/ohai_plugins/nginx.rb] owner changed to 0
[2013-04-15T23:43:00+00:00] INFO: template[/etc/chef/ohai_plugins/nginx.rb] group changed to 0
[2013-04-15T23:43:00+00:00] INFO: template[/etc/chef/ohai_plugins/nginx.rb] mode changed to 755
[2013-04-15T23:43:00+00:00] INFO: template[/etc/chef/ohai_plugins/nginx.rb] sending reload action to ohai[reload_nginx] (immediate)
[2013-04-15T23:43:00+00:00] INFO: Processing ohai[reload_nginx] action reload (nginx::ohai_plugin line 22)
[2013-04-15T23:43:00+00:00] INFO: ohai[reload_nginx] reloaded
[2013-04-15T23:43:00+00:00] INFO: Processing remote_directory[/etc/chef/ohai_plugins] action nothing (ohai::default line 30)
[2013-04-15T23:43:00+00:00] INFO: Processing ohai[custom_plugins] action nothing (ohai::default line 44)
[2013-04-15T23:43:00+00:00] INFO: Processing package[nginx] action install (nginx::default line 35)

================================================================================
Error executing action `install` on resource 'package[nginx]'
================================================================================

Chef::Exceptions::Exec
----------------------
apt-get -q -y install nginx=1.1.19-1 returned 100, expected 0

Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nginx/recipes/default.rb

 34:   end
 35:   package node['nginx']['package_name']
 36:   service 'nginx' do

Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nginx/recipes/default.rb:35:in `from_file'

package("nginx") do
  retry_delay 2
  retries 0
  recipe_name "default"
  action :install
  cookbook_name :nginx
  package_name "nginx"
end

[2013-04-15T23:43:04+00:00] ERROR: Running exception handlers
[2013-04-15T23:43:04+00:00] ERROR: Exception handlers complete
[2013-04-15T23:43:04+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2013-04-15T23:43:04+00:00] FATAL: Chef::Exceptions::Exec: package[nginx] (nginx::default line 35) had an error: Chef::Exceptions::Exec: apt-get -q -y install nginx=1.1.19-1 returned 100, expected 0
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
主厨Stacktrace

Generated at Mon Apr 15 23:43:04 +0000 2013
Chef::Exceptions::Exec: package[nginx] (nginx::default line 35) had an error: Chef::Exceptions::Exec: apt-get -q -y install nginx=1.1.19-1 returned 100, expected 0
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/mixin/command.rb:128:in `handle_command_failures'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/mixin/command.rb:75:in `run_command'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/mixin/command.rb:143:in `run_command_with_systems_locale'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/provider/package/apt.rb:97:in `install_package'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/provider/package.rb:81:in `action_install'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/mixin/why_run.rb:63:in `call'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/mixin/why_run.rb:63:in `converge!'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/mixin/why_run.rb:61:in `each'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/mixin/why_run.rb:61:in `converge!'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/provider.rb:136:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/provider.rb:125:in `run_action'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource.rb:593:in `run_action'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/runner.rb:49:in `run_action'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/runner.rb:81:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/runner.rb:81:in `each'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/runner.rb:81:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource_collection.rb:94:in `execute_each_resource'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource_collection/stepable_iterator.rb:85:in `step'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource_collection.rb:92:in `execute_each_resource'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/runner.rb:80:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/client.rb:378:in `converge'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/client.rb:420:in `do_run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/client.rb:176:in `run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/application/solo.rb:230:in `run_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/application/solo.rb:218:in `loop'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/application/solo.rb:218:in `run_application'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/application.rb:70:in `run'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/chef-solo:25
/opt/vagrant_ruby/bin/chef-solo:19:in `load'
/opt/vagrant_ruby/bin/chef-solo:19

伙计们,我错过了什么?请随时向我推荐好的阅读材料。

不知何故,APT无法在版本1.1.19-1中安装nginx软件包-您是否手动指定了该版本?可能在框内运行一个
apt get update
来刷新包索引并重试(可能旧的nginx包由于更新而不可用)。

所以在添加apt之后,我的问题都解决了,这个家伙现在似乎已经解决了。这有助于:。删除此项或将其保留:P

这是一个更好的解决方案。谢谢