Skip to content

Commit

Permalink
marklogic#40 Added task for configuring forest replicas
Browse files Browse the repository at this point in the history
  • Loading branch information
rjrudin committed Sep 14, 2015
1 parent e35ed38 commit fef63b6
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ examples/disconnected-project/build/
examples/disconnected-project/.gradle/
examples/flexrep-project/.gradle/
examples/sample-project/local.gradle
examples/failover-project/.gradle/
16 changes: 13 additions & 3 deletions CHANGELOG.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@
This changelog is in its infancy, but the plan is to start tracking all changes via issues and then associating them
with releases.

## 1.2
TODO Reconcile this with what's in gradle.properties

* [#5](https://github.com/rjrudin/ml-gradle/issues/5) Added Corb Task
## 2.0b8

* [#40](https://github.com/rjrudin/ml-gradle/issues/40) Can now easily configure replica forests, particularly for
out-of-the-box forests like Security, Schemas, Meters, and App-Services
* Reworked mlWatch so that it reuses the instance of LoadModulesCommand that's created by MarkLogicPlugin

TODO Reconcile this with what's in gradle.properties
## 2.0b7

* [#38](https://github.com/rjrudin/ml-gradle/issues/38) mlWatch now supports all connection options, including SSL
* Now using ml-app-deployer 2.0b6, which allows for a custom FileFilter on LoadModulesCommand

## 2.0b6

* [#36](https://github.com/rjrudin/ml-gradle/issues/36) Added mlDeployFlexrep
6 changes: 6 additions & 0 deletions examples/failover-project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This project shows an example of configuring replica forests for the out-of-the-box databases that are typically worth
enabling failover.

Note that you'll need to run this against a cluster with at least two nodes (failover requires three nodes, but you
only need two nodes to see how ml-gradle will create replica forests).

12 changes: 12 additions & 0 deletions examples/failover-project/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
buildscript {
repositories {
mavenCentral()
maven {url "http://developer.marklogic.com/maven2/"}
maven {url "http://rjrudin.github.io/marklogic-java/releases"}
}
dependencies { classpath mlGradleDependency }
}

apply plugin: 'ml-gradle'

mlConfigureForestReplicas.command.forestNamesAndReplicaCounts = [ "Security": 2, "Schemas": 1, "Meters": 1, "App-Services": 1]
7 changes: 7 additions & 0 deletions examples/failover-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mlGradleDependency=com.rjrudin:ml-gradle:2.0b8

mlHost=localhost
mlAppName=failover-example
mlRestPort=8130
mlUsername=admin
mlPassword=admin
6 changes: 2 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
group=com.rjrudin
publishUrl=file:../gh-pages-marklogic-java/releases

version=2.0b8
mlAppDeployerDependency=com.rjrudin:ml-app-deployer:2.0b8

# 1.2.1 - now using 0.9.3 of ml-app-deployer
Expand Down Expand Up @@ -30,8 +31,5 @@ mlAppDeployerDependency=com.rjrudin:ml-app-deployer:2.0b8
# 2.0b3 - Using ml-app-deployer 2.0b3
# 2.0b4 - Using ml-app-deployer 2.0b4, Create* commands renamed to Deploy*
# 2.0b5 - Added DeployDatabasesTask, DeployGroupsTask, DeployServersTask; added DeployGroupsCommand to mlDeploy; added mlSimpleSsl
# 2.0b6 - Added flexrep support to mlDeploy; added mlDeployFlexrep
# 2.0b7 - Using ml-app-deployer 2.0b6, which allows for a custom FileFilter on LoadModulesCommand; fixed up WatchTask
# 2.0b8 - Using ml-app-deployer 2.0b7, which makes it easier for WatchTask to reuse the ModulesLoader in LoadModulesCommand
version=2.0b8
# Future versions - see CHANGELOG.mdown

Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import com.rjrudin.marklogic.gradle.task.databases.ClearSchemasDatabaseTask
import com.rjrudin.marklogic.gradle.task.databases.ClearTriggersDatabaseTask
import com.rjrudin.marklogic.gradle.task.databases.DeployDatabasesTask
import com.rjrudin.marklogic.gradle.task.flexrep.DeployFlexrepTask;
import com.rjrudin.marklogic.gradle.task.forests.ConfigureForestReplicasTask;
import com.rjrudin.marklogic.gradle.task.groups.DeployGroupsTask
import com.rjrudin.marklogic.gradle.task.scaffold.GenerateScaffoldTask
import com.rjrudin.marklogic.gradle.task.security.DeploySecurityTask
Expand Down Expand Up @@ -112,6 +113,9 @@ class MarkLogicPlugin implements Plugin<Project> {
String flexrepGroup = "ml-gradle Flexible Replication"
project.task("mlDeployFlexrep", type: DeployFlexrepTask, group: flexrepGroup, description: "Deploy Flexrep configs and targets")

String forestGroup = "ml-gradle Forest"
project.task("mlConfigureForestReplicas", type: ConfigureForestReplicasTask, group: forestGroup, description: "Configure forest replicas via the command.forestNamesAndReplicaCounts map")

String groupsGroup = "ml-gradle Group"
project.task("mlDeployGroups", type: DeployGroupsTask, group: groupsGroup, description: "Deploy each group, updating it if it exists")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.rjrudin.marklogic.gradle.task.forests

import org.gradle.api.tasks.TaskAction

import com.rjrudin.marklogic.appdeployer.command.forests.ConfigureForestReplicasCommand
import com.rjrudin.marklogic.gradle.task.MarkLogicTask

/**
* Task for executing an instance of ConfigureForestReplicasCommand. The command is exposed as a task attribute so
* that its map of forest names and replica counts and be configured easily in a Gradle build file.
*/
class ConfigureForestReplicasTask extends MarkLogicTask {

ConfigureForestReplicasCommand command = new ConfigureForestReplicasCommand()

@TaskAction
void configureReplicaForests() {
command.execute(getCommandContext())
}
}

0 comments on commit fef63b6

Please sign in to comment.