如何使用 mysql 食谱?

How do I use the mysql cookbook?

我正在尝试使用 Chef Supermarket 中最新版本的 mysql 食谱:

https://supermarket.chef.io/cookbooks/mysql

(8.3.1)

我已将其添加为包装食谱,并创建了一个小食谱,我正试图在 Test Ktichen 中加速:

include_recipe 'mysql'

mysql_service 'foo' do
  port '3306'
  version '5.7'
  initial_root_password 'change me'
  action [:create, :start]
end

mysql_config 'logging' do
  instance 'instance-1'
  source 'my.cnf.erb'
  action :create
  notifies :restart, 'mysql_service[instance-1]'
end

这很快就无法收敛于:

could not find recipe default for cookbook mysql

依赖项 'mysql' 在食谱 metadata.rb 中。

我看到一些帖子说这本食谱已经过重大重构……但我仍然不知道如何实际使用它……

您不需要 include_recipe,只需要其他位。

一个include_recipe方法用于调用指定的配方。如果没有给出配方,例如include_recipe '<cookbook_name>',它将调用默认配方,即default.rb.

https://docs.chef.io/recipes.html#include-recipes

在您的情况下,mysql 是基本说明书,只有库和资源可用于 Wrapper 说明书。因此,您可以调用 mysql_config 之类的资源,但 include_recipe 将失败,因为该食谱中没有食谱。

https://github.com/chef-cookbooks/mysql