Skip to content

Quick start

Simon Jahreiß edited this page Nov 18, 2016 · 4 revisions

This quick start demonstrates the usage of the Gradle-Cloud-Deployer plugin.

1. Apply the plugin

Build script snippet for use in all Gradle versions:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.de.qaware.cloud.deployer:deployer:0.9.2"
  }
}

apply plugin: "de.qaware.cloud.deployer"

Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:

plugins {
  id "de.qaware.cloud.deployer" version "0.9.2"
}

To control if you applied the plugin correctly type:

gradlew tasks

You should see the Deployment tasks section in your task list:

Deployment tasks
----------------
delete - Deletes the specified environment (e.g. --environmentId=test).
deleteAll - Deletes all environments.
deploy - Deploys the specified environment (e.g. --environmentId=test).
deployAll - Deploys all environments.

2. Configure the plugin

This build script snippet demonstrates how to configure the plugin to deploy to a Marathon and a Kubernetes cloud:

deployer {
    marathon {
        id = "marathon-zwitscher"
        baseUrl = "http://your-address.com"
        strategy = "REPLACE"
        auth {
            token = defaultToken(file("token.txt"))
        }
        files = [file("marathon-zwitscher-config.json")]
    }
    kubernetes {
        id = "kubernetes-zwitscher"
        baseUrl = "https://your-address.com"
        strategy = "UPDATE"
        namespace = "test"
        auth {
            username = "admin"
            password = "s3cr3t"
        }
        ssl {
            trustAll = true
        }
        files = [file("kubernetes-zwitscher-config.json")]
    }
}

You can define multiple environments. The example creates an marathon-zwitscher and kubernetes-zwitscher environment. Thereby it's possible to mix different cloud orchestrators. Additionally the plugin allows authentication (e.g. via token or username and password) and ssl connections (e.g. via a self-signed certificate).

Examples for a kubernetes config file and a marathon config file can be found in QAware's Cloud Native Zwitscher Showcase.

See the documentation for more details on configuration.

3. Execute a task

After configuring the plugin you can use the different tasks to

  • deploy all environments
gradlew deployAll
  • deploy a single environment
gradlew deploy --environmentId=test
  • delete all environments
gradlew deleteAll
  • delete a single environment
gradlew delete --environmentId=test

See the documentation for more details on the tasks.

Clone this wiki locally