Summary
This plugin collection contains plugins for building container images and starting container of and for Intershop Commerce Management. It is necessary that the 'ICM Gradle plugin' was applied to the project. Version 3.4.0 of this plugin is the minimum version.
This plugin is based on 'Gradle Docker plugin' and the 'Docker-Java Framework'.
Intershop Commerce Management Docker Plugin
This plugin configures the basics of an Intershop Commerce Management product project.
Plugin Configuration
The plugins must be applied to the root project.
Groovy
plugins {
id 'com.intershop.gradle.icm.base' version '3.4.0'
id 'com.intershop.gradle.icm.docker' version '{latestRevision}'
}
docker {
registryCredentials {
url = "https://<registry hostname>"
username = "<registry user name>"
password = "<registry user password>"
email = "<registry user email>"
}
}
intershop {
// see https://github.com/IntershopCommunicationsAG/icm-gradle-plugin
projectInfo {}
projectConfig {}
}
intershop_docker {
images {
icmsetup = 'registry.intershop.de/intershop/icm-base:1.9.2'
webadapter = 'registry.intershop.de/intershop/icm-webadapter:2.0.6'
webadapteragent = 'registry.intershop.de/intershop/icm-webadapteragent:3.0.4'
mssql = '<image with an prepares installation for Intershop>'
oracle = '<image with an prepares installation for Intershop>'
mailsrv = 'mailhog/mailhog:latest'
}
imageBuild {
license = 'Intershop Communications AG'
maintainer = 'Intershop Communications AG "www.intershop.de"'
baseDescription = 'Intershop Commerce Management'
baseImageName = '${dockerRegHostName}/intershop/icm'
images {
mainImage {
dockerfile = file('docker/main/Dockerfile')
addFiles(tasks.createMainPkg.outputs.files)
dockerBuildDir = 'main'
description = 'AppServer Container'
enabled = true
}
initImage {
dockerfile = file('docker/init/Dockerfile')
addFiles(tasks.createInitPkg.outputs.files)
dockerBuildDir = 'init'
description = 'Init Container'
enabled = true
}
testImage {
dockerfile = file('docker/test/Dockerfile')
addFiles(tasks.createTestPkg.outputs.files)
dockerBuildDir = 'test'
description = 'AppServer Test Container'
enabled = true
}
initTestImage {
dockerfile = file('docker/initTest/Dockerfile')
addFiles(tasks.createInitTestPkg.outputs.files)
dockerBuildDir = 'inittest'
description = 'Test Init Conainer'
enabled = true
}
}
}
}
Kotlin
plugins {
id("com.intershop.gradle.icm.base") version "2.2.0"
id("com.intershop.gradle.icm.docker") version "{latestRevision}"
}
docker {
registryCredentials {
url.set("https://<registry hostname>")
username.set("<registry user name>")
password.set("<registry user password>")
email.set("<registry user email>")
}
}
intershop {
// see https://github.com/IntershopCommunicationsAG/icm-gradle-plugin
projectInfo {}
projectConfig {}
}
intershop_docker {
images {
icmsetup.set("docker-public.rnd.intershop.de/intershop/icm-base:1.9.2")
webadapter.set("docker-public.rnd.intershop.de/intershop/icm-webadapter:2.0.6")
webadapteragent.set("docker-public.rnd.intershop.de/intershop/icm-webadapteragent:3.0.4")
mssqldb.set("<image with an prepares installation for Intershop>")
oracle.set("<image with an prepares installation for Intershop>")
mailsrv.set("mailhog/mailhog:latest")
}
imageBuild {
license.set("Intershop Communications AG")
maintainer.set("Intershop Communications AG 'www.intershop.de'")
baseDescription.set("Intershop Commerce Management")
baseImageName.set("${dockerRegHostName}/intershop/icm")
images {
mainImage {
dockerfile.set(file("docker/main/Dockerfile"))
addFiles(tasks.createMainPkg.get().outputs.files)
dockerBuildDir.set("main")
description.set("AppServer Container")
enabled.set(true)
}
initImage {
dockerfile.set(file("docker/init/Dockerfile"))
addFiles(tasks.createInitPkg.get().outputs.files)
dockerBuildDir.set("init")
description.set("Init Container")
enabled.set(true)
}
testImage {
dockerfile.set(file("docker/test/Dockerfile"))
addFiles(tasks.createTestPkg.get().outputs.files)
dockerBuildDir.set("test")
description.set("AppServer Test Container")
enabled.set(true)
}
initTestImage {
dockerfile.set(file("docker/initTest/Dockerfile"))
addFiles(tasks.createInitTestPkg.get().outputs.files)
dockerBuildDir.set("inittest")
description.set("Test Init Conainer")
enabled.set(true)
}
}
}
}
Extension 'intershop_docker'
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
<project name> |
Underscores will be replaced with dashes. This property is used for container names, volumes and network in Docker. |
|
|
This extension handles the access to a local property file, to adapt the configuration to a local environment. See Configuration properties file. |
|
|
|
This extension contains the configuration of all supported and necessary images. |
|
|
|
This part contains the configuration for all image artifacts of a build project. |
Methods
| Method | Parameter | Description |
|---|---|---|
|
|
Configures the development configuration of this project in a Groovy context. |
|
|
Configures the development configuration of this project in a Kotlin script context. |
|
|
Configures the images' configuration of this project in a Groovy context. |
|
|
Configures the images' configuration of this project in a Kotlin script context. |
|
|
Configures the image build configuration of this project in a Groovy context. |
|
|
Configures the image build configuration of this project in a Kotlin script context. |
Development Configuration DevelopmentConfiguration
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
|
If the appserver runs as a container this value must be true. This is used for customer projects. |
|
|
|
The directory with a valid license file for the running project. |
|
|
|
This directory contains the environment specific development configuration for ICM. See Configuration properties file. |
|
|
|
The file path of the license file (read only). |
|
|
|
The path of the configuration file (read only). |
Methods
| Method | Parameter | Description |
|---|---|---|
|
|
Get a property from the configuration file. If the property key is not available the return value is empty. |
|
|
Get a property from the configuration file. If the property key is not available the return value is specified by the second parameter. |
Image Configuration Images
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
|
This image is used as a base image for the most ICM images. |
|
|
|
The image contains the web server of the Intershop Commerce Management application with a special Intershop Apache module. |
|
|
|
The web adapter agent image of the Intershop Commerce Management application. |
|
|
|
The Microsoft SQL server image. There will be also a build file available. |
|
|
|
This image is only available internally. The build files will be provided. |
|
|
|
A mail server for testing the mail feature of the application. |
Image Build Configuration ProjectConfiguration
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
"Intershop Communications AG" |
The license of image artifacts created by this build. |
|
|
"Intershop Communications AG \"www.intershop.de\"" |
The maintainer of image artifacts created by this build. |
|
|
"Intershop Commerce Management" |
The base description for all image artifacts created by this build. |
|
|
The version of image artifacts created by this build. |
|
|
|
<build time> |
The build time of image artifacts created by this build. The machine time is used for the default value. |
|
|
"server/intershop/icm" |
The base image name for all image artifacts created by this build. |
|
|
The detailed configuration of all image builds. |
Image Build Configuration Images
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
The configuration of the main server image build. |
|
|
|
The configuration of the test server image build. This image uses the main image as a base image. |
|
|
|
The configuration of the init image for the ICM application server. |
|
|
|
The configuration of the test init image. This image uses the init image as a base image. |
For all properties configurations methods with a closure or an action are available.
Detailed Image Build Configuration ImageConfiguration
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
Image name extension of the special image. The base is used from the [ProjectConfiguration]. |
|
|
|
Extended description of the image. |
|
|
|
Source files for the build (start scripts etc.). This files are referenced by the Dockerfile. |
|
|
|
Files will be packaged by the build for an installation in a docker image. This is the name of the package task. |
|
|
|
The docker file for the image build. |
|
|
|
The working director for the image build. |
|
|
|
The build of the image can be disabled for the project. |
Tasks
| Task name | Description |
|---|---|
prepareNetwork |
Creates a network with the specified name <extension name>-network. All start tasks are dependend on this task. |
removeNetwork |
Removes the network from the Docker configuration. |
*MSSQL |
These tasks pull, start, stop and remove the MSSQL image. |
*Oracle |
These tasks pull, start, stop and remove the Oracle DB image. |
*MailSrv |
These tasks pull, start, stop and remove the Mail server image. |
createWebVolumes |
Creates necessary volumes for the ICM web server with WebAdapter Agent. |
removeWebVolumes |
Removes web server volumes from the Docker configuration. |
*WAA |
These tasks pull, start, stop and remove the ICM Web Adapter Agent image. |
*WA |
These tasks pull, start, stop and remove the ICM Web Adapter image. This image contains a Apache webserver with the ICM WA module. |
*WebServer |
These tasks orchestrate all web server related tasks. |
containerClean |
This task starts the remove tasks for all available objects. |
The package of all tasks is com.intershop.gradle.icm.docker.tasks.
| Task name | Class | Description |
|---|---|---|
pull* |
|
These task pull the image or a set of images. |
start* |
|
Start image with the necessary configuration. |
stop* |
|
Stop image by name. |
remove* |
|
Removes image from Docker by name. |
Configuration properties file and Image Properties
There are no special configuration properties for the mail server.
The SMTP port is 25 and the web interface listened on 8025. Mails are stored
in the build directory mailoutput.
| Task | Property Key | Property Value |
|---|---|---|
MSSQL |
|
Exposed port of the database |
|
Name of the admin password. Default value is "1ntershop5A". |
|
|
The db will be recreated after a restart if the value is true. Default value is "false". |
|
|
The db will be recreated after a restart if the value is true. Default value is "false". |
|
|
The name of the database. Default is "icmtestdb" |
|
Oracle |
|
Exposed listener port of the database. |
|
Exposed enterprise manager port of the oracle db. |
|
WA |
|
Exposed http port of the webserver. |
|
Exposed https port of the webserver. |
|
|
Hostname or IP of the local host. This is used for the connection between WA and AS on the local host. |
Intershop Commerce Management Project Docker Plugin
This plugin configures additional tasks of an Intershop Commerce Management customer project. It uses the same Gradle configuration like the Docker Plugin. With this plugin additional task will be configured and the task dependencies are adapted for the development process.
The plugins must be applied to the root project.
Plugin Configuration
Extension 'intershop_docker'
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
This is a configuration for special Intershop server unit tests. This configuration is used only in a customer project. |
Object Suite
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
This is the name of a cartridge that also contains ishUnitTests. |
|
|
|
The name of the test suite. |
Additional Image Configuration Images
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
|
This image is used as a base image for the ICM application server image. |
|
|
|
This image is used as a base image for ICM application server initialization image. |
|
|
|
This image is used for the Solr Cloud configuration with a single node. |
|
|
|
This image is used for the Solr Cloud configuration with a single node. |
Tasks
| Task name | Description |
|---|---|
*SolrCloud |
These tasks orchestrate all Solr Cloud related tasks. |
*ZK |
These tasks pull, start, stop and remove the Zookeeper image. |
*Solr |
These tasks pull, start, stop and remove the Solr image. |
*Container |
These tasks pull, start, stop and remove the ICM application server image with a special command. There is no running process inside, but it uses the same configuration like the appserver container. |
*AS |
These tasks pull, start, stop and remove the ICM application server image. |
*Server |
These tasks orchestrate all ICM server related tasks (web server and app server) |
dbPrepare |
This task starts dbPrepare inside the running "Container" docker container. |
ishUnitTestReport |
This task starts the creation of a report for all ISHUnit test executions. |
*ISHUnitTest |
These tasks starts ishUnit tests inside the running "Container" docker container. |
For task classes see the documentation of task in the Intershop Commerce Management Docker Plugin.
The task startContainer and startAs uses StartServerContainer. pullContainer and pullAS uses PullImage.
With this task it is possible to use an alternative image for these tasks with a command line parameter --altImage.
Intershop Commerce Management Test Docker Plugin
Additional test tasks of an Intershop Commerce Management project will be added by this plugin. It uses the same Gradle configuration like the Docker Plugin. One additional task is added by this plugin.
The plugins must be applied to the root project.
Plugin Configuration
Additional Image Configuration Images
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
|
This image is used for ICM HTMLUnitTests. |
Tasks
| Task name | Description |
|---|---|
*TestMailSrv |
These tasks pull, start, stop and remove the Test mail server image. |
For task classes see the documentation of task in the Intershop Commerce Management Docker Plugin.
Intershop Commerce Management GebTest Docker Plugin
This plugin adds test tasks for Geb.
Plugin Configuration
The plugin must be applied to the project with included Geb tests. It requires an applied ICM Docker plugin.
Furthermore it depends on the configuration of Geb self (GebConfig.groovy).
Groovy
plugins {
id 'com.intershop.gradle.icm.docker.gebtest' version '3.4.0'
}
gebConfiguration {
localDriver {
geckoDriver {
osPackages {
linux {
url = 'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz'
archiveType = 'tar.gz'
webDriverExecName = 'geckodriver'
}
win {
url = 'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win32.zip'
archiveType = 'zip'
webDriverExecName = 'geckodriver.exe'
}
mac {
url = 'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz'
archiveType = 'tar.gz'
webDriverExecName = 'geckodriver'
}
}
}
chromeDriver {
osPackages {
linux {
url = 'https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_linux64.zip'
archiveType = 'zip'
webDriverExecName = 'chromedriver'
}
win {
url = 'https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_win32.zip'
archiveType = 'zip'
webDriverExecName = 'chromedriver.exe'
}
mac {
url = 'https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_mac64.zip'
archiveType = 'zip'
webDriverExecName = 'chromedriver'
}
}
}
}
}
Kotlin
plugins {
id("com.intershop.gradle.icm.docker.gebtest") version "3.4.0"
}
extensions.getByType(GebConfiguration::class.java).apply {
localDriver {
register("geckoDriver") {
osPackages {
register("linux") {
url.set("https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz")
archiveType.set("tar.gz")
webDriverExecName.set("geckodriver")
}
register("win") {
url.set("https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-win32.zip")
archiveType.set("zip")
webDriverExecName.set("geckodriver.exe")
}
register("mac") {
url.set("https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz")
archiveType.set("tar.gz")
webDriverExecName.set("geckodriver")
}
}
}
register("chromeDriver") {
osPackages {
register("linux") {
url.set("https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_linux64.zip")
archiveType.set("zip")
webDriverExecName.set("chromedriver")
}
register("win") {
url.set("https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_win32.zip")
archiveType.set("zip")
webDriverExecName.set("chromedriver.exe")
}
register("mac") {
url.set("https://chromedriver.storage.googleapis.com/86.0.4240.22/chromedriver_mac64.zip")
archiveType.set("zip")
webDriverExecName.set("chromedriver")
}
}
}
}
}
This plugin adds also a source set configuration for gebTests:
-
source directory is
"src/gebTest/groovy" -
resource directory is
"src/gebTest/resources"
The plugin is based on the following GebTest configuration:
import org.junit.runner.Description
import org.junit.runners.model.Statement
import org.openqa.selenium.Dimension
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.firefox.FirefoxOptions
import org.openqa.selenium.firefox.FirefoxDriverLogLevel
import org.testcontainers.DockerClientFactory
import org.testcontainers.containers.BrowserWebDriverContainer
import org.testcontainers.containers.Network
def webDriverExec = System.getProperty('webdriverExec')
def containerNetwork = System.getProperty('container.network')
waiting {
// max request time in seconds
timeout = 90
// http://gebish.org/manual/current/#failure-causes
includeCauseInMessage = true
}
environments {
firefoxContainer {
driver = {
def networkId = findNetworkIdForName(containerNetwork)
BrowserWebDriverContainer webdriverContainer = addFirefoxContainerToNetwork(networkId)
webdriverContainer.start()
driver = webdriverContainer.getWebDriver()
driver
}
}
chromeContainer {
driver = {
def networkId = findNetworkIdForName(containerNetwork)
BrowserWebDriverContainer webdriverContainer = addFirefoxContainerToNetwork(networkId)
webdriverContainer.start()
driver = webdriverContainer.getWebDriver()
driver
}
}
chromeTablet {
driver = {
def driver = createChromeDriverInstance(webDriverExec)
driver.manage().window().setSize(new Dimension(1024, 768))
driver
}
}
chromePC {
driver = {
def driver = createChromeDriverInstance(webDriverExec)
driver.manage().window().setSize(new Dimension(1920, 1200))
driver
}
}
geckoPC {
driver = {
def driver = createGeckoDriverInstance(webDriverExec)
driver.manage().window().setSize(new Dimension(1920, 1200))
driver
}
}
geckoTablet {
driver = {
def driver = createGeckoDriverInstance(webDriverExec)
driver.manage().window().setSize(new Dimension(1024, 768))
driver
}
}
}
private def createGeckoDriverInstance(String webDriverExec) {
System.setProperty("webdriver.gecko.driver", webDriverExec)
FirefoxOptions options = new FirefoxOptions()
//options.setHeadless(true)
options.setLogLevel(FirefoxDriverLogLevel.ERROR)
driverInstance = new FirefoxDriver(options)
driverInstance
}
private def createChromeDriverInstance(String webDriverExec) {
System.setProperty("webdriver.chrome.driver", webDriverExec)
driverInstance = new ChromeDriver()
driverInstance
}
private BrowserWebDriverContainer addFirefoxContainerToNetwork(String networkId){
Network tcNet = createNetwork(networkId)
FirefoxOptions options = new FirefoxOptions()
options.setHeadless(true)
BrowserWebDriverContainer webdriverContainer = new BrowserWebDriverContainer<>()
.withCapabilities(options)
.withNetwork(tcNet)
return webdriverContainer
}
private BrowserWebDriverContainer addChromeContainerToNetwork(String networkId){
Network tcNet = createNetwork(networkId)
ChromeOptions options = new ChromeOptions()
options.setHeadless(true)
BrowserWebDriverContainer webdriverContainer = new BrowserWebDriverContainer<>()
.withCapabilities(options)
.withNetwork(tcNet)
return webdriverContainer
}
private String findNetworkIdForName(String name) {
def client = DockerClientFactory.instance().client()
def rv = client.inspectNetworkCmd().withNetworkId(name).exec().id
return rv
}
private createNetwork(networkId) {
Network tcNet = new Network() {
@Override
String getId() {
return networkId
}
@Override
void close() throws Exception {}
@Override
Statement apply(Statement base, Description description) {
return null
}
}
return tcNet
}
The plugin set the following system properties for the test:
|
Executable name for local drivers from the extension configuration. |
|
Network for the test containers framework. |
|
The url will be calculated from the base configuration of the web server image. If the container framework is used, the internal network name is used. |
Furthermore the host
Extension 'gebConfiguration'
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
"firefoxContainer" |
Name of the configured in the Geb configuration file |
|
|
Container with local driver configurations. |
Object GebLocalDriver
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
Container with a configuration to download the necessary driver download. |
Object GebDriverDownload
Properties
| Property | Type | Default value | Description |
|---|---|---|---|
|
|
Container with a configuration to download the necessary driver download. |
|
|
|
Container with a configuration to download the necessary driver download. |
|
|
|
Container with a configuration to download the necessary driver download. |
Tasks
| Task name | Class | Description |
|---|---|---|
gebTest |
|
Starts the Geb Test form the gebTest source set. |
downloadDriver |
|
Downloads and unpack the configured local driver if necessary. |
Configuration properties file and Image Properties
It is possible to switch to a local driver for development purposes.
| Task | Property Key | Property Value |
|---|---|---|
|
|
The name of the local driver. |
|
The name of the local environment. |
|
For container configuration |
||
* |
|
The exposed http port of the webserver. Default: 808 |
|
The exposed https port of the webserver. Default: 8443 |
|
For local configuration |
||
* |
|
The hostname or the IP of the local machine. |
|
The exposed http port of the webserver. |
|
|
The exposed https port of the webserver. |
|
Intershop Commerce Management SolrCloud Plugin
If the project includes SolrCloud as a search engine, this plugin provides some necessary tasks for the management of search indexes. It uses the same configuration like the ICM Docker plugin.
Tasks
| Task name | Class | Description |
|---|---|---|
cleanUpSolr |
|
Removes all search configurations and collections with a specified prefix. |
listSolr |
|
List all search configurations and collections with a specified prefix. |
rebuildSearchIndex |
|
Starts an ICM job over the ICM Rest interface to rebuild all search indexes. |
Configuration properties file and Image Properties
| Task | Property Key | Property Value |
|---|---|---|
cleanUpSolr |
|
A list of all Zookeeper hosts with port and the Solr server prefix. |
|
A simple installation specific prefix for the Solr search configuration, e.g. the hostname. |
|
rebuildSearchIndex |
|
This is the ICM SMC admin user. Default: admin. |
|
This is the password of the SMC admin user. |
|
|
If no public SSL certificate is installed on the webserver, it is possible to disable the verification with the value |
|
* |
|
The hostname or the IP of the local machine. |
|
The exposed http port of the webserver. |
|
|
The exposed https port of the webserver. |
Configuration properties file
For the configuration on a special local maschine it is necessary to provide an Intershop licence file and a
imc.properties file in file structure. It is possible to configure the location with environment properties.
This is a minimum set of properties.
icm.properties
# database connection configuration
intershop.databaseType = oracle|mssql
intershop.jdbc.url = jdbc:oracle:thin:@host:1521:XE | jdbc:sqlserver://host:1433;databaseName=dbname
intershop.jdbc.user = user
intershop.jdbc.password = password
# webserver configuration of the appserver
intershop.WebServerURL=http://host:8080
intershop.WebServerSecureURL=https://host:8443
# webserver configuration
webserver.http.port = 8080
webserver.https.port = 8080
# database container configuration
intershop.db.mssql.dbname = dbname
# server configuration
intershop.servletEngine.connector.port = 7743
# local host configuration
# this is not always 'localhost'.
intershop.local.hostname = 192.168.2.205
# solr configuiration
solr.zooKeeperHostList = jengsolr1.intershop.de:2181;jengsolr2.intershop.de:2181;jengsolr3.intershop.de:2181/solr8
solr.clusterIndexPrefix = devhost
intershop.smc.admin.user.name = admin
intershop.smc.admin.user.password = password
# disable the ssl verification of the webserver
disable.ssl.verification = true
# geb.local.environment = chromePC
# geb.local.driver = chromeDriver
License
Copyright 2014-2020 Intershop Communications.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.