shedd / duckpan-vagrant

Vagrant + Chef virtual development environment for DuckDuckGo (http://duckduckhack.com)
Apache License 2.0
5 stars 5 forks source link

Update cookbooks and recipes #8

Closed vasanthela closed 10 years ago

vasanthela commented 10 years ago

Two major changes here are the following

  1. Use submodules for all recipes in the cookbook
  2. Move all commands from duckpan.sh into the default recipe for duckpan

Takes roughly 20 minutes to successfully provision.

Next steps would be to download all the repos and installdeps. Which I initially removed from duckpan.sh since it was causing errors on fresh vagrant installs.

vasanthela commented 10 years ago

@shedd Tested this via vagrant, but you should also try it before merging. Verify after it runs by sshing in and running duckpan.

shedd commented 10 years ago

I think it would make sense to include a reminder in the README so that users remember to pull down the submodules. See: https://github.com/shedd/duckpan-vagrant/commit/e05f5434a499ee6b69901ae4b477ac63f01cbd6c

shedd commented 10 years ago

hmm. Seems like some further testing is required.

I ran into an intermittent issue with the duckpan cookbook.

Here's what I saw:

...
[2013-11-18T22:40:36+00:00] INFO: execute[duckpan_install_first] ran successfully
[2013-11-18T23:04:21+00:00] ERROR: Running exception handlers
[2013-11-18T23:04:21+00:00] ERROR: Exception handlers complete
[2013-11-18T23:04:21+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2013-11-18T23:04:21+00:00] FATAL: TypeError: can't convert nil into String
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.

So I checked /var/chef/cache/chef-stacktrace.out on the Vagrant machine - here are the contents:

root@precise64:/home/vagrant# cat /var/chef/cache/chef-stacktrace.out
Generated at Mon Nov 18 23:04:21 +0000 2013
TypeError: can't convert nil into String
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:96:in `+'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:96:in `format_line'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:70:in `recipe_snippet'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:63:in `loop'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:63:in `recipe_snippet'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/formatters/error_inspectors/resource_failure_inspector.rb:43:in `add_explanation'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/formatters/error_mapper.rb:72:in `resource_failed'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/formatters/base.rb:157:in `resource_failed'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/event_dispatch/dispatcher.rb:29:in `resource_failed'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/event_dispatch/dispatcher.rb:29:in `each'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/event_dispatch/dispatcher.rb:29:in `resource_failed'
/opt/vagrant_ruby/lib/ruby/gems/1.8/gems/chef-10.14.2/bin/../lib/chef/resource.rb:605: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'

It's not really clear what it was complaining about.

I re-ran Chef again - this time it worked:

➜  duckpan-vagrant git:(pr/8) vagrant provision
[default] Running provisioner: chef_solo...
Generating chef JSON and uploading...
Running chef-solo...
stdin: is not a tty
[2013-11-18T23:24:26+00:00] INFO: *** Chef 10.14.2 ***
[2013-11-18T23:24:26+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[build-essential]", "recipe[duckpan]"] from JSON
[2013-11-18T23:24:26+00:00] INFO: Run List is [recipe[apt], recipe[build-essential], recipe[duckpan]]
[2013-11-18T23:24:26+00:00] INFO: Run List expands to [apt, build-essential, duckpan]
[2013-11-18T23:24:26+00:00] INFO: Starting Chef Run for precise64
[2013-11-18T23:24:26+00:00] INFO: Running start handlers
[2013-11-18T23:24:26+00:00] INFO: Start handlers complete.
[2013-11-18T23:24:27+00:00] INFO: execute[sudo apt-get -y install perl-doc] ran successfully
[2013-11-18T23:24:29+00:00] INFO: execute[su -l vagrant -c 'wget -L http://duckpan.com/install.pl -O duckpan-install.pl'] ran successfully
[2013-11-18T23:24:32+00:00] INFO: execute[duckpan_install_first] ran successfully
[2013-11-18T23:28:12+00:00] INFO: execute[duckpan_install_again] ran successfully
[2013-11-18T23:28:12+00:00] INFO: Chef Run complete in 225.758726 seconds
[2013-11-18T23:28:12+00:00] INFO: Running report handlers
[2013-11-18T23:28:12+00:00] INFO: Report handlers complete

Did you see anything like this when you tested this branch?

vasanthela commented 10 years ago

Yes I did see that, but I guess I didn't run into it due to running vagrant provision, instead of vagrant up. Let me try again.

vasanthela commented 10 years ago

I just ran it and it worked.

~/appxray/duckduckgo/duckpan-vagrant(branch:update_cookbooks*) » vagrant destroy
Are you sure you want to destroy the 'default' VM? [y/N] y
[default] Forcing shutdown of VM...
[default] Destroying VM and associated drives...
[default] Running cleanup tasks for 'chef_solo' provisioner...
------------------------------------------------------------
~/appxray/duckduckgo/duckpan-vagrant(branch:update_cookbooks*) » 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] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] -- 5000 => 5000 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Mounting shared folders...
[default] -- /code
[default] -- /vagrant
[default] -- /tmp/vagrant-chef-1/chef-solo-1/cookbooks
[default] Running provisioner: chef_solo...
Generating chef JSON and uploading...
Running chef-solo...
stdin: is not a tty
[2013-11-19T05:04:46+00:00] INFO: *** Chef 10.14.2 ***
[2013-11-19T05:04:46+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[build-essential]", "recipe[duckpan]"] from JSON
[2013-11-19T05:04:46+00:00] INFO: Run List is [recipe[apt], recipe[build-essential], recipe[duckpan]]
[2013-11-19T05:04:46+00:00] INFO: Run List expands to [apt, build-essential, duckpan]
[2013-11-19T05:04:46+00:00] INFO: Starting Chef Run for precise64
[2013-11-19T05:04:46+00:00] INFO: Running start handlers
[2013-11-19T05:04:46+00:00] INFO: Start handlers complete.
[2013-11-19T05:05:05+00:00] INFO: execute[apt-get-update] ran successfully
[2013-11-19T05:05:13+00:00] INFO: package[update-notifier-common] sending run action to execute[apt-get-update] (immediate)
[2013-11-19T05:05:16+00:00] INFO: execute[apt-get-update] ran successfully
[2013-11-19T05:05:16+00:00] INFO: directory[/var/cache/local] created directory /var/cache/local
[2013-11-19T05:05:16+00:00] INFO: directory[/var/cache/local] owner changed to 0
[2013-11-19T05:05:16+00:00] INFO: directory[/var/cache/local] group changed to 0
[2013-11-19T05:05:16+00:00] INFO: directory[/var/cache/local] mode changed to 755
[2013-11-19T05:05:16+00:00] INFO: directory[/var/cache/local/preseeding] created directory /var/cache/local/preseeding
[2013-11-19T05:05:16+00:00] INFO: directory[/var/cache/local/preseeding] owner changed to 0
[2013-11-19T05:05:16+00:00] INFO: directory[/var/cache/local/preseeding] group changed to 0
[2013-11-19T05:05:16+00:00] INFO: directory[/var/cache/local/preseeding] mode changed to 755
[2013-11-19T05:06:38+00:00] INFO: remote_file[/usr/local/bin/cpanm] updated
[2013-11-19T05:06:38+00:00] INFO: remote_file[/usr/local/bin/cpanm] owner changed to 0
[2013-11-19T05:06:38+00:00] INFO: remote_file[/usr/local/bin/cpanm] group changed to 0
[2013-11-19T05:06:38+00:00] INFO: remote_file[/usr/local/bin/cpanm] mode changed to 755
[2013-11-19T05:07:38+00:00] INFO: execute[sudo apt-get -y install perl-doc] ran successfully
[2013-11-19T05:07:40+00:00] INFO: execute[su -l vagrant -c 'wget -L http://duckpan.com/install.pl -O duckpan-install.pl'] ran successfully
[2013-11-19T05:08:01+00:00] INFO: execute[duckpan_install_first] ran successfully
[2013-11-19T05:31:26+00:00] INFO: execute[duckpan_install_again] ran successfully
[2013-11-19T05:31:26+00:00] INFO: Chef Run complete in 1600.122601 seconds
[2013-11-19T05:31:26+00:00] INFO: Running report handlers
[2013-11-19T05:31:26+00:00] INFO: Report handlers complete
shedd commented 10 years ago

Interesting. I'll try it again.

shedd commented 10 years ago

I ran into the same issue on my second attempt.

Are you running Vagrant 1.3.5?

vasanthela commented 10 years ago

Yes, on vagrant 1.3.5

shedd commented 10 years ago

I ran it again with Chef debug on. No errors this time. Nothing else changed.

[2013-11-20T01:21:06+00:00] DEBUG: STDERR:
[2013-11-20T01:21:06+00:00] DEBUG: ---- End output of apt-get -q -y install git=1:1.7.9.5-1 ----
[2013-11-20T01:21:06+00:00] DEBUG: Ran apt-get -q -y install git=1:1.7.9.5-1 returned 0
[2013-11-20T01:21:06+00:00] INFO: Processing execute[sudo apt-get -y install perl-doc] action run (duckpan::default line 9)
[2013-11-20T01:21:47+00:00] INFO: execute[sudo apt-get -y install perl-doc] ran successfully
[2013-11-20T01:21:47+00:00] INFO: Processing execute[su -l vagrant -c 'wget -L http://duckpan.com/install.pl -O duckpan-install.pl'] action run (duckpan::default line 12)
[2013-11-20T01:21:49+00:00] INFO: execute[su -l vagrant -c 'wget -L http://duckpan.com/install.pl -O duckpan-install.pl'] ran successfully
[2013-11-20T01:21:49+00:00] INFO: Processing execute[duckpan_install_first] action run (duckpan::default line 17)
[2013-11-20T01:22:03+00:00] INFO: execute[duckpan_install_first] ran successfully
[2013-11-20T01:22:03+00:00] INFO: Processing execute[duckpan_install_again] action run (duckpan::default line 28)
[2013-11-20T03:57:50+00:00] INFO: execute[duckpan_install_again] ran successfully
[2013-11-20T03:57:50+00:00] INFO: Chef Run complete in 9646.973704 seconds
[2013-11-20T03:57:50+00:00] DEBUG: Cleaning the checksum cache
[2013-11-20T03:57:50+00:00] INFO: Running report handlers
[2013-11-20T03:57:50+00:00] INFO: Report handlers complete
[2013-11-20T03:57:50+00:00] DEBUG: Exiting
shedd commented 10 years ago

Tried again and it also worked. I'll go ahead and merge this in.