原文:http://docs.cloudfoundry.com/docs/running/bosh/
BOSH用于发布,部署,及大规模分布式服务对象的生命周期管理,它可用于部署CF,也可以将其它分布式服务(?PaaS)部署到IaaS(VMware vSphere,vCloud Director,Amazon Web Services EC2,OpenStack)上。
下面针对它的架构,拓扑结构,配置及使用,以及部署过程中的结构与约定。
BOSH Components(BOSH的组成部分)
Director
The Director is the core orchestrating(协调) component in BOSH.
It controls creation of VMs, deployment, and other life cycle events of software and services.
Command and control is handed over to the the Director-Agent interaction after the CPI(CF提供的操作IaaS的接口 ) has created resources.
--管理VM的创建与服务的生命周期,它通过Director-Agent执行这些命令。
下面展示具体工作的负责子模块,它们被一个叫做ApiController的实例引用着。
Deployment Manager
Responsible for creating, updating, and deleting the deployments that are specified in the deployment file. Endpoints and Http Method type exposed by the director that are used to access the Deployment Manager are described below.(下面是提供的REST接入点)
URL | HTTP METHOD TYPE | DESCRIPTION |
/deployments | POST | |
/deployments/:deployment/jobs/:job | PUT | Change the state of a job in a deployment based on the parameter |
/deployments/:deployment/jobs/:job/:index/logs | GET | Get logs of a particular job in a deployment |
/deployments/:name | DELETE | Delete a deployment |
Instance Manager
Instance Manager helps manage VM instances that are created using Bosh deployments.
It helps connect to the VM instance through an Agent Client using ssh, finds an instance, and fetches the log from a particular instance.
The figure below describes the flow when a user tries to SSH into a VM using Bosh CLI.
--(这里的实例是VM实例),实例管理子模块负责管理VM的实例,使用ssh连接VM所在机器上的Agent Client,进而可查找实例,或者获取实例的日志。
下面展示SSH到VM的示意图。
Problem Manager
This component helps scan a deployment for problems and helps apply resolutions. It uses a model deployment_problem to keep info about the problem and has a one-to-many relationship with Deployment Model.
--部署产生的问题的管理模块,对象多个部署模型。
Property Manager
Properties are attributes specified for jobs in the deployment file. The Property Manager allows you to find properties associated with a deployment and update a particular property for a deployment. It references the Deployment Manager.
--从部署文件中抽取出的一些属性值,用于jobs。也可更新指定的属性,这个子模块持有对应的Deployment Manager。
Resource Manager
The Resource Manager provides access to the resources stored in the BlobStore. Some of the actions performed through a resource manager are:
- Get a Resource using an ID
- Delete a resource by giving an resource ID
- Get the resource path from an ID
--对BlobStore打交道,通常执行上面三个操作。
Release(发布) Manager
The Release Manager manages the creation and deletion of releases. Each release references a Release Manager and contains a Deployment Plan object as well as an array of templates.
--管理发布的创建与删除,它包含一份部署计划,以及一系列的模板文件。
The Director routes the request coming at the following endpoints to the release manager for managing the release lifecycle.
--下面是REST 接入URI
URL | HTTP METHOD TYPE | RESPONSE BODY | DESCRIPTION |
/releases | GET | {“name” => release.name,“versions” => versions, “in_use” => versions_in_use} | Get the list of all releases uploaded |
/releases | POST | Create a release for the user specified. |
Lifecycle of a Release
The figure below shows the interaction between various components of a Director when a release is created/ updated or deleted.
--下图展示当创建/更新/删除一个发布时,多个子模块的交互示意
Stemcell(干细胞) Manager
The Stemcell Manager manages the Stem cells. It is responsible for creating, deleting, or finding a stemcell.
下图展示它的工作示意
REST API
URL | HTTP METHOD TYPE | RESPONSE BODY | DESCRIPTION |
/stemcells | GET | { “name” => stemcell.name, “version” => stemcell.version, “cid” => stemcell.cid} | Json specifying the stemcell name, version and cid of the stem cell. |
/stemcells | POST | Stemcell binary file | |
/stemcells | DELETE | Delete the specified stemcell |
Task Manager
The Task Manager is responsible for managing the tasks which are created and are being run by the Job Runner.
--管理创建的任务,这些任务将会由Job Runner去完成
REST API
URL | HTTP METHOD TYPE | RESPONSE BODY | DESCRIPTION |
/tasks | GET | Get all the tasks being executed of type"update_deployment", “delete_deployment”, “update_release”,“delete_release”, “update_stemcell”, “delete_stemcell” | |
/tasks/:id | GET | Send back output for a task with the given id | |
/tasks/:id/output | GET | Sends back output of given task id and params[:type] | |
/task/:id | DELETE | Delete the task specified by a particular Id |