如何配置Berks API服务器? [英] How do I configure a berks API server?

查看:75
本文介绍了如何配置Berks API服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的基础设施中实现Berks API,该基础设施包括Jenkins,一个Git服务器和一个Chef 12 Enterprise服务器.按照Berkshelf的方式,每本食谱都在Git服务器的自己存储库中.基本上,我只希望我的顶级Berksfile只包含角色食谱,然后让" Berkshelf从我的Git服务器中获取传递依赖项.

I want to implement the Berks API in my infrastructure, comprise of Jenkins, a Git server, and a Chef 12 Enterprise server. Each cookbook is in it's own repo in the Git server, per the Berkshelf way. Basically, I just want my top level Berksfile to contain ONLY role cookbooks, and then "let" Berkshelf pull the transitive dependencies from my Git server.

我已经阅读了 Berks API自述文件,但是在"我要安装食谱吗?我可以在我的Git服务器上安装它吗?我已经读过Chef服务器已经准备好使用Berks API,但是我没有从那里拉我的菜谱,而是在这里上传"它们.

I've read the Berks API README for the server installation, but "where" do I install the cookbook? Do I install it on my Git server? I've read the the Chef server is Berks API ready, but I'm NOT pulling my cookbooks from there, I'm "uploading" them there.

请帮助我造成困惑.

更新2

我能够通过将Berksfile中的源行从https更改为http来修复SSL错误,即

I was able to fix my SSL errors by changing the source line in my Berksfile from https to http, that is

source "http://myserver.domain.com:26200"

更新

我已经通过〜/.berkshelf/api-server/config.json中的以下config.json文件配置了berks-api服务器的端点

I've configured my berks-api server's endpoints via the following config.json file in ~/.berkshelf/api-server/config.json

{
  "endpoints": [
    {
      "type": "chef_server",
       "options": {
       "url": "https://myserver.domain.com/organizations/berks-api",
       "client_name": "jenkins",
       "client_key": "/etc/berkshelf/api-server/jenkins.pem",
       "ssl_verify" : false
      }
    }
  ]
}

然后我运行berks-api,并在终端上看到前几行,所以我知道它正在运行

I then run berks-api, and see these first few lines on my terminal, so I know it's running

[2015-04-14T18:49:12.737950 #10033] INFO -- : Cache manager starting...
I, [2015-04-14T18:49:12.738207 #10033] INFO -- : Loading save from /root/.berkshelf/api-server/cerch
W, [2015-04-14T18:49:12.739368 #10033] WARN -- : Endpoints in config have changed - invalidating cache
I, [2015-04-14T18:49:12.739465 #10033] INFO -- : Cache contains 0 items
I, [2015-04-14T18:49:12.740341 #10033] INFO -- : Cache Builder starting...
I, [2015-04-14T18:49:12.846975 #10033] INFO -- : REST Gateway listening on 0.0.0.0:26200
I, [2015-04-14T18:49:12.887143 #10033] INFO -- : Processing chef_server: https://myserver.domain.com/organizations/berks-api
I, [2015-04-14T18:49:12.963418 #10033] INFO -- : Found 25 cookbooks from chef_server: https://myserver.domain.com/organizations/berks-api
I, [2015-04-14T18:49:12.964527 #10033] INFO -- : Processing metadata for 25 cookbooks with 0 remaining on chef_server: https://myserver.domain.com/organizations/berks-api

我的一本食谱中的Berksfile中有这一行

The Berksfile on one of my cookbooks has this line in it

source "https://myserver.domain.com:26200"

但是,当我在一个Chef工作站上安装一个berks时,我得到了

However, when I do a berks install on one of my Chef workstations, I get

Fetching cookbook index from https://myserver.domain.com:26200...
/opt/chef/embedded/lib/ruby/2.1.0/net/http.rb:920:in `connect': SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A (Faraday::SSLError)
from /opt/chef/embedded/lib/ruby/2.1.0/net/http.rb:920:in `block in connect'
from /opt/chef/embedded/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
from /opt/chef/embedded/lib/ruby/2.1.0/timeout.rb:101:in `call'
from /opt/chef/embedded/lib/ruby/2.1.0/timeout.rb:101:in `timeout'
from /opt/chef/embedded/lib/ruby/2.1.0/net/http.rb:920:in `connect'
from /opt/chef/embedded/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
from /opt/chef/embedded/lib/ruby/2.1.0/net/http.rb:852:in `start'
from /opt/chef/embedded/lib/ruby/2.1.0/net/http.rb:1369:in `request'
from /opt/chef/embedded/lib/ruby/2.1.0/net/http.rb:1128:in `get'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:80:in `perform_request'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:40:in `block in call'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:32:in `call'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/request/retry.rb:110:in `call'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/response.rb:8:in `call'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/faraday-0.9.1/lib/faraday/connection.rb:140:in `get'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-api-client-1.2.1/lib/berkshelf/api_client/connection.rb:62:in `universe'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.2.3/lib/berkshelf/source.rb:22:in `build_universe'
from /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/berkshelf-3.2.3/lib/berkshelf/installer.rb:21:in `block (2 levels) in build_universe'

推荐答案

我建议调查管道食谱.它展示了一种Jenkins解决方案,我认为它可以证明您不需要Berkshelf API服务器.

I would suggest investigating the pipeline cookbook. It demonstrates a Jenkins solution that I think proves you don't need a Berkshelf API server.

该菜谱创建了一个非常标准的Jenkins作业,该工作使用Berkshelf下载菜谱并上传您的角色,数据包和环境(来自您的

The cookbook creates a pretty standard Jenkins job that uses Berkshelf to download cookbooks and upload your roles, data bags and environments (from your chef repo). What makes the cookbook clever is that it will also automatically generate special cookbook jobs for your cookbooks in GIT and run useful tools like foodcritic and test kitchen against them.

希望它对您有用.

Berkshelf API是索引器.如果确定要使用它,则需要设置一个额外的Chef服务器/组织来保存食谱,并在Berkshelf API配置中对其进行配置.然后,您的Jenkins构建服务器会将食谱更改加载到该Chef服务器中,以使其充当已发布"食谱的二进制存储库.

Berkshelf API is an indexer. If you're determined to use it then you'll need to setup an additional Chef server/organisation to hold the cookbooks and configure this in the Berkshelf API configuration. Your Jenkins build server will then load cookbook changes into this Chef server, so that it acts like a binary repository for your "released" cookbooks.

Berkshelf客户端能够从API服务器检索每个食谱的位置,但是仍然负责实际下载.对我来说,这是一个陷阱".对我的菜谱加载过程的暗示是,我需要两个配置文件:

A Berkshelf client is able to retrieve from the API server the location of each cookbook, but is still responsible for the actual download. For me this was a "gotcha". The implication for my cookbook loading process was that I needed two configuration files:

berks install -c ~/.berkshelf/config-cookbooks.json
berks upload 

默认的berkshelf配置文件指向我的目标厨师服务器,但是我需要第二个配置文件,其中包含保存我的食谱的厨师服务器的凭据.

The default berkshelf configuration file points at my target chef server, but I need a second configuration file with the credentials for the chef server holding my cookbooks.

更复杂的设置(可以避免上面的证书问题)是将Chef服务器替换为Chef超市的本地实例.

A more complex setup (which might avoid the credential issue above) would be swapping chef server for a local instance of Chef supermarket.

https://github.com/opscode-cookbooks/super

总而言之,我认为这不是您真正想要的.它类似于我个人使用的工作流程,但是大多数人认为它太复杂了.

In conclusion, I didn't think this was what you really wanted. It's similar to the work-flow I personally use, but most would consider it far too complex.

这篇关于如何配置Berks API服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆