6

Be gentle, I'm new to chef, trying to get my environment set up and have some new recipes to upload to my new chef server. I'm able to do some commands, and I was able to knife bootstrap the new node, so I'm pretty sure my configuration is correct.

It appears that it's trying to upload to localhost when I turn on verbose logging. I have a server set in my knife.rb, and I also tried specifying a server in the knife command with -s, to no avail.

$ knife cookbook upload -a
Uploading base         [0.1.0]
Uploading dovecot      [0.1.0]
Uploading postfix      [0.1.0]
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:762:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)

With specified server:

$ knife cookbook upload -a -s https://mychefserver
Uploading base         [0.1.0]
Uploading dovecot      [0.1.0]
Uploading postfix      [0.1.0]
/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:762:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)

And with -V:

$ knife cookbook upload -a -s https://mychefserver -V
Uploading base         [0.1.0]
Uploading dovecot      [0.1.0]
Uploading postfix      [0.1.0]
INFO: Validating ruby files
INFO: Validating templates
INFO: Syntax OK
INFO: Validating ruby files
INFO: Validating templates
INFO: Syntax OK
INFO: Validating ruby files
INFO: Validating templates
INFO: Syntax OK
INFO: Saving base
INFO: Saving dovecot
INFO: Saving postfix
INFO: Uploading files
INFO: Uploading /Users/.../...-chef/cookbooks/base/recipes/default.rb (checksum hex = b3e608cb34530c1126b9df9a630af8f7) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-b3e608cb34530c1126b9df9a630af8f7?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=Yzq%2B97btwNYPEHiGwpVJjaEYs8k%3D
INFO: Uploading /Users/.../...-chef/cookbooks/base/CHANGELOG.md (checksum hex = f1df44f4bb93cd7273932708a6686e51) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-f1df44f4bb93cd7273932708a6686e51?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=/QThzu8xUqEVyzuMmIp1XPiGG28%3D
INFO: Uploading /Users/.../...-chef/cookbooks/base/metadata.json (checksum hex = 163c72c0947d9cf8c99442b215a8de44) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-163c72c0947d9cf8c99442b215a8de44?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=8oD9AJmgTk5cgpltIXMFTeQ2oi0%3D
INFO: Uploading /Users/.../...-chef/cookbooks/base/metadata.rb (checksum hex = 6608c1ae5e3ce19a777fe1059e7264c1) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-6608c1ae5e3ce19a777fe1059e7264c1?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=/fF5I2cNbupm1auyVkpzxdVaubs%3D
INFO: Uploading /Users/.../...-chef/cookbooks/base/README.md (checksum hex = 6a4d0867b35a496d39f4d2da92c86879) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-6a4d0867b35a496d39f4d2da92c86879?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=kWX4LhSquvdw68NBHxgD2s%2BPOH4%3D
INFO: Uploading /Users/.../...-chef/cookbooks/dovecot/recipes/default.rb (checksum hex = f122f4ccdcc72d81e880c467122a7606) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-f122f4ccdcc72d81e880c467122a7606?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=WAxlIpN3U5mrrUm7BGGwlbAD8lM%3D
INFO: Uploading /Users/.../...-chef/cookbooks/dovecot/CHANGELOG.md (checksum hex = 8c447bfd4084f175bbd758b330abb0a1) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-8c447bfd4084f175bbd758b330abb0a1?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=BFiSvfDIMmBUFehMvLSPru9TWwg%3D
INFO: Uploading /Users/.../...-chef/cookbooks/dovecot/metadata.json (checksum hex = a8206f560ccb896cb73be7e97cde3cbc) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-a8206f560ccb896cb73be7e97cde3cbc?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=dAqms7EwUJkmnto8kz6yrqV40kk%3D
log writing failed. Connection refused - connect(2)
log writing failed. Connection refused - connect(2)
INFO: Uploading /Users/.../...-chef/cookbooks/dovecot/metadata.rb (checksum hex = 81eccd27bf23c5ec35e8759fe80a3a7a) to https://localhost:443/bookshelf/organization-00000000000000000000000000000000/checksum-81eccd27bf23c5ec35e8759fe80a3a7a?AWSAccessKeyId=c1856885418af6721fb2be208ec54665cb869971&Expires=1362163782&Signature=Mf/KIRRgeVgpNM7DlngY5Atf%2BIQ%3D
log writing failed. Connection refused - connect(2)
log writing failed. Connection refused - connect(2)/opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:762:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:762:in `open'
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:762:in `block in connect'
from /opt/chef/embedded/lib/ruby/1.9.1/timeout.rb:68:in `timeout'
from /opt/chef/embedded/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:762:in `connect'
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from /opt/chef/embedded/lib/ruby/1.9.1/net/http.rb:744:in `start'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/resource.rb:76:in `put'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:142:in `block in uploader_function_for'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:25:in `call'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:25:in `block (3 levels) in setup_worker_threads'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:24:in `loop'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/cookbook_uploader.rb:24:in `block (2 levels) in setup_worker_threads'

Thanks in advance.

2 Answers 2

14

To summarize the IRC session at https://github.com/chef/irc_log_archives/blob/master/chef/2013/2/23.log:

Chef-server redirects api clients between its components (in this case erchef and bookshelf). These redirects are based on the FQDN of the chef-server. If the server doesn't have a valid FQDN at install time, this can result in redirects to https://localhost:443.

One solution is to fix the FQDN on chef-server and run chef-server-ctl reconfigure.

Another solution is to set a few options in /etc/chef-server/chef-server.rb (I had to create this file) and then run chef-server-ctl reconfigure.

server_name = "192.168.114.11"
api_fqdn server_name

nginx['url'] = "https://#{server_name}"
nginx['server_name'] = server_name
lb['fqdn'] = server_name
bookshelf['vip'] = server_name
2
  • 1
    Thanks, this is clearly better than reinstalling. I tried to figure it out but I think the step I was missing was the reconfigure command. Mar 9, 2013 at 14:08
  • That worked like a charm! Jun 18, 2013 at 20:35
0

Wow, I totally thought it was going to be my fault, but I managed to find this chat thread: https://github.com/chef/irc_log_archives/blob/master/chef/2013/2/23.log

And it looks like the omnibus installer uses the fqdn as the value for some of the configuration stuff. I wasn't able to figure out how to repair it, so I just reinstalled chef server via RPM (after configuring a real hostname for the box), and tried the knife commands again, and they worked--as if by magic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.