Issue with changing Nginx ports


#1

Greetings:

I am new to Chef. I have a playground where ports 80 and 443 are already in use.

I understand that I can set different ports for Nginx by adding the following lines to /etc/opscode/chef-server.rb
(https://docs.chef.io/config_rb_server_optional_settings.html#nginx):
[root@server ~]# cat /etc/opscode/chef-server.rb
nginx[‘non_ssl_port’] = 9001
nginx[‘ssl_port’] = 9002
[root@server ~]#

Running ‘chef-server-ctl reconfigure’ I get the following error, when I try to upload a cookbook:
[root@workstation learn-chef]# knife cookbook upload learn_chef_httpd
Uploading learn_chef_httpd [0.1.0]
ERROR: Server returned error 500 for https://server:9002/organizations/playground/sandboxes/b5e55e1d2b516d80e4bbc01163986751, retrying 1/5 in 4s
ERROR: Server returned error 500 for [link removed], retrying 2/5 in 6s
ERROR: Server returned error 500 for [link removed], retrying 3/5 in 9s
ERROR: Server returned error 500 for [link removed], retrying 4/5 in 27s
ERROR: Server returned error 500 for [link removed], retrying 5/5 in 44s
ERROR: internal server error
Response: internal service error
[root@workstation learn-chef]#
Note: I had to remove the links from the output as new users are allowed to include max two links to a posting.

Everything works fine after removing the lines, reconfiguring the server and updating the knife.rb file:
[root@workstation learn-chef]# knife cookbook upload learn_chef_httpd
Uploading learn_chef_httpd [0.1.0]
Uploaded 1 cookbook.
[root@workstation learn-chef]#

Any clue how to get this resolved?

Thanks,
Ulf

Code Levels
chefdk-3.1.0-1.el7.x86_64
chef-server-core-12.17.33-1.el7.x86_64


#2

Take a look at https://stackoverflow.com/questions/17998272/chef-server-on-different-port . Looks like you need to edit chef-server.rb, as well.

Note that Chef, at least, are big believers in the chef-server running on its own dedicated host. You might strongly consider this, or running Chef in a docker container on its own IP address to avoid just this confusion.


#3

Thank you.

Adding “bookshelf[‘vip_port’]” to /etc/opscode/chef-server.rb and reconfiguring the server did the trick.
I found that setting in the discussion of the issue on GitHub: https://github.com/chef/chef-server/issues/50

[root@server ~]# cat /etc/opscode/chef-server.rb
nginx[‘non_ssl_port’] = 9001
nginx[‘ssl_port’] = 9002
bookshelf[‘vip_port’] = 9002
[root@server ~]#

I will consider to install Chef Server in a container later.


#5

Trying to bootstrap a node fails for non default ports.
So I installed and configured Chef Server on a different server using default ports.
There uploading cookbooks and bootstrapping servers works fine. The only difference is the configuration of the ports.
I plan to install Chef Server in a container later.


Preparing… ################################# [100%]
Updating / installing…
1:chef-14.3.37-1.el7 ################################# [100%]
Thank you for installing Chef!
Starting the first Chef Client run…
Starting Chef Client, version 14.3.37

================================================================================
Chef encountered an error attempting to load the node data for “c902gen1comp08”

Authorization Error

Your client is not authorized to load the node data (HTTP 403).

Server Response:

Cannot fetch the contents of the response.

Possible Causes:

  • Your client (c902gen1comp08) may have misconfigured authorization permissions.

#6

Did you update your working “knife” setup, when you did the bootstrap, with the new URL? Or did you try setting it manually as part of the server URL in your “knife bootstrap” options?


#7

I updated the knife.rb:

chef_server_url ‘https://server.mydomain.com:9002/organizations/playground