Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chef Server installation issues

Tags:

chef-infra

I have been trying to install chef server (chef-server-core-12.1.0-1.el6.x86_64.rpm), on my CentOS 6.5 machine using this guide: http://docs.chef.io/server/install_server.html#standalone This is a test environment, hence I Do not have a FQDN but the IP address is resolvable. After I run chef-server-ctl reconfigure, I try to create a user using:

[root@xxx-xxx-xxx-xxx ~]# chef-server-ctl user-create myusername myfirstname mylastname myemail mypassword --filename /root/myfile.pem

I fill appropriate details in the above command, but I keep getting this error:

ERROR: Connection refused connecting to https://127.0.0.1/users/, retry 5/5
ERROR: Network Error: Connection refused - Connection refused connecting to        https://127.0.0.1/users/, giving up
Check your knife configuration and network settings

The ngnix service is down all the time, cannot get it to start. After going though the logs:

 tail -f /var/log/opscode/nginx/current 
 2015-07-01_10:59:00.69218 nginx: [emerg] invalid number of arguments in "server_name" directive in /var/opt/opscode/nginx/etc/chef_https_lb.conf:3

The file chef_https_lb.conf is as follows:

server {
listen 443;
server_name ;

access_log /var/log/opscode/nginx/access.log opscode;

I am not sure whats going wrong. Anyone shed some light please?

like image 265
Madz Avatar asked Jun 30 '15 13:06

Madz


People also ask

How do I check my chefs server status?

On each Chef Server there is a Status endpoint located at https://fqdn/_status. It pings the various systems needed for your Chef Server to be healthy and if any return an erroneous response, it will return a HTTP 500 error to the requestor.


2 Answers

In case somebody stumbles across this searching for an answer ( Just as I did ). The problem is you need to set the FQDN of the server other than localhost.

Example on Centos 6.6

In your /etc/hosts file, the top line that reads ( or similar to )

127.0.0.1 localhost

Change localhost to the hostname you have set for your server (/etc/sysconfig/network)

127.0.0.1 servername.com

Restart your networking service

$: service network restart

When you run the following commands on the servers terminal

$: hostname
$: hostname -f

They should both output "servername.com"

Run chef-server-ctl reconfigure to rebuild the ssl certificate for the chef server.

You should be able to add your admin user / ORG and the opscode-manage web interface

like image 81
John Avatar answered Sep 24 '22 02:09

John


In my case it was nginx failing to bind to port 80 because apache2 was already using it. So my chef-server-ctl tail nginx looks like this

# chef-server-ctl tail nginx                                                                                                                                                  
==> /var/log/opscode/nginx/internal-chef.access.log <==

==> /var/log/opscode/nginx/error.log <==
2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
2016/07/20 12:22:29 [emerg] 28912#0: listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
2016/07/20 12:22:29 [emerg] 28912#0: still could not bind()

So I looked at the nginx.conf file and commented out the server that listen to port 80 - seeing as it redirects to 443 anyway. I then restart nginx and chef-server-ctl user-create ... works :) e.g.

# vi /var/opt/opscode/nginx/etc/nginx.conf
 ...
    # We support three options: serve nothing on non_ssl_port (80),
    # redirect to https, or actually serve the API.
    #     server {
    #       listen 80;
    #       access_log /var/log/opscode/nginx/rewrite-port-80.log;
    #       return 301 https://$host$request_uri;
    #     }

# chef-server-ctl restart nginx
ok: run: nginx: (pid 32236) 0s
# chef-server-ctl user-create username fname sname [email protected] password --filename username.pem
like image 37
Steve Thorn Avatar answered Sep 24 '22 02:09

Steve Thorn