此内容没有您所选择的语言版本。

Chapter 14. Customizing OpenShift Enterprise


With the release of OpenShift Enterprise 2.1, the Management Console and default application settings are customizable to suit organizational branding.

14.1. Creating Custom Application Templates

When an application is created, the default application content and Git repository is created from a template supplied by the application's web cartridge. You can customize these templates without creating an entirely custom cartridge. For example, you can modify the initial content with organizational branding.

Note

Customizations only apply to newly created applications and do not apply to existing applications. You can also use the --from-code option when creating an application to specify a different application template.

Procedure 14.1. To Create an Application Template:

  1. Create an application using the desired cartridge, then change into the Git directory:
    $ rhc app create App_Name Cart_Namerhc app create App_Name Cart_Namerhc app create App_Name Cart_Namerhc app create App_Name Cart_Name
    $ cd App_Namecd App_Name
    Copy to Clipboard Toggle word wrap
  2. Make any desired changes to the default cartridge template. Templates can include more than application content, such as application server configuration files.
    If you are creating an application template from a JBoss EAP or JBoss EWS cartridge, you may want to modify settings such as groupId and artifactId in the pom.xml file, as these settings are equal to the App_Name value used above. It is possible to use environment variables, such as ${env.OPENSHIFT_APP_DNS}, however it is not recommended by Red Hat because Maven will issue warnings on each subsequent build, and the ability to use environment variables might be removed in future versions of Maven.
  3. Commit the changes to the local Git repository:
    $ git add .
    $ git commit -am "Template Customization"
    Copy to Clipboard Toggle word wrap
    You can now use this repository as an application template.
  4. Place the template into a shared space that is readable by each node host. This could be on Github, an internal Git server, or a directory on each node host. Red Hat recommends creating a local directory named templates, then cloning the template into the new directory:
    $ mkdir -p /etc/openshift/templates
    $ git clone --bare App_Name /etc/openshift/templates/Cart_Name.gitgit clone --bare App_Name /etc/openshift/templates/Cart_Name.gitgit clone --bare App_Name /etc/openshift/templates/Cart_Name.gitgit clone --bare App_Name /etc/openshift/templates/Cart_Name.gitgit clone --bare App_Name /etc/openshift/templates/Cart_Name.git
    Copy to Clipboard Toggle word wrap
  5. Next, edit the /etc/openshift/broker.conf file on the broker host, specifying the new template repository as the default location to pull from each time an application is created:
    DEFAULT_APP_TEMPLATES=Cart_Name|file:///etc/openshift/templates/Cart_Name.git
    Copy to Clipboard Toggle word wrap

    Note

    The broker provides the same cartridge template location to all nodes, so the template location must be available on all node hosts or application creation will fail.
  6. Restart the broker for the changes to take effect:
    $ service openshift-broker restart
    Copy to Clipboard Toggle word wrap
    Any applications created using the specified cartridge will now draw from the customized template.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat