如何使用Berkshelf管理组织回购? [英] How to use Berkshelf to manage Organization repo?
问题描述
我是Berkshelf的忠实拥护者,并且我已经发布了一些使用它的书以及很棒的社区食谱。
现在,我正在启动一个新的厨师项目。并且我也继续使用Berkshelf。
但是我发现在项目中使用它存在一些困惑/困难。
以下是Berksfile中的文件:
site:opscode
cookbook'mediawiki' ,github:'millisami / chef-mediawiki'
cookbook'sp-mediawiki',路径:'site-cookbooks / sp-mediawiki'
我已经在 site-cookbooks
文件夹内生成了应用程序食谱。
当我进行批量安装
时,它会出错:
读取Berksfile时发生错误:在\
/ Users / millisami / Code / chef-sp / site-cookbooks / sp-mediawiki
$ c中找不到metadata.rb或metadata.json $ c>
现在我想知道在哪里生成我的应用程序 sp-mediawiki
co okbook?
如果只创建一个新的
使用我在另一个项目中使用的 librarian-chef
可以完美地完成这种流程。
所以,我想写一行:
- Berkshelf很好开发个人食谱
- 图书管理员可以很好地管理顶级业务流程
我对/错吗?
正如我在GitHub上的回复中所述:
>
如果您的厨师仓库
Berksfile >,您可以让Berkshelf为您管理所有菜谱依赖项。
例如,假设我正在编写依赖apache2菜谱的应用程序菜谱。我将添加到我的 Berksfile
:
site:opscode
食谱'apache2','〜> xxx'#可选版本约束
并运行 berks安装
命令来安装此食谱。因为它是一个库,所以它安装在您的计算机上,因此您不必费心查找它。现在,您生成了应用程序食谱(我们将其称为 my-apache2
):
$ berks食谱my-apache2
这将为您创建骨架。然后,您可以在 metadata.rb
:
apache2
作为对此新食谱的依赖项。 $ b
name'my-apache2'
#禁止显示
版本'1.0.0'
取决于' apache2'
您的目录结构如下:
厨师回购
| Berksfile
| _食谱
| _ my-apache2
注意 apache
食谱不存在。图书馆的食谱都位于〜/ .berkshelf / cookbooks
中,但是您不必为此担心。它们会自动插入并添加到您的路径中。
如果另一个队友想要使用您的厨师仓库,只需让它们运行 berks安装
,所有必需的依赖项也将安装在他们的计算机上。
当您运行 berks upload之类的命令时
,Berkshelf将自动为您查找并解决所有必要的食谱。
这有意义吗?
I'm a huge fan of Berkshelf and I've released few community cookbooks using it and its awesome.
Now, I'm starting a new chef project and I went ahead with Berkshelf for this too.
But I'm finding some confusions/difficulties using it for the project.
Following is in the Berksfile:
site :opscode
cookbook 'mediawiki', github: 'millisami/chef-mediawiki'
cookbook 'sp-mediawiki', path: 'site-cookbooks/sp-mediawiki'
I've generated my application cookbook inside the site-cookbooks
folder.
When I do berks install
, it errors out:
An error occurred while reading the Berksfile: no metadata.rb or metadata.json found at \
/Users/millisami/Code/chef-sp/site-cookbooks/sp-mediawiki
Now I'm wondering where do I generate my application sp-mediawiki
cookbook?
If just create a new one berks cookbook sp-mediawiki
, it will be similar to the library cookbook.
This sort of flow is perfectly done using librarian-chef
which I am using on another project.
So, I'm trying to put a line that:
- Berkshelf is good to develop individual cookbooks
- Librarian-chef is good to manage the top-level orchestration
Am I right/wrong? How you folks use Berkshelf to manage your Org's chef-repo?
As I said in my response on GitHub:
If you have a Berksfile
at the top of your chef-repo
, you can you Berkshelf to manage all your cookbook dependencies for you.
For example, let's say I'm writing an application cookbook that depends on the apache2 cookbook. I would add to my Berksfile
:
site :opscode
cookbook 'apache2', '~> x.x.x' # optional version constraint
And run the berks install
command to install this cookbook. Because it's a library, it's installed on your machine "somewhere" and you shouldn't bother finding it. Now, you generate your application-cookbook (let's call it my-apache2
):
$ berks cookbook my-apache2
And this will create the skeleton for you. Then you can add apache2
as a dependency on this new cookbook in the metadata.rb
:
name 'my-apache2'
# suppressed
version '1.0.0'
depends 'apache2'
And your directory structure looks like:
chef-repo
| Berksfile
|_ cookbooks
|_ my-apache2
Notice the apache
cookbook is not there. The library cookbooks all live in ~/.berkshelf/cookbooks
, but you shouldn't worry about that. They are automatically pulled in and added to your path for you.
If another teammate wants to use your chef-repo, simply have them run berks install
and all the necessary dependencies will be installed on their machine as well.
When you run commands like berks upload
, Berkshelf will automatically find and resolve all the necessary cookbooks for you.
Does this make sense?
这篇关于如何使用Berkshelf管理组织回购?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!