sous-chefs/nginx

could not find recipe...

iwan opened this issue · 7 comments

iwan commented

Hi folks, i'm new to Chef so be patient with me...

I'm trying to install an nginx server to a VPS putting

recipe[nginx::default]

in my run_list but i get always an error:

Installing Cookbook Gems:
Compiling Cookbooks...
134.209.247.87
================================================================================
Recipe Compile Error
================================================================================
134.209.247.87
Chef::Exceptions::RecipeNotFound
--------------------------------
could not find recipe default for cookbook nginx
134.209.247.87
System Info:
------------
chef_version=15.2.20
platform=ubuntu
platform_version=18.04
ruby=ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
program_name=/usr/bin/chef-client
executable=/opt/chef/bin/chef-client
134.209.247.87
134.209.247.87
Running handlers:
[2019-09-03T15:27:21+00:00] ERROR: Running exception handlers
Running handlers complete
[2019-09-03T15:27:21+00:00] ERROR: Exception handlers complete
Chef Infra Client failed. 0 resources updated in 03 seconds
[2019-09-03T15:27:21+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2019-09-03T15:27:21+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2019-09-03T15:27:21+00:00] FATAL: Chef::Exceptions::RecipeNotFound: could not find recipe default for cookbook nginx

I googled in vain, and i have no idea how to simply install nginx on the machine, even if is so basic to install it using apt install nginx...

Thank you in advance,
iwan

There is no longer a default recipe for this cookbook. You need to write your own wrapper recipe/cookbook that uses this cookbook's resouces (nginx_install, nginx_site and nginx_config).

in your recipe try:

nginx_install 'repo' do
    default_site_enabled true
end

None of the documentation reflects how to do that, the default recipe is still mentioned at the beginning of the readme.

If you go to the install docs they show nginx_install 'default' do which also does not work.

Writing a wrapper cookbook doesn't seem to help. Doing an include_recipe 'nginx' throws an error and it's not clear what you are supposed to include instead.

@mlh758

What does your wrapper recipe look like?

Berksfile:
cookbook 'nginx', '~> 10.0'
Metadata:
depends 'nginx'
Recipe:
include_recipe 'nginx' <-- this is almost certainly my problem but I have no idea what to put here but this is what the chef blog seems to indicate would appear in a wrapper cookbook and it's what I've been doing for other stuff

nginx_install 'repo' do
  group 'apache'
  default_site_enabled false
end

For the time being I've downgraded to nginx cookbook 9 since the documentation seems to reflect that version still.

yeah it does look like the docs need updating. There's a reference still to the default recipe (there areno recipes in this cookbook).

There's no need to include_recipe 'nginx' . Just having the depends 'nginx' means you'll have access to the nginx_install resource. That should just work.

Note that you'll also have to add your own service resource block to your recipe if you're using 10.0.1 or older.
#505

Yeah dropping the include_recipe fixed my issue.

@zmaupin thank you for the heads up.