一项服务由服务描述文件和其支持的文件组成。
描述了以下信息:
The General section describes the following attributes:
name
服务名称是相对各种Cloudify管理和监控工具,用于标识服务。因此,相同的Cloudify controller管理的所有应用的名称必须是唯一的。
icon
使用可选的图像文件作为Application Map中的服务务图标,将会显示在 Cloudify web management console.
type
服务类型,Cloudify web management console 在Application Map中定位服务。 If you do not specify an icon
in this section, the service type is used to determine the default icon to display in the Application Map. 以下是可支持的类型:
numInstances
当服务启动时,供应初始的实例数。
General section示例如下:
service {
name "jboss-service"
icon "jboss.jpg"
type "APP_SERVER"
numInstances 2
//recipe body here
}
Cloudify 允许在同一主机中部署多项服务。
此举的目的是,在基于BYON云时,将物理机最大化利用。支持以下四种模式:
例子:
service {
name "groovy"
type "WEB_SERVER"
elastic true
numInstances 2
maxAllowedInstances 2
// define SLA requirements for each service instance with regards to isolation from other services
// if this is not defined - defaults to dedicated mode. which means each service instance is insalled on a dedicated VM.
isolationSLA {
global { // global - meaning each service instance can be installed on any VM that answer the requirements below.
// allowing services to share VM's. Note: VM's running management process are not included.
instanceCpuCores 0 // no CPU requirements, this way instances can be installed on the same VM even if it has just one CPU(can also define 0.5 CPU requirements and so on...)
instanceMemoryMB 128 // each instance needs 128MB to be allocated for him on the VM.
useManagement true // Enables installing services/applications on the management machines. Defaults to false.
}
}
可以定义在 -service.groovy :
isolationSLA {
appShared { // services belonging to the same application may share machines
instanceCpuCores 0
instanceMemoryMB 128
}
}
isolationSLA {
global { // all services may share machines
instanceCpuCores 0
instanceMemoryMB 128
}
}
isolationSLA {
tenantShared { // service belonging to the same authenticationGroup may share machines
instanceCpuCores 0
instanceMemoryMB 128
}
}
描述文件中的任一sections可以从外部文件中加载服务信息到描述文件中。这样,某一sections可以被多个服务的描述文件共享。
例如,定义一个标准的web management console metrics布局, 如下:
userInterface
section。 userInterface {
metricGroups = [
metricGroup{
name = "process"
metrics = ["cpu", "memory"]
}
]
widgetGroups = [
widgetGroup{
name ="cpu"
widgets = [
balanceGauge{metric = "cpu"},
barLineChart{metric = "cpu"}
]
},
widgetGroup {
name = "memory"
widgets = [
balanceGauge { metric = "memory" },
barLineChart{ metric = "memory"
axisYUnit Unit.PERCENTAGE
}
]
}
]
}
service {
name "myService"
...
userInterface load("userInterface.groovy")
}