Chef-server::apache-proxy

Folks,
Doing something a wee bit unorthodox, but it should work(in my world) and it doesn’t. Probably my poor understanding, so appreciate if someone could point out the error of my ways…

I have already installed chef-server via apt-get from the opscode-chef repos, for ubuntu on 10.10. All seems well and it works. Have been deploying in a test environment for a few months…

Next I wanted to install apache on the chef-server, and setup some kind of proxy so I could connect to the chef server via ssl on port 443. There is some good documentation on how to do this manually on the opscode wiki, but I searched around and found essentially what looks like the same thing that has been automated as part of the chef-server recipe. So, I made up a role, and added the run list “chef-server::apache-proxy”. Then I run this on the chef-server node, by simply assigning the role to the node. However, I get a stack trace, (repeated below).

From my initial investigations, it looks like I have a very poor understanding of just how vhosts are used in the apache2 recipe, and hence am struggling to know exaclty where to start looking for the problem. It seems to me to be a problem where I am not specifying the “hostname” of the chef-server, but I think if I had an example tutuorial on how to take the apache2 recipe, deploy it, then deploy one then two vhosts, then I think my understanding would be so much better. If anyone can help me, I would be happy to provide a tutuorial on how to do this, once I have done it(chicken/egg).

                  Anyway, thanks for any help you can offer.

                                                  Sc0tt..

NB Uploading apache2 [1.0.4]
Uploading chef-server [0.99.11]

************************Stack trace below ****************

[Wed, 04 Jan 2012 13:05:44 +0200] INFO: Processing directory[/etc/chef/certificates] action create (chef-server::apache-proxy line 41)
[Wed, 04 Jan 2012 13:05:44 +0200] INFO: Processing bash[Create SSL Certificates] action run (chef-server::apache-proxy line 47)
[Wed, 04 Jan 2012 13:05:44 +0200] INFO: Processing template[/etc/apache2/sites-available/chef-server-proxy.conf] action create (chef-server::apache-proxy line 29)
[Wed, 04 Jan 2012 13:05:44 +0200] ERROR: template[/etc/apache2/sites-available/chef-server-proxy.conf] (chef-server::apache-proxy line 29) has had an error
[Wed, 04 Jan 2012 13:05:44 +0200] ERROR: template[/etc/apache2/sites-available/chef-server-proxy.conf] (/var/cache/chef/cookbooks/apache2/definitions/web_app.rb:29:in `from_file’) had an error:

Chef::Mixin::Template::TemplateError (undefined method `each’ for nil:NilClass) on line #4:

2: <VirtualHost *:443>
3: ServerName <%= @params[‘server_name’] %>
4: ServerAlias <% @params[‘server_aliases’].each do |a| %><%= “#{a}” %> <% end %>
5:
6: DocumentRoot <%= node[‘chef_server’][‘doc_root’] %>

(erubis):4:in evaluate' /usr/lib/ruby/1.8/erubis/evaluator.rb:75:ininstance_eval’
/usr/lib/ruby/1.8/erubis/evaluator.rb:75:in evaluate' /usr/lib/ruby/vendor_ruby/chef/mixin/template.rb:41:inrender_template’
/usr/lib/ruby/vendor_ruby/chef/provider/template.rb:99:in render_with_context' /usr/lib/ruby/vendor_ruby/chef/provider/template.rb:39:inaction_create’
/usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in send' /usr/lib/ruby/vendor_ruby/chef/resource.rb:437:inrun_action’
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:inconverge’
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:inconverge’
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:incall’
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:instep’
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in iterate' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index’
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/runner.rb:76:inconverge’
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:160:inrun’
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in run_application' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:inloop’
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in run_application' /usr/lib/ruby/vendor_ruby/chef/application.rb:67:inrun’
/usr/bin/chef-client:25

/usr/lib/ruby/vendor_ruby/chef/mixin/template.rb:43:in render_template' /usr/lib/ruby/vendor_ruby/chef/provider/template.rb:99:inrender_with_context’
/usr/lib/ruby/vendor_ruby/chef/provider/template.rb:39:in action_create' /usr/lib/ruby/vendor_ruby/chef/resource.rb:437:insend’
/usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:45:inrun_action’
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:ineach’
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:inexecute_each_resource’
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:incall_iterator_block’
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in step' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:initerate’
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in each_with_index' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:inexecute_each_resource’
/usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:312:inconverge’
/usr/lib/ruby/vendor_ruby/chef/client.rb:160:in run' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:inrun_application’
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in loop' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:inrun_application’
/usr/lib/ruby/vendor_ruby/chef/application.rb:67:in `run’
/usr/bin/chef-client:25
[Wed, 04 Jan 2012 13:05:44 +0200] ERROR: Running exception handlers
[Wed, 04 Jan 2012 13:05:45 +0200] FATAL: Saving node information to /var/cache/chef/failed-run-data.json
[Wed, 04 Jan 2012 13:05:45 +0200] ERROR: Exception handlers complete
[Wed, 04 Jan 2012 13:05:45 +0200] ERROR: Chef::Mixin::Template::TemplateError:

Chef::Mixin::Template::TemplateError (undefined method `each’ for nil:NilClass) on line #4:

2: <VirtualHost *:443>
3: ServerName <%= @params[‘server_name’] %>
4: ServerAlias <% @params[‘server_aliases’].each do |a| %><%= “#{a}” %> <% end %>
5:
6: DocumentRoot <%= node[‘chef_server’][‘doc_root’] %>

(erubis):4:in evaluate' /usr/lib/ruby/1.8/erubis/evaluator.rb:75:ininstance_eval’
/usr/lib/ruby/1.8/erubis/evaluator.rb:75:in evaluate' /usr/lib/ruby/vendor_ruby/chef/mixin/template.rb:41:inrender_template’
/usr/lib/ruby/vendor_ruby/chef/provider/template.rb:99:in render_with_context' /usr/lib/ruby/vendor_ruby/chef/provider/template.rb:39:inaction_create’
/usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in send' /usr/lib/ruby/vendor_ruby/chef/resource.rb:437:inrun_action’
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:inconverge’
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:inconverge’
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:incall’
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:instep’
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in iterate' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index’
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/runner.rb:76:inconverge’
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:160:inrun’
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in run_application' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:inloop’
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in run_application' /usr/lib/ruby/vendor_ruby/chef/application.rb:67:inrun’
/usr/bin/chef-client:25

The issue seems to be with your erb template syntax, not a Apache
configuration parsing issue with your vhosts configuration.
On Jan 4, 2012 4:17 AM, "RUSSELL Scott" Scott.RUSSELL@echa.europa.eu
wrote:

Folks,
Doing something a wee bit unorthodox, but it should work(in my
world) and it doesn't. Probably my poor understanding, so appreciate if
someone could point out the error of my ways...

I have already installed chef-server via apt-get from the opscode-chef
repos, for ubuntu on 10.10. All seems well and it works. Have been
deploying in a test environment for a few months...

Next I wanted to install apache on the chef-server, and setup some kind of
proxy so I could connect to the chef server via ssl on port 443. There is
some good documentation on how to do this manually on the opscode wiki, but
I searched around and found essentially what looks like the same thing that
has been automated as part of the chef-server recipe. So, I made up a
role, and added the run list "chef-server::apache-proxy". Then I run this
on the chef-server node, by simply assigning the role to the node.
However, I get a stack trace, (repeated below).

From my initial investigations, it looks like I have a very poor
understanding of just how vhosts are used in the apache2 recipe, and hence
am struggling to know exaclty where to start looking for the problem. It
seems to me to be a problem where I am not specifying the "hostname" of the
chef-server, but I think if I had an example tutuorial on how to take the
apache2 recipe, deploy it, then deploy one then two vhosts, then I think my
understanding would be so much better. If anyone can help me, I would be
happy to provide a tutuorial on how to do this, once I have done
it(chicken/egg).

                 Anyway, thanks for any help you can offer.

                                                 Sc0tt..

NB Uploading apache2 [1.0.4]
Uploading chef-server [0.99.11]

************************Stack trace below ****************

[Wed, 04 Jan 2012 13:05:44 +0200] INFO: Processing
directory[/etc/chef/certificates] action create (chef-server::apache-proxy
line 41)
[Wed, 04 Jan 2012 13:05:44 +0200] INFO: Processing bash[Create SSL
Certificates] action run (chef-server::apache-proxy line 47)
[Wed, 04 Jan 2012 13:05:44 +0200] INFO: Processing
template[/etc/apache2/sites-available/chef-server-proxy.conf] action create
(chef-server::apache-proxy line 29)
[Wed, 04 Jan 2012 13:05:44 +0200] ERROR:
template[/etc/apache2/sites-available/chef-server-proxy.conf]
(chef-server::apache-proxy line 29) has had an error
[Wed, 04 Jan 2012 13:05:44 +0200] ERROR:
template[/etc/apache2/sites-available/chef-server-proxy.conf]
(/var/cache/chef/cookbooks/apache2/definitions/web_app.rb:29:in
`from_file') had an error:

Chef::Mixin::Template::TemplateError (undefined method `each' for
nil:NilClass) on line #4:

2: <VirtualHost *:443>
3: ServerName <%= @params['server_name'] %>
4: ServerAlias <% @params['server_aliases'].each do |a| %><%= "#{a}" %>
<% end %>
5:
6: DocumentRoot <%= node['chef_server']['doc_root'] %>

(erubis):4:in evaluate' /usr/lib/ruby/1.8/erubis/evaluator.rb:75:in instance_eval'
/usr/lib/ruby/1.8/erubis/evaluator.rb:75:in evaluate' /usr/lib/ruby/vendor_ruby/chef/mixin/template.rb:41:in render_template'
/usr/lib/ruby/vendor_ruby/chef/provider/template.rb:99:in
render_with_context' /usr/lib/ruby/vendor_ruby/chef/provider/template.rb:39:in action_create'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in send' /usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in
execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in step'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in
iterate' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in each_with_index'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in
execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:160:in run'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in
run_application' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in loop'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in
run_application' /usr/lib/ruby/vendor_ruby/chef/application.rb:67:in run'
/usr/bin/chef-client:25

/usr/lib/ruby/vendor_ruby/chef/mixin/template.rb:43:in render_template' /usr/lib/ruby/vendor_ruby/chef/provider/template.rb:99:in render_with_context'
/usr/lib/ruby/vendor_ruby/chef/provider/template.rb:39:in action_create' /usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in send'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
call' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call_iterator_block'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in
step' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in iterate'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in
each_with_index' /usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in execute_each_resource'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:160:in run' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in run_application'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in loop' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in run_application'
/usr/lib/ruby/vendor_ruby/chef/application.rb:67:in `run'
/usr/bin/chef-client:25
[Wed, 04 Jan 2012 13:05:44 +0200] ERROR: Running exception handlers
[Wed, 04 Jan 2012 13:05:45 +0200] FATAL: Saving node information to
/var/cache/chef/failed-run-data.json
[Wed, 04 Jan 2012 13:05:45 +0200] ERROR: Exception handlers complete
[Wed, 04 Jan 2012 13:05:45 +0200] ERROR:
Chef::Mixin::Template::TemplateError:

Chef::Mixin::Template::TemplateError (undefined method `each' for
nil:NilClass) on line #4:

2: <VirtualHost *:443>
3: ServerName <%= @params['server_name'] %>
4: ServerAlias <% @params['server_aliases'].each do |a| %><%= "#{a}" %>
<% end %>
5:
6: DocumentRoot <%= node['chef_server']['doc_root'] %>

(erubis):4:in evaluate' /usr/lib/ruby/1.8/erubis/evaluator.rb:75:in instance_eval'
/usr/lib/ruby/1.8/erubis/evaluator.rb:75:in evaluate' /usr/lib/ruby/vendor_ruby/chef/mixin/template.rb:41:in render_template'
/usr/lib/ruby/vendor_ruby/chef/provider/template.rb:99:in
render_with_context' /usr/lib/ruby/vendor_ruby/chef/provider/template.rb:39:in action_create'
/usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in send' /usr/lib/ruby/vendor_ruby/chef/resource.rb:437:in run_action'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:45:in run_action' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in each' /usr/lib/ruby/vendor_ruby/chef/runner.rb:81:in converge'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:94:in
execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in call'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:85:in step'
/usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:104:in
iterate' /usr/lib/ruby/vendor_ruby/chef/resource_collection/stepable_iterator.rb:55:in each_with_index'
/usr/lib/ruby/vendor_ruby/chef/resource_collection.rb:92:in
execute_each_resource' /usr/lib/ruby/vendor_ruby/chef/runner.rb:76:in converge'
/usr/lib/ruby/vendor_ruby/chef/client.rb:312:in converge' /usr/lib/ruby/vendor_ruby/chef/client.rb:160:in run'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:239:in
run_application' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in loop'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:229:in
run_application' /usr/lib/ruby/vendor_ruby/chef/application.rb:67:in run'
/usr/bin/chef-client:25

On Wed, Jan 4, 2012 at 1:17 PM, RUSSELL Scott
Scott.RUSSELL@echa.europa.euwrote:

From my initial investigations, it looks like I have a very poor
understanding of just how vhosts are used in the apache2 recipe, and hence
am struggling to know exaclty where to start looking for the problem. It
seems to me to be a problem where I am not specifying the "hostname" of the
chef-server, but I think if I had an example tutuorial on how to take the
apache2 recipe, deploy it, then deploy one then two vhosts, then I think my
understanding would be so much better. If anyone can help me, I would be
happy to provide a tutuorial on how to do this, once I have done
it(chicken/egg).

The backtrace points you to line 4, and specifically #each being called on
nil:

4: ServerAlias <% @params['server_aliases'].each do |a| %><%= "#{a}" %>
<% end %>

So it's server_aliases which is not defined correctly, not the server name.

Look at the apache-proxy recipe; with the latest version, it ends with:

web_app "chef-server-proxy" do
template "chef_server.conf.erb"
server_name "localhost"
server_aliases [ node['hostname'], node['fqdn'], 'chef-server-proxy',
"chef.#{node['domain']}" ]
log_dir node['apache']['log_dir']
end

You probably have something different?

Andrea

I ran into this too when first moving to the chef-server cookbook and
never got around to documenting it with a JIRA (sorry).

Changing the quoted hash keys for @params to symbols will fix the
problem for you. So from:
@params['server_aliases']
to:
@params[:server_aliases]).

Also, just found this: http://tickets.opscode.com/browse/COOK-541
which outlines a few other problems with that particular template
though a new cookbook has yet to be cut with the changes

On Wed, Jan 4, 2012 at 10:28 AM, Andrea Campi
andrea.campi@zephirworks.com wrote:

On Wed, Jan 4, 2012 at 1:17 PM, RUSSELL Scott Scott.RUSSELL@echa.europa.eu
wrote:

From my initial investigations, it looks like I have a very poor
understanding of just how vhosts are used in the apache2 recipe, and hence
am struggling to know exaclty where to start looking for the problem. It
seems to me to be a problem where I am not specifying the "hostname" of the
chef-server, but I think if I had an example tutuorial on how to take the
apache2 recipe, deploy it, then deploy one then two vhosts, then I think my
understanding would be so much better. If anyone can help me, I would be
happy to provide a tutuorial on how to do this, once I have done
it(chicken/egg).

The backtrace points you to line 4, and specifically #each being called on
nil:

4: ServerAlias <% @params['server_aliases'].each do |a| %><%= "#{a}" %>
<% end %>

So it's server_aliases which is not defined correctly, not the server name.

Look at the apache-proxy recipe; with the latest version, it ends with:

web_app "chef-server-proxy" do
template "chef_server.conf.erb"
server_name "localhost"
server_aliases [ node['hostname'], node['fqdn'], 'chef-server-proxy',
"chef.#{node['domain']}" ]
log_dir node['apache']['log_dir']
end

You probably have something different?

Andrea

Hi,
Michael, thanks so much for the response. You were right on the money. I had looked through the code for the "server_aliases" but there were so many that I did not do a thorough evaluation of each and every line. I made the change you suggested and then found another issue with the "port", and before changing it, I then referenced the opscode ticket you suggested(It has several changes). I then downloaded the bootstrap file (/home/echa-reach-adm/Documents/temp/cookbooks/chef-server_new/templates/default/chef_server.conf.erb) that was referenced on the ticket and copied the cookbooks/chef-server/templates/default/chef_server.conf.erb to my chef-server cookbook, deleted it on the chef server and then redeployed it to the chef server and now the API is secured via SSL. There were around 6 files changed between the current chef-server and the one in the bootstrap, but I only needed this one file. The functionality I need is working. Fantastic !

                                                 thanks to everyone who replied.  Great that you have helped me on such a minor issue, but pretty major to me.

                                                                                                  Sc0tt...

To: chef@lists.opscode.com
Subject: [chef] Re: Re: Chef-server::apache-proxy....

I ran into this too when first moving to the chef-server cookbook and
never got around to documenting it with a JIRA (sorry).

Changing the quoted hash keys for @params to symbols will fix the
problem for you. So from:
@params['server_aliases']
to:
@params[:server_aliases]).

Also, just found this: http://tickets.opscode.com/browse/COOK-541
which outlines a few other problems with that particular template
though a new cookbook has yet to be cut with the changes

On Wed, Jan 4, 2012 at 10:28 AM, Andrea Campi

On Wed, Jan 4, 2012 at 1:17 PM, RUSSELL Scott
wrote:

From my initial investigations, it looks like I have a very poor
understanding of just how vhosts are used in the apache2 recipe, and hence
am struggling to know exaclty where to start looking for the problem. It
seems to me to be a problem where I am not specifying the "hostname" of the
chef-server, but I think if I had an example tutuorial on how to take the
apache2 recipe, deploy it, then deploy one then two vhosts, then I think my
understanding would be so much better. If anyone can help me, I would be
happy to provide a tutuorial on how to do this, once I have done
it(chicken/egg).

The backtrace points you to line 4, and specifically #each being called on
nil:

4: ServerAlias <% @params['server_aliases'].each do |a| %><%= "#{a}" %>
<% end %>

So it's server_aliases which is not defined correctly, not the server name.

Look at the apache-proxy recipe; with the latest version, it ends with:

web_app "chef-server-proxy" do
template "chef_server.conf.erb"
server_name "localhost"
server_aliases [ node['hostname'], node['fqdn'], 'chef-server-proxy',
"chef.#{node['domain']}" ]
log_dir node['apache']['log_dir']
end

You probably have something different?

Andrea