Hello, We will be discussing following in this blog:

1) Application Deployment (Standalone) from Command line (using CLI )

2) Application Deployment (Domain) from Command line (using CLI)

Application Deployment (Standalone) from Command line

 

You must first connect to host controller to manage application.

EAP_HOME/bin/jboss-cli.sh –connect –controller=<Host_Controller Host>:<port>

./jboss-cli.sh --connect --controller=192.168.13.56:9999

 Deploy an application

To deploy an application you need to use the below deploy command and give the full path with the application which has to be deployed.

deploy /<PATH>/testwar.war

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[standalone@192.168.13.56:10999 /] deploy /opt/app/testwar.war
Undeploy an applicaiton

To undeploy an application you need to use the below undeploy command with the deployed application name.

undeploy testwar.war

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[standalone@192.168.13.56:10999 /] undeploy testwar.war
Deploy an application which is disabled

If you want to deploy an application but do not want to enabled then you can use the below command

deploy /<PATH>/testwar.war –disabled

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[standalone@192.168.13.56:10999 /] deploy /opt/app/testwar.war --disabled
Enable the already deployed application

If you want to enable the application which is already been deployed you can use the below command.

deploy –name=testwar.war

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[standalone@192.168.13.56:10999 /] deploy --name=testwar.war

Note: Make sure you given the –name or else you JBoss will assume it’s a new application.

 

 

Disable the application BUT without removing it

If you want to just disable the deployed application and do not want to remove it you can use the below command

undeploy testwar.war –keep-content

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[standalone@192.168.13.56:10999 /] undeploy testwar.war --keep-content

Note: Make sure you have given –keep-content or else the application would be removed.

 

 

Enter “quit” or “q” to exit the command line prompt

[standalone@192.168.13.56:10999 /] quit
[myuserID@MYMACHINE bin]$

 

 

 

Application Deployment (Domain) from Command line

 

When trying to deploy an application in domain mode then it becomes little bit tricky as we are dealing with multiple servers at a time.

 

You must first connect to host controller to manage application.

EAP_HOME/bin/jboss-cli.sh –connect –controller=<Host_Controller Host>:<port>

./jboss-cli.sh --connect --controller=192.168.13.56:9999   

 

 

Deploy an application to all server groups

If you want to deploy an application to all server groups you can use deploy command with path of the application and “–all-server-groups” option

deploy /<PATH>/testwar.war –all-server-groups

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[domain@192.168.13.56:10999 /] deploy /opt/app/testwar.war --all-server-groups
Undeploy an application from all server groups

If you want to undeploy an application from all server groups you can use the below command

undeploy testwar.war –all-relevant-server-groups

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[domain@192.168.13.56:10999 /] undeploy testwar.war --all-relevant-server-groups

 

Undeploy from a particular server group

If you want to undeploy an application from a particular server groups you can use the below command

undeploy testwar.war –server-groups=<Server_Group> –keep-content

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[domain@192.168.13.56:10999 /] undeploy testwar.war --server-groups=main-server-group --keep-content

 

 

Deploy to a particular server group

If you want to deploy an application from a particular server groups you can use the below command which has the option –server-groups

deploy /<PATH>/testwar.war –server-groups=<Server_Group>

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[domain@192.168.13.56:10999 /] deploy /opt/app/testwar.war --server-groups=main-server-group

 

 

Deploy the same application to other server group

Now if the application is already been deployed to one server group and you want it to deploy the same application on the other server group you can do it using the below command.

deploy –name=testwar.war –server-groups=<Server_Group>

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999
[domain@192.168.13.56:10999 /] deploy --name=testwar.war --server-groups=main-server-group

 

 

Deploy an application which is disabled

If you want to deploy an application but do not want to enabled then you can use the below command

deploy /<PATH>/testwar.war –disabled

[myuserID@MYMACHINE bin]$ ./jboss-cli.sh --connect --controller=192.168.13.56:10999

[domain@192.168.13.56:10999 /] deploy /opt/app/testwar.war –disabled

We are done 🙂

Please do comment for any queries or suggestions. And please dont forget to like our page to get updates on my latest blogs.

 

 

Author

12+ Year IT professional SME with expertise in Middleware, Cloud Computing & DevOps Methodology.