-
Notifications
You must be signed in to change notification settings - Fork 20
Command line interface
Version 3.5.1 adds support for a command line interface (CLI) for ml-app-deployer. This uses JCommander to parse command line arguments and determine which ml-app-deployer command or set of commands to invoke. You simply run "java -jar" against an executable jar that contains the ml-app-deployer code and all of its dependencies, as shown below. Releases of this executable jar can be downloaded from the releases page. Comments/bugs/feature requests are welcome - please create a new issue to help improve this!
Assuming a jar name of "deployer.jar", you can run it as an executable jar with no arguments to get usage information:
java -jar deployer.jar
This lists all of the supported options and commands. Note the syntax for including options and commands - the options come first (currently none of the commands support command options, so the command will always be the last argument):
Usage: java -jar <name of jar> [options] [command] [command options]
In version 3.6.0, you can also see all of the supported properties:
java -jar deployer.jar -p
The simplest thing possible, requiring no resource files, is to run the "mlDeploy" command, which will create a new REST application (server + content database + modules database):
java -jar deployer.jar mlDeploy
Of course, you typically want to set some properties to configure an application before deploying it. All properties defined by the ml-gradle Property Reference can be included via the "-P" option, mimicking Gradle's behavior:
java -jar deployer.jar -PmlAppName=example -PmlRestPort=8005 mlDeploy
In the example above, there are two options - -PmlAppName and -PmlRestPort - and a command - "mlDeploy". As noted above, options must precede the command.
Each command looks for resource and module files in the default locations as defined by the ml-gradle Project Layout page. You can override this using the mlConfigPath property:
java -jar deployer.jar -PmlConfigPath=path/to/my/stuff mlDeploy
Adding an option for every "ml*" property can be tedious. It can be easier to add them to a regular Java properties file without the "-P" option and then refer to that file:
java -jar deployer.jar -f my.properties
"my.properties" can then contain as many properties you want, along with comments:
mlAppName=example
# Hopefully this port is free!
mlRestPort=8005
Commands are executed by default. To undo a command, include "-u". For example, the following will deploy roles:
java -jar deployer.jar mlDeployRoles
Whereas this will undeploy the roles:
java -jar deployer.jar -u mlDeployRoles
The jar uses Logback for logging, and it defaults to info-level logging. This can be adjusted via the "-i" option:
java -jar deployer.jar -i DEBUG mlDeploy
java -jar deployer.jar -i WARN mlDeploy