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_Name
    $ cd App_Name
  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"
    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.git
  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

    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
    Any applications created using the specified cartridge will now draw from the customized template.