WildFly CLI Deployment Operations

From NovaOrdis Knowledge Base
Revision as of 16:20, 21 September 2017 by Ovidiu (talk | contribs) (→‎Deployment of New Repository Content to Server Nodes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

Overview

Deployments and upgrades are performed in CLI with deploy command. Undeployments are triggered by the undeploy command. Both commands come with in-line help:

deploy --help
undeploy --help

The concepts behind deployment operations in standalone and domain mode are explained in

Deployment Concepts

Standalone Mode

TODO

Domain Mode

Listing Artifacts in the Deployment Repository

deploy [-l]

Also, for both standalone and domain instances, the content of the artifact repository can be viewed by visiting the /deployment management model node.

Actual deployments on domain server nodes can be viewed by navigating to the corresponding management model node:

/host=<host-name>/server=<server-name>/deployment

Addition of a New Artifact to Repository and Deployment to Server Nodes

Content can be added to the deployment repository and pushed to server nodes in a single step. For new artifacts, their content is not known to the repository, so the path to the file must be specified in the "deploy" command.

deploy <file-path> <server-group-specification>

When deploying on server nodes, the server group specification is required in domain mode, and it can be either "--all-server-groups" or a comma-separated list of server group names: "--server-groups=group1, group2, ...".


Note that if a deployment is to be deployed on multiple server groups, all server groups must be specified in the same deployment command, following the --server-groups option. If the artifact is deployed to a server group first, with one command, and to another server group with a subsequent command, the second deployment attempt will complain.

deploy /tmp/servlet-example.war --all-server-groups

The command stores the content in the artifact repository and then immediately pushes content to server nodes, as explained in Domain Deployment Mechanics.

If the deployment on the target server nodes fails for some reason - unsatisfied dependencies, etc. the CLI issues

JBAS010839: Operation failed or was rolled back on all servers.

and the content is not added to the artifact repository.

Addition of a New Artifact to Repository

Artifacts can be placed in the repository without being pushed to server nodes, with:

deploy <file-path> --disabled

This operation will upload the content in the repository, but won't push it to any server node. To do that, the content will need to be deployed with a separate command.

Deployment of a New Repository Artifact to Server Nodes

Content that has already been added to the domain repository can be pushed to server nodes by identifying the artifact by name, and specifying the target nodes. If the content was never deployed to the server nodes, no additional deploy command options are needed:

deploy --name=<artifact-name>  <server-group-specification>
deploy --name=servlet-example.war --server-groups=group1

Note that the existing artifact was previously deployed on at least one of the nodes specified as target, a deployment error will occur:

[domain@localhost:9999 /] deploy --name=servlet-example.war --all-server-groups
{"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => "JBAS014803: Duplicate resource [
    (\"server-group\" => \"group1\"),
    (\"deployment\" => \"servlet-example.war\")
]"}}

Upgrade of an Artifact in Repository and All Server Nodes on which the Old Version was Deployed

A new version of an existing artifact can be added to the deployment repository and pushed to server nodes that are already running the current version of the artifact as part of one atomic operation. The path of the file containing the new version of the artifact must be specified in the "deploy" command.

deploy --force <file-path> 
deploy --force /tmp/servlet-example.war

This operation updates the content in the repository, by placing the content under a different location, as the hash of the artifact is different, and pushes the content to the servers nodes on which the artifact was already deployed.

It is not possible to specify a different target server group as part of an upgrade operations:

[domain@localhost:9999 /] deploy --force /tmp/servlet-example.war --all-server-groups 
--force only replaces the content in the deployment repository and can't be used in combination with any of --disabled, --server-groups or --all-server-groups.

More details on concepts behind a domain deployment are available in Domain Deployment Mechanics.

Undeployment

undeploy example.war --all-relevant-server-groups