Skip to content
rjrudin edited this page Jun 16, 2015 · 11 revisions

Deploy an application

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.

Install application packages

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:

  1. 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".
  2. A REST server and optional test REST server is installed.
  3. 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:

  1. 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.
  2. If your package has a server package file in it that tries to use a port already in use, the install will fail.
  3. "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.

Merging database packages

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.

Clone this wiki locally