I'm writing a cookbook for a Torquebox-based application server, and seeing some odd behavior when using knife for deploys.
When logging into a box as user "ubuntu" and running "sudo chef-client", everything works fine.
When I do the same via "knife ssh", I get GemNotFound errors when calling rake. This leads me to believe it's an environment/path problem, but I can't figure out what would be different. Does knife alter the environment in which a command is executed?
Here is my knife command: knife ssh "role:rails_app_server" interactive -x ubuntu -a ec2.public_hostname -C 1
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:17 +0000] INFO: execute[jruby -J-Xmx2048m -J-Xms512m -J-Xmn128m -S bundle install --without development test --deployment] ran successfully
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:17 +0000] INFO: deploy[/var/www/shareaholic_on_rails] made pre-migration symlinks
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:23 +0000] INFO: deploy[/var/www/shareaholic_on_rails] set user to torquebox
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:23 +0000] INFO: deploy[/var/www/shareaholic_on_rails] set group to torquebox
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:23 +0000] INFO: deploy[/var/www/shareaholic_on_rails] migrating torquebox with environment RACK_ENV='production' JRUBY_OPTS='--1.9'
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:23 +0000] DEBUG: Executing jruby -S bundle exec rake db:migrate
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: ---- Begin output of jruby -S bundle exec rake db:migrate ----
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: STDOUT:
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: STDERR: Bundler::GemNotFound: Could not find rake-0.9.2.2 in any of the sources
ec2-23-20-158-139.compute-1.amazonaws.com materialize at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/spec_set.rb:90
ec2-23-20-158-139.compute-1.amazonaws.com map! at org/jruby/RubyArray.java:2371
ec2-23-20-158-139.compute-1.amazonaws.com materialize at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/spec_set.rb:83
ec2-23-20-158-139.compute-1.amazonaws.com specs at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/definition.rb:127
ec2-23-20-158-139.compute-1.amazonaws.com specs_for at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/definition.rb:172
ec2-23-20-158-139.compute-1.amazonaws.com requested_specs at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/definition.rb:161
ec2-23-20-158-139.compute-1.amazonaws.com requested_specs at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/environment.rb:23
ec2-23-20-158-139.compute-1.amazonaws.com setup at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/runtime.rb:11
ec2-23-20-158-139.compute-1.amazonaws.com setup at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler.rb:107
ec2-23-20-158-139.compute-1.amazonaws.com (root) at /usr/local/share/torquebox-2.x.incremental.1103/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.5/lib/bundler/setup.rb:17
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: ---- End output of jruby -S bundle exec rake db:migrate ----
ec2-23-20-158-139.compute-1.amazonaws.com [Mon, 23 Jul 2012 20:58:47 +0000] DEBUG: Ran jruby -S bundle exec rake db:migrate returned 1
Any thoughts would be much appreciated.