/gradle-gaffer-plugin

Gradle plugin for assembling projects and files as base for deployment processes

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Gradle Gaffer plugin

The Gradle Gaffer plugin provides a DSL for preparing complex deployment tasks. It works like the distribution plugin but with a different use case.

Usage

Include the following in your Gradle build script:

plugins {
  id "de.ethinking.gaffer" version "0.8.0"
}

Gaffer DSL

Plugin de.ethinking.deploy

Example build.gradle
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{

    }
}
  1. Gaffer plugin extension

  2. an application definition

  3. a second application definition

  4. profile definition

  5. container definition

Deploy Pipeline

  • Build depending projects

  • Assemble webapps

  • Prepare applications

  • Assemble applications from profiles

  • Putting all together into containers

Gaffer Tasks

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>

Usage Example

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.

Example build.gradle
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>/

Gaffer Report

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.