如何使用 Apache Brooklyn 和 Chef 安装 Jenkins

How to Install Jenkins using Apache Brooklyn and Chef

我想使用 Chef(和 Apache Brooklyn)在 VM 上安装 Jenkins。正在使用的蓝图是,

name: chef-jenkins
location:
  jclouds:aws-ec2:
    region: xyz
services:
- type: chef:jenkins
  cookbook_urls:
    jenkins: .../jenkins.tgz
    runit:  ... /runit.tgz
    apt:     .../apt.tgz
    yum:     .../yum20150407-59421-1bw7bou.tar.gz
  launch_run_list: [ "jenkins::start" ]
  service_name: jenkinsd

service_name参数不正确。

运行 这会引发错误 "Failure running task ssh: run chef for launch (jSUGhBph): SSH task ended with exit code 1 when 0 was required, in Task[ssh: run chef for launch:jSUGhBph]: run chef for launch"

我还缺少什么?是否可以直接 运行 一个简单的厨师食谱(例如 https://gist.github.com/nstielau/978920)?

您看到的错误消息表明 Brooklyn 在云服务器上尝试 运行 的 shell 命令之一失败了 - 特别是 "run chef for launch" 命令。要找出失败的原因,请使用 Activity 选项卡:

  1. 左侧的树视图包含整个应用程序。展开这个。
  2. 这将显示构成应用程序的实体。这个蓝图只有一个,叫做jenkins (chef) - 点击这个。
  3. 单击 Activity 选项卡。这将向您显示任务列表。其中之一的状态为 失败 - 单击此按钮。
  4. 任务可以有子任务,因此您可能会看到另一个任务列表,其中一个处于状态 失败 - 继续跟踪此线索直到找到最后一个失败的任务
  5. 如果这是 SSH 任务,您将有下载链接 stdoutstderr - 您可以检查这些链接以找出 shell 命令失败的确切原因。

您还可以找到一个 section on troubleshooting in the Apache Brooklyn user guide 这可能有助于诊断其他问题。

我已经把你的设计图做了一些修改;现在正在处理我的 Ubuntu 14.04 图片:

name: chef-jenkins
location: vagrant-trusty
services:
- type: chef:jenkins
  cookbook_urls:
    jenkins: data:application/octet-stream;charset=UTF-8;base64,H4sIAC/fwVUAA+1b3W/bOBLvM/8Kwn5Qmybytw0YONxl06Dw3jYp4uzeQ68wKImWGEuklqSSeB/ub98hJTmOs63hbOy9bfmDLdHkaPgxnBE5HN9QvmBctV7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4r3vh13baY6aQITBhia85BtCK1f3E4qZr7xrfGzFZvnI3c05jxMC0iWtaTskASGwlv2JPIRLhXtXgK34hA4VtGgEUd5U54BA9xaD3YJqP31ocZU71qW5FjQ2QsCDArGzDxIIPY7gUFA6U3RBs91QnovwKjl5ds7/gxVsJGYnlGSATHQkRlNL1pZS4Y12Bzq/5Uhgk3SK4bTzJN2GMDISiDrFwopoVcQnbZ5kZppArJyn8IwcDmi/iJzGnACG8A4YIutxO2Huf68FDDWvosF9zE/uNPjYBxIpetxmcoIKGNPBuDEKzFQzkJFySmD600Dit5y0K62XCYVrmQhuNYaZEf47EdJbhLalNr/D+tyignQUo/O++xg4ODg4ODg4ODg4ODg4ODg4ODg4PD3xa/A3Nc9FMAUAAA
    apt:     https://github.com/opscode-cookbooks/apt/archive/v2.7.0.tar.gz
    java:    https://github.com/agileorbit-cookbooks/java/archive/v1.29.0.tar.gz
  launch_run_list: [ "jenkins::default" ]
  service_name: jenkins
  launch_attributes:
    java:
      jdk_version: 7

此蓝图已准备就绪-运行(更改位置以满足您的要求除外)。以下是我所做的一些更改:

  • 完整 URL 三本食谱
  • jenkins 数据 URL 包含一本简单的食谱,其中包含 recipe you referred to in a gist、tarred-and-gzipped
  • 对于 jenkins 食谱,我必须在 metadata.rb 中指定 depends "apt"depends "java" 否则我会遇到奇怪的 Chef 错误
  • 已修复 launch_run_list 以引用正确的配方名称
  • 已修复 service_name 以引用正确的服务名称
  • 添加launch_attributes配置Java cookbook以安装Java 7(Jenkins不支持默认的Java 6)