The Gradle Gaffer plugin provides a DSL for preparing complex deployment tasks. It works like the distribution plugin but with a different use case.
Include the following in your Gradle build script:
plugins {
id "de.ethinking.gaffer" version "0.8.0"
}
plugins {
id "de.ethinking.gaffer" version "x.x.y"
}
gaffer{ //(1)
application{ //(2)
name = 'tomcat'
copy{
from ...
into ...
}
}
application{ //(3)
name = 'springboot-app'
copy{
from ...
into ...
}
}
profile{
}
container{
}
}
-
Gaffer plugin extension
-
an application definition
-
a second application definition
-
profile definition
-
container definition
The Gradle Gaffer plugin will generate a set of dynamic tasks from the declared applications, profiles and containers inside the gaffer extenstion. You can use the tasks and its output in other tasks to deploy the assembled containers via ssh or into a Docker container.
assemble-container-<container name>
We use the gaffer plugin for assembling different web applications into applications servers. In this example we orchestrate some common monitoring web applications and a solr release into a tomcat release.
plugins {
id "de.ethinking.gaffer" version "0.8.0"
}
repositories{
ivy{
url 'http://mirror.netcologne.de/apache.org/tomcat/tomcat-8/'
layout "pattern", {artifact "v[revision]/bin/[artifact]-[revision].zip"}
}
}
gaffer{ //(1)
application{ //(2)
name = 'tomcat'
copy{
from distributionDependency('org.apache:apache-tomcat:8.0.22')
into '/opt/tomcat'
}
}
profile{
name = 'solr4'
application{
name='tomcat'
copy{
from flatDependency('org.apache.solr:solr:4.10.4@war')
into '/opt/tomcat/webapps/solr'
}
}
profile{
name = 'monitoring'
application{
name='tomcat'
copy{
from flatDependency('org.jolokia:jolokia-war:1.2.3@war')
into '/opt/tomcat/webapps/jolokia'
}
copy{
from flatDependency('com.netflix.hystrix:hystrix-dashboard:1.4.5@war')
into '/opt/tomcat/webapps/hystrix-dashboard'
}
}
}
}
container{
name="searchserver"
profiles "solr4","monitoring"
reportTarget='opt/tomcat/webapps/report'
}
}
Execute Gaffer assemble task by
gradle assemble-container-searchserver
You will find the generated assembled files in
$builDir/assemble/container/<container name>/
The Gaffer Report is a small AngularJS App which provides information about the assembled files. In order to activate the report set up the reportTarget property inside the container to the desired location.
gaffer{
...
container{
name="searchserver"
reportTarget='opt/tomcat/webapps/report'
}
}
Copyright 2014-2015 (c) eThinking and contributors.
All versions, present and past, of Gradle Gaffer Plugin are licensed under Apache 2.0 license.