配置-在web management console下展示recipes

The Cloudify Recipe Repository(cloudify-2.5.0以上版本)

Cloudify Web UI新增了一个功能叫recipe repository.默认这个功能是关闭的。 
当打开时Cloudify manager会克隆Cloudify recipes repository 到本地磁盘,运行你浏览、修改文件、安装服务和应用。

配置

这个webui有一个名为“cloudify-webui-context.xml”的spring context XML文件

<beans xmlns= "http://www.springframework.org/schema/beans" 
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation= " 
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" > 
 
<import resource= "webui-context.xml" /> 
 
 
<bean id= "activeFeatures" class= "com.gigaspaces.admin.webui.shared.beans.ActiveFeaturesImpl" > 
<property name= "recipesRepository" value= "false" /><!-- 改变此处即可-->
</bean> 
 
<bean id= "repositoryDefinitionBean" class= "org.cloudifysource.repository.definitions.GitRepositoryDefinition" > 
<property name= "uri" value= "https://github.com/CloudifySource/cloudify-recipes.git" /> 
<property name= "rootFolder" value= "cloudify_recipes_clone" /> 
<property name= "existingMethod" value= "USE_IF_VALID" /> 
</bean> 
 
<bean id= "cloudifyRestClient" class= "com.gigaspaces.webuistubs.CloudifyRepositoryStub" init-method= "init" > 
<property name= "repositoryDefinition" ref= "repositoryDefinitionBean" /> 
<property name= "uniqueIdGenerator" > 
<bean class= "com.gigaspaces.webuistubs.UniqueGeneratorImpl" /> 
</property> 
<property name= "active" value= "#{activeFeatures.recipesRepository}" /> 
</bean> 
 
<bean id= "messageSource" 
class= "org.springframework.context.support.ResourceBundleMessageSource" > 
<property name= "basenames" value= "i18n/cloudify/cloudify_messages,i18n/common/common_messages" /> 
<property name= "useCodeAsDefaultMessage" value= "true" /> 
</bean> 
 
</beans> 


对于本地云放在CloudifyRoot/config(默认情况下有一份,只是参数设置为false)下,而对于集群云路径为CloudifyRoot/clouds/openstack/upload/cloudify-overrides/config/cloudify-webui-context-override.xml (以openstack为例). 
重写cloudify-webui-context的名称必须为 “cloudify-webui-context-override.xml”. 

  1. 修改 “recipesRepository” 为 “true”  (默认为false).
  2. 修改“repositoryDefinitionBean” bean 下的 “URI” 属性为Cloudify下载recipes的git repository(默认为Cloudify的github repository-Cloudify Recipes Repository).
  3. 修改“repositoryDefinitionBean” bean下的“rootFolder”属性为复制recipes-repository 到本地的目标文件夹下 (默认为“CloudifyRoot/work/cloudify_recipes_clone”).
  4. 修改 “existingMethod” 属性来处理cloudify_recipes_clone文件夹已经存在的处理方式
    1. "USE" 使用现有的cloudify_recipes_clone
    2. “USE_IF_VALID" (默认)验证clone文件夹,不合法则删除重新复制。

下面是重写的例子:

<beans xmlns= "http://www.springframework.org/schema/beans" 
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation= " 
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd" > 
 
<import resource= "classpath:cloudify-webui-context.xml" /> 
 
 
<bean id= "activeFeatures" class= "com.gigaspaces.admin.webui.shared.beans.ActiveFeaturesImpl" > 
<property name= "recipesRepository" value= "true" /> <!-- switch on from here if needed--> 
</bean> 
</beans> 

这个配置也可以通过修改接口的实现来完成,接口在MAVEN的依赖下

<groupId>cloudify-repository </groupId> 
<artifactId>cloudify-repository </artifactId> 
<version>9.5.0-SNAPSHOT </version> 

你可能感兴趣的:(Cloudify)