Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Latest commit

 

History

History
84 lines (57 loc) · 4.11 KB

jboss6.md

File metadata and controls

84 lines (57 loc) · 4.11 KB

Deploy applications to JBoss EAP 6

There are two options to deploy WAR and EAR file to JBoss Enterprise Application Platform (EAP) 6:

  1. You can invoke a shell script on a Linux build agent to scp the application to the server, and then deploy with JBoss Command Line Interface (CLI);
  2. Or you can use SSH and Copy Files Over SSH tasks to accomplish this task.

Deploying from Linux build agent

Prereqs

  1. JBoss 6 EAP installed and configured
  2. Linux machine with cross platform build agent for Team Foundation Server. For detailed instructions check this guide
  3. SSH and SSH Pass configured

Example SSH Script

The example bellow use SSH connection to connect in target machine and execute the JBoss CLI commands. The steps required are:

  1. Create temp directory
  2. Copy files (Artifact) to temp directory
  3. Running jboss-cli.sh to undeploy old version
  4. Running jboss-cli.sh to deploy new version of WAR file
  5. Runnig jboss-cli.sh for check deployment status
!/bin/bash
echo "Deployment JBOSS..."

PACKAGETEMP=/tmp/package

echo "Creating temp dir"
sshpass -p P@ssw0rd ssh root@127.0.0.1 'mkdir -v $PACKAGETEMP'

echo "Copy files to target server"
sshpass -p P@ssw0rd scp -r -v $AGENT_RELEASEDIRECTORY/JavaBuild/Drop root@127.0.0.1:$PACKAGETEMP/hello.war

echo "Running undeploy command"
sshpass -p P@ssw0rd ssh root@127.0.0.1 '/opt/EAP-6.0.1/jboss-eap-6.0/bin/jboss-cli.sh --connect --controller=127.0.0.1 --user=admin --password=P@ssw0rd --command="undeploy hello.war --server-groups=HelloWorld"'

echo "Running deploy command"
sshpass -p P@ssw0rd ssh root@127.0.0.1 '/opt/EAP-6.0.1/jboss-eap-6.0/bin/jboss-cli.sh --connect --controller=127.0.0.1 --user=admin --password=P@ssw0rd --command="deploy $PACKAGETEMP/hello.war --server-groups=HelloWorld"'

echo "Check deployment status"
sshpass -p P@ssw0rd ssh root@127.0.0.1 '/opt/EAP-6.0.1/jboss-eap-6.0/bin/jboss-cli.sh --connect --controller=127.0.0.1 --user=admin --password=P@ssw0rd --command="deployment-info --name=hello.war"'

Add the shell script in source control, or share folder.

Configure Team Foundation Server

Create new release definition add add the task Shell script and enter the path for shell script

Check the configuration bellow:

Shell Script Configuration

Running new release and check the log events

Log Events

Deploy using built-in SSH and Copy Files Over SSH tasks

Prereqs

  1. JBoss 6 EAP installed and configured
  2. Create a SSH service connection endpoint with credentials that has permission to run jboss-cli.sh script

Configure Copy Files Over SSH task

scp task

  1. Select the predefined SSH endpoint.
  2. Copy the application file to the remote server

Configure SSH task

ssh task

  1. You can define any secret variables, such as the password, in the variables tab, and reference it in the script.

Running the definition and check log events:

task logs

Learn more

To learn more about JBoss EAP 6 CLI commands, please check this guide.

For detailed instructions on setting up a release definition, check out this guide.

Check out this guide for an overview of extensions of Visual Studio Team Services.

For detailed instructions on how to get and install extensions, check out this guide