WildFly CLI Deployment Operations: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 198: Line 198:


  deploy ''<file-path>'' --disabled
  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,


==Deployment of a Newer Version of an Existing Artifact to the Domain==
==Deployment of a Newer Version of an Existing Artifact to the Domain==


The new version of the artifact is not known to the repository, so the path to the file must be specified in the "deploy" command.
The new version of the artifact is not known to the repository, so the path to the file must be specified in the "deploy" command.

Revision as of 15:33, 20 September 2017

External

Internal

Overview

Deployments are executed with the deploy command.

Undeployments are executed with the undeploy command.

In-line usage details can be obtained with:

deploy --help
undeploy --help

deploy/undeploy interact with domain/AS instance's Deployment Artifact Repository.

Examples

Deployment of an Artifact that Has Not Been Deployed Yet

jboss-cli.sh -c 'deploy ./path/to/example.war --server-group=web'

Deployment of an Artifact that Has Been Deployed Previously

jboss-cli.sh -c 'deploy ./path/to/example.war --force'

Undeployment

jboss-cli.sh -c 'undeploy example.war --all-relevant-server-groups'

domain.xml Modifications

...
    <deployments>
        <deployment name="servlet-example.war" runtime-name="servlet-example.war">
            <content sha1="b4bcac8f15c72e964076680932b0989675078889"/>
        </deployment>
    </deployments>
...

Deploy Usage

deploy 
    (file_path [--script=script_name] [--name=deployment_name] 
                   [--runtime-name=deployment_runtime_name] 
                   [--force | --disabled] [--unmanaged]
    )
    | 
    --name=deployment_name  
   [--server-groups=group_name (,group_name)* | --all-server-groups] 
   [--headers={operation_header (;operation_header)*}]

deploy deploys the application designated by the file_path or enables an already existing but disabled deployment.

If executed w/o arguments, will list all the existing deployments.

Example:

deploy /tmp/test-servlet.war --name=mp-franklin.war --runtime-name=mp-franklin.war --force
deploy ??? --server-groups=active-hq-nodes


file_path

Absolute or relative. Not required if the deployment already exists in the artifact repository.

--name

The unique name of the deployment. If the file path argument is specified the name argument is optional, the file name is the default value.

--runtime-name

Optional argument. The runtime name for the deployment. This will form the basis for default Java EE application and module names. If not specified the value used for --name will be used.

There are cases when users may wish to have two deployments with the same runtime-name (two versions of application) both available in the management configuration, in which case the deployments would need to have distinct name values but would have the same runtime-name. Within an individual server, only one deployment with a given 'runtime-name' can deployed. However, multiple deployments with the same runtime-name can exist in the configuration, so long as only one is enabled.

--force

If the deployment with the specified name already exists, by default, deploy will be aborted. --force (or -f) will force the replacement.

--disabled

Indicates that the deployment has to be added to the repository disabled.

--unmanaged

If this argument is not specified, the deployment content will be copied (i.e. uploaded) to the server's deployment repository before it is deployed.

If the argument is present, the deployment content will remain at and be deployed directly from its original location specified with the file_path.Exploded deployments are supported only as unmanaged.

--server-groups|--all-server-groups

Comma separated list of server group names the deploy command should apply to. Either --server-groups or --all-server-groups is required in the domain mode. This argument does not apply to standalone mode.


The second deployment attempt will complain if the same artifact is deployed in succession, with two commands, on one server group then on another.

-l

Without arguments deploy will print all of the existing deployments in the repository. The presence of the -l switch will make the existing deployments printed one deployment per line, instead of in columns (the default).

--headers

A list of operation headers separated by a semicolon.

--script

Used only if the file_path points a CLI archive. The value is the name of the script contained in a cli archive to execute. If not specified, defaults to 'deploy.scr'. The deploy command will execute the script given by the --script argument. All paths in the scripts are relative to the root directory in the cli archive. The script is executed as a batch.

Undeploy Usage

    undeploy name [--server-groups=group_name (,group_name)* |
                   --all-relevant-server-groups] [--keep-content]
                  [--headers={operation_header (;operation_header)*}]

Undeploys the deployment with the given name and, depending on the arguments, removes its content from the repository.

If the deployment name isn't specified, prints the list of all the existing deployments.

name

The name of the deployment to undeploy.

--server-groups|--all-relevant-server-groups

Cmma separated list of server group names the undeploy command should apply to. Either --server-groups or --all-relevant-server-groups is required in the domain mode.

--keep-content

By default undeploy, besides disabling the deployment, also removes its content from the repository. The presence of --keep-content will only disable the deployment without removing its content from the repository.

-l

Same as deploy -l.

--headers

Same as deploy --headers.

--path

Same as deploy --path.

--script

Can appear only if the file_path points a cli archive. The value is the name of the script contained in a cli archive to execute. If not specified, defaults to 'undeploy.scr'. All paths in the scripts are relative to the root directory in the cli archive. The script is executed as a batch.

List Current Deployments

See deploy -l. Also, for a standalone instance, current deployments can be listed visiting the /deployment node:

[standalone@localhost:9999 deployment] cd /deployment
[standalone@localhost:9999 deployment] ls

Standalone Mode

Domain Mode

==Listing Artifacts in the Deployment Repository=-

deploy [-l]

Deployment of a New Artifact to Server Nodes

The artifact 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, ..."

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 here: Domain Deployment Mechanics.

Deployment of a New Artifact to the Domain 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,

Deployment of a Newer Version of an Existing Artifact to the Domain

The new version of the artifact is not known to the repository, so the path to the file must be specified in the "deploy" command.