web_app.conf.erb Template Not Found


#1

I’m writing a cookbook to deploy a rails app. I’m using the deploy resource
then using the web_app definition to create the passenger conf file.

The client error’s out and the server log shows:
~ Preferred template list: {}
~ Searching for preferred file in
~ Looking for host-domU-12-31-39-00-31-62.compute-1.internal/web_app.conf.erb
~ Looking for centos-5.4/web_app.conf.erb
~ Looking for centos/web_app.conf.erb
~ Looking for default/web_app.conf.erb
merb : worker (port 4000) ~ Cannot find a preferred file for web_app.conf.erb!

  • (Chef::Exceptions::FileNotFound)
    /usr/lib/ruby/gems/1.8/gems/chef-0.7.14/lib/chef/mixin/find_preferred_file.rb:87:in
    `find_preferred_file’

My first thought was that since I have the standard cookbooks and my own
cookbooks in seperate repo’s this might be the root cause, but I copied the
apache and passenger cookbooks into the same repo where I have my 'local’
cookbooks but that didn’t seem to help.

Any one have any thoughts on how to fix?

Thanks,

Alex

RECIPE:

include_recipe "apache2"
include_recipe “passenger_apache2”

…snipped the deploy part

web_app node[:app_name] do
docroot "/src/apps/#{node[:app_name]}/current/public"
server_name "example.com"
rails_env "production"
end


#2

By default, you need to put the template in the templates/default/
directory of the cookbook where you use the web_app define. You can
add a ‘cookbook’ parameter to the resource to specify another cookbook
where the template lives.

Also, take a look at the file specificity information for templates here:

http://wiki.opscode.com/display/chef/Templates#Templates-TemplateLocationSpecificity

On Wed, Dec 23, 2009 at 6:06 PM, apsoto@gmail.com wrote:

I’m writing a cookbook to deploy a rails app. I’m using the deploy resource
then using the web_app definition to create the passenger conf file.

The client error’s out and the server log shows:
~ Preferred template list: {}
~ Searching for preferred file in
~ Looking for host-domU-12-31-39-00-31-62.compute-1.internal/web_app.conf.erb
~ Looking for centos-5.4/web_app.conf.erb
~ Looking for centos/web_app.conf.erb
~ Looking for default/web_app.conf.erb
merb : worker (port 4000) ~ Cannot find a preferred file for web_app.conf.erb!

  • (Chef::Exceptions::FileNotFound)
    /usr/lib/ruby/gems/1.8/gems/chef-0.7.14/lib/chef/mixin/find_preferred_file.rb:87:in
    `find_preferred_file’

My first thought was that since I have the standard cookbooks and my own
cookbooks in seperate repo’s this might be the root cause, but I copied the
apache and passenger cookbooks into the same repo where I have my 'local’
cookbooks but that didn’t seem to help.

Any one have any thoughts on how to fix?

Thanks,

Alex

RECIPE:

include_recipe "apache2"
include_recipe “passenger_apache2”

…snipped the deploy part

web_app node[:app_name] do
docroot "/src/apps/#{node[:app_name]}/current/public"
server_name "example.com"
rails_env "production"
end


Opscode, Inc
Joshua Timberman, Senior Solutions Engineer
C: 720.878.4322 E: joshua@opscode.com