NGINX -- default_site_enabled issue


#1

Hi –

I’m using the application_nginx cookbook which includes the nginx cookbook.
In my wrapper cookbook I have

cookbooks/bti_api/attributes/default.rb:
override[:nginx][:default_site_enabled] = false

However, the NGINX default site is still enabled! At the bottom of the
nginx.conf file is

include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
;
}
And conf.d/default.conf exists.

So, it seems that default_site_enabled is being ignored. Is this not
the way to turn off the default_site?

Possibly relevant info:
I’m using the nginx::repo recipe

The run_list:

INFO: Loading cookbooks [application, application_nginx,
application_python, apt, aws, bti_api, build-essential, chef_handler,
erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,
supervisor, windows, yum]

The


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#2

The upstream nginx cookbook enables the default site. I just call the
nginx_site definition on default to disable it.

nginx_site “default” do
enable false
end

Nic

On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher liamk@numenet.com wrote:

Hi –

I’m using the application_nginx cookbook which includes the nginx cookbook.
In my wrapper cookbook I have

cookbooks/bti_api/attributes/default.rb:
override[:nginx][:default_site_enabled] = false

However, the NGINX default site is still enabled! At the bottom of the
nginx.conf file is

include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
;
}
And conf.d/default.conf exists.

So, it seems that default_site_enabled is being ignored. Is this not
the way to turn off the default_site?

Possibly relevant info:
I’m using the nginx::repo recipe

The run_list:

INFO: Loading cookbooks [application, application_nginx,
application_python, apt, aws, bti_api, build-essential, chef_handler,
erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,
supervisor, windows, yum]

The


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#3

Nic,

Thanks for your response.

I tried that but it didn’t work. When I included it in my recipe the
converge threw an exception

include_recipe "nginx::repo"
nginx_site “default” do
enable false
end

[2013-06-12T17:32:36+00:00] FATAL: Chef::Exceptions::ResourceNotFound:
resource execute[nxdissite default] is configured to notify resource
service[nginx] with action reload, but service[nginx] cannot be found
in the resource collection. execute[nxdissite default] is defined in
/srv/chef/file_store/cookbooks/nginx/definitions/nginx_site.rb:32:in
`block in from_file’
Am I not referencing it correctly?

I looked in the nginx_site definition, and that only seems to deal with
the ubuntu style of linking sites in the sites-enabled directory – so
this may be a moot point anyway.
In this case (I think because it comes from the repo) nginx.conf also
is including conf.d/*.conf. That directory includes a default.conf
which is also listening on the same interface and port, so that creates
a conflict.

The default template nginx.conf.erb ends with:
include <%= node[‘nginx’][‘dir’] %>/conf.d/.conf;
include <%= node[‘nginx’][‘dir’] %>/sites-enabled/
;

It seems like the two host configuration schemes are colliding. (Or,
perhaps, conf.d /could/ be used for other type of configuration
includes. But in this case, it has a default site defined.)

I kinda think this is a bug in the template, but it may be correct for
other versions of nginx (it’s getting 1.4.1 from the repo).

In any case, thanks for the suggestion.

Liam

On 06/12/2013 08:04 AM, Nic Grayson wrote:

The upstream nginx cookbook enables the default site. I just call the
nginx_site definition on default to disable it.

nginx_site “default” do
enable false
end

Nic

On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher <liamk@numenet.com
mailto:liamk@numenet.com> wrote:

Hi --

I'm using the application_nginx cookbook which includes the nginx
cookbook.
In my wrapper cookbook I have

cookbooks/bti_api/attributes/default.rb:
override[:nginx][:default_site_enabled] = false

However, the NGINX default site is still enabled!  At the bottom
of the
nginx.conf file is
>   include /etc/nginx/conf.d/*.conf;
>   include /etc/nginx/sites-enabled/*;
> }
And conf.d/default.conf exists.

So, it seems that default_site_enabled is being ignored.  Is this not
the way to turn off the default_site?


Possibly relevant info:
I'm using the nginx::repo recipe

The run_list:
> INFO: Loading cookbooks [application, application_nginx,
> application_python, apt, aws, bti_api, build-essential,
chef_handler,
> erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,
> supervisor, windows, yum]





The

--
Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#4

service[nginx] is provided by a different recipe, not nginx::repo. You
probably need nginx::server or nginx::default.

Cheers,

AJ

On 13 June 2013 05:38, Liam Kirsher liamk@numenet.com wrote:

Nic,

Thanks for your response.

I tried that but it didn’t work. When I included it in my recipe the
converge threw an exception

include_recipe “nginx::repo”

nginx_site “default” do
enable false
end

[2013-06-12T17:32:36+00:00] FATAL: Chef::Exceptions::ResourceNotFound:
resource execute[nxdissite default] is configured to notify resource
service[nginx] with action reload, but service[nginx] cannot be found in the
resource collection. execute[nxdissite default] is defined in
/srv/chef/file_store/cookbooks/nginx/definitions/nginx_site.rb:32:in `block
in from_file’

Am I not referencing it correctly?

I looked in the nginx_site definition, and that only seems to deal with the
ubuntu style of linking sites in the sites-enabled directory – so this may
be a moot point anyway.
In this case (I think because it comes from the repo) nginx.conf also is
including conf.d/*.conf. That directory includes a default.conf which is
also listening on the same interface and port, so that creates a conflict.

The default template nginx.conf.erb ends with:
include <%= node[‘nginx’][‘dir’] %>/conf.d/.conf;
include <%= node[‘nginx’][‘dir’] %>/sites-enabled/
;

It seems like the two host configuration schemes are colliding. (Or,
perhaps, conf.d could be used for other type of configuration includes. But
in this case, it has a default site defined.)

I kinda think this is a bug in the template, but it may be correct for other
versions of nginx (it’s getting 1.4.1 from the repo).

In any case, thanks for the suggestion.

Liam

On 06/12/2013 08:04 AM, Nic Grayson wrote:

The upstream nginx cookbook enables the default site. I just call the
nginx_site definition on default to disable it.

nginx_site “default” do
enable false
end

Nic

On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher liamk@numenet.com wrote:

Hi –

I’m using the application_nginx cookbook which includes the nginx
cookbook.
In my wrapper cookbook I have

cookbooks/bti_api/attributes/default.rb:
override[:nginx][:default_site_enabled] = false

However, the NGINX default site is still enabled! At the bottom of the
nginx.conf file is

include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
;
}
And conf.d/default.conf exists.

So, it seems that default_site_enabled is being ignored. Is this not
the way to turn off the default_site?

Possibly relevant info:
I’m using the nginx::repo recipe

The run_list:

INFO: Loading cookbooks [application, application_nginx,
application_python, apt, aws, bti_api, build-essential, chef_handler,
erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,
supervisor, windows, yum]

The


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#5

The docs say:

  • default.rb: /Use this recipe/ if you have a native package for Nginx.
  • repo.rb: The developer of Nginx also maintain stable packages
    http://nginx.org/en/download.html for several platforms.
  • source.rb: /Use this recipe/ if you do not have a native package
    for Nginx, or if you want to install a newer version than is
    available, or if you have custom module compilation needs.

nginx::default failed on the box I was using, opscode-ubuntu-1204, so I
used repo.

Don’t know if it’s related, but I’m also using application_nginx, which
creates an entry in sites-enabled:
.conf

On 06/12/2013 02:36 PM, AJ Christensen wrote:

service[nginx] is provided by a different recipe, not nginx::repo. You
probably need nginx::server or nginx::default.

Cheers,

AJ

On 13 June 2013 05:38, Liam Kirsher liamk@numenet.com wrote:

Nic,

Thanks for your response.

I tried that but it didn’t work. When I included it in my recipe the
converge threw an exception

include_recipe “nginx::repo”

nginx_site “default” do
enable false
end

[2013-06-12T17:32:36+00:00] FATAL: Chef::Exceptions::ResourceNotFound:
resource execute[nxdissite default] is configured to notify resource
service[nginx] with action reload, but service[nginx] cannot be found in the
resource collection. execute[nxdissite default] is defined in
/srv/chef/file_store/cookbooks/nginx/definitions/nginx_site.rb:32:in `block
in from_file’

Am I not referencing it correctly?

I looked in the nginx_site definition, and that only seems to deal with the
ubuntu style of linking sites in the sites-enabled directory – so this may
be a moot point anyway.
In this case (I think because it comes from the repo) nginx.conf also is
including conf.d/*.conf. That directory includes a default.conf which is
also listening on the same interface and port, so that creates a conflict.

The default template nginx.conf.erb ends with:
include <%= node[‘nginx’][‘dir’] %>/conf.d/.conf;
include <%= node[‘nginx’][‘dir’] %>/sites-enabled/
;

It seems like the two host configuration schemes are colliding. (Or,
perhaps, conf.d could be used for other type of configuration includes. But
in this case, it has a default site defined.)

I kinda think this is a bug in the template, but it may be correct for other
versions of nginx (it’s getting 1.4.1 from the repo).

In any case, thanks for the suggestion.

Liam

On 06/12/2013 08:04 AM, Nic Grayson wrote:

The upstream nginx cookbook enables the default site. I just call the
nginx_site definition on default to disable it.

nginx_site “default” do
enable false
end

Nic

On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher liamk@numenet.com wrote:

Hi –

I’m using the application_nginx cookbook which includes the nginx
cookbook.
In my wrapper cookbook I have

cookbooks/bti_api/attributes/default.rb:
override[:nginx][:default_site_enabled] = false

However, the NGINX default site is still enabled! At the bottom of the
nginx.conf file is

include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
;
}
And conf.d/default.conf exists.

So, it seems that default_site_enabled is being ignored. Is this not
the way to turn off the default_site?

Possibly relevant info:
I’m using the nginx::repo recipe

The run_list:

INFO: Loading cookbooks [application, application_nginx,
application_python, apt, aws, bti_api, build-essential, chef_handler,
erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,
supervisor, windows, yum]

The


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


#6

It sure looks to me like ::default is meant to be used and attributes
make the switch.

Set the attributes and show the logs from your converge, and the stack-trace.

Cheers,

AJ

On 13 June 2013 11:52, Liam Kirsher liamk@numenet.com wrote:

The docs say:

default.rb: Use this recipe if you have a native package for Nginx.
repo.rb: The developer of Nginx also maintain stable packages for several
platforms.
source.rb: Use this recipe if you do not have a native package for Nginx, or
if you want to install a newer version than is available, or if you have
custom module compilation needs.

nginx::default failed on the box I was using, opscode-ubuntu-1204, so I used
repo.

Don’t know if it’s related, but I’m also using application_nginx, which
creates an entry in sites-enabled:
.conf

On 06/12/2013 02:36 PM, AJ Christensen wrote:

service[nginx] is provided by a different recipe, not nginx::repo. You
probably need nginx::server or nginx::default.

Cheers,

AJ

On 13 June 2013 05:38, Liam Kirsher liamk@numenet.com wrote:

Nic,

Thanks for your response.

I tried that but it didn’t work. When I included it in my recipe the
converge threw an exception

include_recipe “nginx::repo”

nginx_site “default” do
enable false
end

[2013-06-12T17:32:36+00:00] FATAL: Chef::Exceptions::ResourceNotFound:
resource execute[nxdissite default] is configured to notify resource
service[nginx] with action reload, but service[nginx] cannot be found in the
resource collection. execute[nxdissite default] is defined in
/srv/chef/file_store/cookbooks/nginx/definitions/nginx_site.rb:32:in `block
in from_file’

Am I not referencing it correctly?

I looked in the nginx_site definition, and that only seems to deal with the
ubuntu style of linking sites in the sites-enabled directory – so this may
be a moot point anyway.
In this case (I think because it comes from the repo) nginx.conf also is
including conf.d/*.conf. That directory includes a default.conf which is
also listening on the same interface and port, so that creates a conflict.

The default template nginx.conf.erb ends with:
include <%= node[‘nginx’][‘dir’] %>/conf.d/.conf;
include <%= node[‘nginx’][‘dir’] %>/sites-enabled/
;

It seems like the two host configuration schemes are colliding. (Or,
perhaps, conf.d could be used for other type of configuration includes. But
in this case, it has a default site defined.)

I kinda think this is a bug in the template, but it may be correct for other
versions of nginx (it’s getting 1.4.1 from the repo).

In any case, thanks for the suggestion.

Liam

On 06/12/2013 08:04 AM, Nic Grayson wrote:

The upstream nginx cookbook enables the default site. I just call the
nginx_site definition on default to disable it.

nginx_site “default” do
enable false
end

Nic

On Tue, Jun 11, 2013 at 4:52 PM, Liam Kirsher liamk@numenet.com wrote:

Hi –

I’m using the application_nginx cookbook which includes the nginx
cookbook.
In my wrapper cookbook I have

cookbooks/bti_api/attributes/default.rb:
override[:nginx][:default_site_enabled] = false

However, the NGINX default site is still enabled! At the bottom of the
nginx.conf file is

include /etc/nginx/conf.d/.conf;
include /etc/nginx/sites-enabled/
;
}

And conf.d/default.conf exists.

So, it seems that default_site_enabled is being ignored. Is this not
the way to turn off the default_site?

Possibly relevant info:
I’m using the nginx::repo recipe

The run_list:

INFO: Loading cookbooks [application, application_nginx,
application_python, apt, aws, bti_api, build-essential, chef_handler,
erlang, gunicorn, mercurial, nginx, ohai, python, rabbitmq, runit,
supervisor, windows, yum]

The


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/


Liam Kirsher
PGP: http://liam.numenet.com/pgp/