Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Command line interface

rjrudin edited this page Feb 28, 2018 · 8 revisions

Ticket #244 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.

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:

Usage: java -jar <name of jar> [options] [command] [command options]

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
Clone this wiki locally