# Grove-ml-gradle

This Grove app is meant to support configuration of MarkLogic databases, app-servers, users, roles, etc. It also supports deployment of application code, and import of content.

## System requirements

The following someware must be pre-installed:

- [MarkLogic Server 7.0-1 or later](https://developer.marklogic.com/products) - The MarkLogic database, and target of configuration
- [Oracle/Sun Java JRE 1.8 or later](http://www.oracle.com/technetwork/java/javase/downloads/index.html) - Run-time for running Gradle

Also used, but downloaded and installed automatically:

- [MarkLogic Content Pump](https://developer.marklogic.com/products/mlcp) - MarkLogic data import tool (included via Gradle)
- [Gradle 4.8](https://gradle.org/) - Build tooling for the Java ecosystem (included using gradle-wrapper)
- [ml-gradle](https://github.com/marklogic-community/ml-gradle): The actual MarkLogic configuration deploy tool (included via Gradle)

## Quick Start (for the Impatient)

On Mac or Linux:

    ./gradlew mlDeploy
    ./gradlew loadSampleData

On Windows:

    gradlew.bat mlDeploy
    gradlew.bat loadSampleData

## Setting up the target enviroment

This deployment tool has been configured to look inside `gradle.properties` for the default settings. Next to that, it will look for environment specific settings via the `environmentName` variable. Adding `-PenvironmentName=dev` to any gradle call will cause the tool to look for a `gradle-dev.properties` for overrides or extra settings. The `environmentName` variable defaults to `local`, so by default any gradle call will look for `gradle-local.properties`.

Note: `gradle-local.properties` is gitignored by default, use it for settings specific to your own development environment, like your personal laptop.

## Deploy your Application

Run the following ml-gradle commands to deploy the application to the chosen MarkLogic
installation. It will create and configure databases, REST servers, users, and
roles for you, and deploy the back-end application code.

    ./gradlew mlDeploy -PenvironmentName=[local|dev|prod]

Or on Windows:

    gradlew.bat mlDeploy -PenvironmentName=[local|dev|prod]

## Loading Sample Data (optional)

The application comes with 3000 JSON documents generated by json-generator.com. They
will allow you to explore all the features you get out of the box in a better way. You
can load them with (MLCP)[https://docs.marklogic.com/guide/ingestion/content-pump] using
ml-gradle.

    ./gradlew loadSampleData

Or on Windows:

    gradlew.bat loadSampleData
