-
Notifications
You must be signed in to change notification settings - Fork 80
ml gradle 1 tasks
The tasks below only appear in ml-gradle 1.* releases. That version of ml-gradle uses the Packaging REST API, and thus most of these tasks involve packages. ml-gradle 2.* and beyond use the Management REST API and thus do not have these tasks.
The mlDeploy task combines several tasks together to perform a typical deployment process. Those tasks are:
- mlClearModules - if the application exists, clear its modules database; otherwise do nothing
- mlInstallPackages - installs the application packages
- mlPostInstallPackages - an empty "hook" task for adding tasks via its dependsOn attribute
- mlLoadModules - loads all of the modules
- mlPostDeploy - an empty "hook" task for adding tasks via its dependsOn attribute
You don't need to use mlDeploy - you're free to write your own Gradle task to orchestrate your deployment process. mlDeploy exists as a useful starting point that you can extend via the mlPost* tasks that it calls.
gradle mlInstallPackages
This task corresponds to the InstallPackagesTask.groovy class, and it is installed by MarkLogicPlugin. It provides a basic recipe for installing a typical set of MarkLogic resources:
- A database and optional test database is installed (with the forests being automatically installed). These databases can optionally be defined via a database package file, which is a property of the ManageConfig object that is inserted under "mlManageConfig".
- A REST server and optional test REST server is installed.
- An XDBC server and optional test XDBC server are installed. These are mostly intended to support operations involving ingesting data (e.g. via MLCP) and fiddling with the database in a JUnit test.
You can run this task repeatedly without breaking anything.
You typically won't call this directly, but rather you'll call "gradle mlDeploy" which will call this task.
Reasons why this task would fail:
- ML will reject invalid package files. If you try to install a bad one, the ML error log should have a helpful error message for you.
- If your package has a server package file in it that tries to use a port already in use, the install will fail.
- "mlUninstallApp" has a bug in it where the forest backing the content database isn't always deleted. If you run "mlUninstallApp", and the forest isn't deleted, and then you run "mlInstallPackages", you'll get another helpful error message. In this situation, you'll need to manually delete the forest via the admin UI.
gradle mlMergeDatabasePackages
The purpose of this task is to merge two or more database package files together. This provides an easy way of sharing package files and avoiding duplication between them.
This task requires a list of file paths to be provided. It then uses "default-content-database.xml" as a starting point, and then uses "content-database-transform.xsl" to merge in each of the packages at the given file paths (both of these files live in the ml-app-deployer project). Since this task is registered by MarkLogicPlugin, you can configure it in the following manner:
ext {
mlAppConfig {
databasePackageFilePaths = ["package1.xml", "package2.xml"]
}
}
You typically won't invoke this task directly - that's because all it does is produce a merged file. Instead, you'll want other tasks to depend on this task - e.g. any tasks that will install the database package. By default, MarkLogicPlugin makes mlUpdateContentDatabase and mlInstallApp depend on this task.
See the writeup on merging database packages above - this is nearly identical, except for the following:
- This is implemented by MergeHttpServerPackagesTask
- The default HTTP package file is "default-http-server.xml"
- The XSL is "http-server-transform.xml"
You can configure the server package files to be used like this:
ext {
mlAppConfig {
httpServerPackageFilePaths = ["package1.xml", "package2.xml"]
}
}
One other note - if you intend to customize your HTTP server, you'll almost always needs to ensure that "mlUpdateHttpServers" is invoked as part of your deployment process. The REST API for creating REST API servers doesn't allow for a package file to be specified. Thus, you'll normally have the following sequence:
- Create a REST API server
- Create a merged HTTP server package file (via this task)
- Upload the merged package file and re-install your MarkLogic package (via mlUpdateHttpServers)
Adding mlUpdateHttpServers to mlDeploy can be done via the mlPostDeploy hook:
mlPostDeploy.dependsOn mlUpdateHttpServers