Creating Installer Recipes

You can create your own Gradle recipe to easily install the custom SAP Commerce Cloud configuration of your choice.

The installer is a Gradle-based project written in Groovy that simplifies installing SAP Commerce Cloud. It is a script that takes care of creating directories, moving files, updating configuration and properties files, and initializing the system.

You can create your own installer recipes to install a specific SAP Commerce Cloud configuration, with the desired applications such as B2C Accelerator, Telco Accelerator, or Datahub, for your own needs. A recipe contains all the information required to install and configure the setup, such as the following:

  • Three mandatory tasks: setup, initialize, and start.
  • Calls to required plugins, such as installer-platform-plugin.jar, installer-addon-plugin.jar, and installer-coreplus-plugin.jar.
  • Local properties
  • Extensions
  • Database configuration
  • Web archives
  • Server information, for example: Apache Tomcat.

Installer Recipes

The content of installer recipes varies depending on your needs. The only mandatory content for all installer recipes are the three tasks setup, initialize, and start.

Your installer recipe may require additional information, such as the following:

  • Plugins
  • Extensions
  • Local Properties
  • Servers

Mandatory Tasks

You must include the following three tasks in your installer recipe:

  • setup: Installs the recipe in the installer, which is primarily the copying of files. The setup task is invoked by default if no other task is specified with the install command.
  • initialize: Initializes the application.
  • start: Starts the application.

Additionally, the installer automatically adds a perform task that invokes all the above-mentioned tasks in the order in which they are presented.

The following example shows how these mandatory tasks might be implemented in a recipe called platform_only.

task setup << {
                    platformOnly.setup()
                    }
                    task initialize << {
                    platformOnly.build()
                    platformOnly.initialize()
                    }
                    task start << {
                    platformOnly.startInBackground()
                    }

Plugins

You must define the plugins that your SAP Commerce Cloud setup requires in your recipe. Most recipes include a call to the installer-platform-plugin.jar plugin. Other frequently referenced plugins include the following:

  • installer-addon-plugin-.jar
  • installer-coreplus-plugin-<version>.jar

You can find all available plugins in the \hybris\installer\libs directory. Include your required plugins at the beginning of your recipe as shown in the following example. You can then reference them later in your recipe.

apply plugin: 'installer-platform-plugin'
                    apply plugin: 'installer-coreplus-plugin'

You can also reference your required plugins elsewhere in your recipe as shown in the following example.

task setup << {
                    apply plugin: 'installer-platform-plugin'   
                    def pl = platform(config)
                    pl.setup()
                    }
                    task initialize << {
                    apply plugin: 'installer-platform-plugin'
                    def pl = platform(config)
                    pl.build()
                    pl.initialize()
                    }
                    
                    task start << {
                    apply plugin: 'installer-platform-plugin'
                    def pl = platform(config)
                    pl.start()
                    }

Extensions

You must include all required extensions in your recipe.

The following example shows how extensions are added.

extensions {
                    extName 'yacceleratorcockpits'
                    extName 'yacceleratorinitialdata'
                    extName 'yacceleratorstorefront'
                    extName 'yaddon'
                    extName 'ycommercewebservices'
                    extName 'electronicsstore'
                    extName 'apparelstore'
                    extName 'liveeditaddon'
                    extName 'acceleratorwebservicesaddon'
                    }
                    }

Local Properties

You must specify any local properties that your SAP Commerce Cloud setup requires.

The following example shows how these local properties are defined.

localProperties {
                    property 'commerceservices.default.desktop.ui.experience', 'responsive'
                    property 'uiexperience.level.supported', 'DESKTOP'
                    }

Web Servers

You must specify information related to any web servers that you require.

The following example shows how the mandatory tasks are implemented.

def setupOMSTomcat() {
                    def CATALINA_OPTS = "-Xms4096m -Xmx4096m"
                    tomcat.instance('oms').setup {
                    ports {
                    http 8080
                    ssl  8081
                    }
                    webApps {
                    webApp 'oms-rest-webapp.war', file(suiteHome+'/hybris-oms/binary/webapp/oms-rest-webapp.war')
                    }
                    libraries {
                    lib file(suiteHome+'/hybris-oms/sample-config/com.hybris.oms_oms-rest-webapp-logback.xml')
                    }
                    
                    }.start(CATALINA_OPTS)
                    }

Creating Your Installer Recipe

Procedure

  1. Using Groovy, write your Installer recipe following the information provided in Installer Recipes.
  2. Create a folder for your recipe in the /hybris/installer/recipes/.
    The name of your recipe must be the same as the name of your folder.
  3. Create a README.txt file that describes what your recipe does and the commands required to setup, initiate and start your recipe.
  4. Save your recipe as a build.gradle file in the recipe's folder.