Quick Start JBoss User Guide v3.x

Introduction

The document is a guide to show how to demonstrate the JBoss capabilities of the product – to install RedHat JBoss, to configure an application server and some resources like a datasource and to deploy a sample application – the Java Petstore.

It uses the in-built Hypersonic in memory database, but in a live scenario, the data would be persisted to a RDBMS such as Oracle or DB2.  Details of how to configure the application to use these databases can be found in the installation guide.

The instructions in this demonstration uses a remote agent to connect to the target server (in this case localhost).  However a target server can be configured to connect using SSH.  Details of how to do this can be found in the MidVision RapidDeploy User Guide.

The document is intended for use by experienced middleware (including JBoss Application Servers) system administrators and therefore users are expected to possess the core capabilities required to manually administer environments.

This user guide is supplemented by the MidVision on-line media including quick-start video guides, all of which can be accessed from www.midvision.com

Download and install the RapidDeploy application

Download the latest RapidDeploy from one of the link below, check you select the correct version of your operating system:

Unzip the file to an installation directory, e.g.  “/var” for linux or “C:\” for windows.

This will create a directory called midvision.  This location will now be referred to as $MV_HOME, e.g. “/var/midvision” for linux or “C:\midvision” for windows.

Edit the remote agent orchestration file.

If you plan to use a remote agent to run the deployments on the target servers then you will need to edit the remoting server file, putting in the host name of the server it will accept deployment requests from.  Find the hostname of the machine you have installed the application to then type hostname from a command prompt.

e.g:

Windows Linux
C:\Users\user1>hostname [root@cloud ~]# hostname
user1-MV cloud.server.com

Goto $MV_HOME/remoting and edit the file midvision-remoting-server.xml.  On line 43 change line:

<resource type=”auth.servers”>gui@localhost</resource>

To gui@hostname e.g.

<resource type=”auth.servers”>gui@user1-MV</resource>

Start the server and the remoting agent.

Goto $MV_HOME/bin and the run the start-up scripts to start the web app and the remote agent.

Windows Linux
start-web-app.bat start-web-app.sh
start-remoting-server.bat start-remoting-server.sh

Wait until you see “INFO: Server startup in“ in the output logs of the tomcat console and then go to http://localhost:9090/MidVision.  You will be presented with a license page.  Request a trial license from MidVision by emailing licensing@midvision.com.  Once you have been emailed the license, enter the values on the screen and you will then be presented with the login page.  Enter the default username “mvadmin” and the default password “mvadmin” then click “Login”.

Note: This demo uses a Hypersonic in-memory database.  This means if the web application process is killed from the Task Manager or a “kill” command then all data will be lost.  To ensure that your data is stored to a file when the application is stopped, run the “stop-web-app.sh” or “stop-web-app.bat” script which is in the $MV_HOME/bin directory.

Use the Plugin Manager to Install the JBoss Demo

Ensure the web application is started.  Go to “Help / Plugin Manager” the “Available Plugins / Patches” tab.  Click the “Install” button on the “JBoss Example App” Plugin and then “Yes” to confirm, the project files will be downloaded to the $MV_HOME/projects directory.  Once the download is complete the plugin will appear in the “Installed Plugins / Patches” tab.

Alternatively, download the latest zip file from  http://www.midvision.co.uk/wordpress/dnld/plugins/demo_projects_310/rapiddeploy-demo-projects-3.1.0-jboss.zip and unzip in the root of your RapidDeploy installation (MV_HOME).

Configure the Resources.

Create the Projects

Go to “Resources/Projects/Add Project” then enter the following information (remember to change $MV_HOME with the actual location).

Field Value
Name JBOSS_BINARY_INSTALL
Description JBOSS_BINARY_INSTALL desc
Owner mvadmin
Deployment Type binaryInstall
Collection Type JBOSS_AS_60
Log Directory $MV_HOME/logs
Project Root Directory $MV_HOME/projects/JBOSS_BINARY_INSTALL
Properties Directory $MV_HOME/projects/JBOSS_BINARY_INSTALL/j2ee/config
Build Store $MV_HOME/buildstore
Promotion Store $MV_HOME/promotionstore
Deployment package search string jboss-as
Properties file identifier conf
Master in Database True (selected)

Then click “Create”. Now add another project.

Field Value
Name JBOSS_60_DEPLOY
Description JBOSS_60_DEPLOY desc
Owner mvadmin
Deployment Type codeDeploy
Collection Type JBOSS_AS_60
Log Directory $MV_HOME/logs
Project Root Directory $MV_HOME/projects/JBOSS_60_DEPLOY
Properties Directory $MV_HOME/projects/JBOSS_60_DEPLOY/j2ee/config
Build Store $MV_HOME/buildstore
Promotion Store $MV_HOME/promotionstore
Deployment package search string JBOSS_60_DEPLOY
Properties file identifier conf
Master in Database True (selected)

Then click “Create”.

Now edit the project named JBOSS_60_DEPLOY and then click “Discover” and click “Ok” to confirm.

This will search the project configuration directory and look for the environment definition files and create any servers, environment, instances and deployment components it finds in to the application database.  The environments are defined by the file names defined in the project properties directory.  The structure of the environment filename is this:

SERVER.ENVIRONMENT.INSTANCE.APPLICATION

In a JBoss context this relates to:

SERVER.JBOSS_INSTALLATION.SERVER_PROFILE.APPLICATION

As the project JBOSS_60_DEPLOY has a pre-configured environment definition, the discovery will create a new server named “localhost”, a new environment named “jboss60” and a new instance named “all”.  We will now configure the connection details to the server so we can install JBoss and later on we will configure the environment and the instance.

Configure the Server

Goto “Resources/Targets/Servers” then edit the server named localhost. Edit these fields (remember to change $MV_HOME with the actual location):

Field Value
General Tab  
Display Name localhost
Hostname 127.0.0.1
Build Store: $MV_HOME/buildstore
OS Type: <Select your OS type>
Version: <Set your OS version>
Allow Deployments: True
Connection timeout (ms): 2000000
Remoting Tab  
Agent Enabled for deployments: True
Agent Enabled for discovery: True
Remote Agent Port: 20000
Agent Path:  

Then click “Save”.

Click edit on the server named “localhost” and then click “Test Agent” and click “Yes” to confirm.  The application will then check it can communicate with the remote agent.  You should see the following output:


Test Success
The test connection completed successfully.

If the test was successful.

Configure the JBoss Installation Directory

In this section we define the file path that JBoss will be installed into on the target server.

Go to “Resources / Targets / Installations” then click “Add Environment Installation”.

Enter these fields (remember to change $JBOSS_HOME with the actual location you want to install JBoss to, the default value for this demonstration example is “C:/temp/apps/jboss60”):

Field Value
Installation Path $JBOSS_HOME
Server localhost

Then click “Create”.

Install JBoss

Now you have defined a server and an installation directory you can install JBoss to your target server at the location specified.  But first you need to download the JBoss binary file and add it to the $MV_HOME/buildstore directory otherwise you will not have a package to install.  Get version 6.1.0 from this location http://download.jboss.org/jbossas/6.1/jboss-as-distribution-6.1.0.Final.zip and save it into your buildstore directory.

Now start the install job.  Go to “Job / New Job”.  Select the project JBOSS_BINARY_INSTALL the open the server tree and select the EnvironmentInstallation you created in the earlier step, then click “Next”.

Select the version (which is the file you have copied to the buildstore).   Then select “Skip to finish” and then click “Next”. Click “Execute Request” then click “Yes” to confirm.  JBoss will start to install in the target server.  You can click the “View Progress” button on the job and you should see the deployment log files.

In this binary installation the following tasks are executed:

  1. Delete the directory
  2. Make the directory
  3. Check there is at least 500Mb of free space on the target server at the directory.
  4. Check the directory is writable
  5. Install JBoss to the directory.

When the job has finished you will see the text:

“Job Finished: Deploying jboss-as-distribution-6.0.0.Final.zip into server localhost”

You can go to “Jobs / Previous Jobs” and you can download and view the log file of the complete deployment.

Snapshot a JBoss Server Profile

Now JBoss has been installed we can take a snapshot of the default configuration to use as a control when configuration changes are made.

Configure the Environment (JBoss installation – all profiles)

Go to “Resources / Targets / Environments” edit the environment named “jboss60”. Enter the following values (remember to change $JBOSS_HOME with the actual location):

Field Value
General Tab  
Display Name Jboss60
Parent Server display name localhost
Owner mvadmin
Software Product: JBoss Application Server
Environment Type: Unknown
Software Version: 6.1.0
Binary Path: $JBOSS_HOME
Connectivity Tab  
Admin Port: 1199
Connection String:  
Environment Admin Username: Admin
Environment Admin Password: Admin

Then click save.

Configure the Instance (JBoss single server profile)

Go to “Resources / Targets / Instances” edit the instance named “all”. This is the name of the server profile that we will snapshot.  It is an out of the box profile.  JBoss also creates profiles called “default”, “jboss-standalone”, “minimal” and “standard”.  In this demonstration example we are using the profile named “all”.  Enter the following values (remember to change $JBOSS_HOME with the actual location):

Field Value
General Tab  
Instance Name all
Parent Environment name: jboss60
Parent Server display name localhost
Owner mvadmin
Collection Type: JBOSS_AS_60
Software Version: 6.1.0
Binary Path: $JBOSS_HOME
Allow deployments True
Connectivity Tab  
Hostname  
Port: 1199
Username: Admin
Password: Admin
Alias:  

Then click Save.

Take a Server (Instance) Snapshot

Now we will take a snapshot of the version of JBoss that has just been installed.  It is a “vanilla” version of the configuration, which will be used to compare against in the future.

Go to “Resources / Targets / Instances” edit the instance named “all“.  Then click “Snapshot” then click “Yes” to confirm.  The snapshot will be requested.  You can go to “Jobs / Executing Jobs” and see the log output of the snapshot.

Deploy Configuration and an Application to the JBoss Server

Firstly we need to edit the environment configuration to check the environment variables we are going to use to start the server in and where JBoss is installed for this logical environment.

Go to “Environment / Edit / Promote” the select the project JBOSS_60_DEPLOY, then click the “Edit Environment Configuration” button.

Go to “Properties / Instance Configuration”

Enter the following values (remember to change $JBOSS_HOME with the actual location):

Key Value Format
SERVICE_BINDING_SET ports-01 Plain Text
TEMPLATE_PATH j2ee/TEMPLATE/jboss60 Plain Text
INSTALL_PATH $JBOSS_HOME Plain Text
ADMIN_PORT 1199 Plain Text
BINDINGS 0.0.0.0 Plain Text
USERNAME admin Plain Text
PASSWORD @@ADMIN_PASSWORD@@ Plain Text

Go to “Properties / Text Search Replace”

Ensure the following values exist:

Key Value Format
<context-root>jpetstore</context-root> <context-root>demo</context-root> Plain Text

Go to “Properties / Instance Variables”

Enter the following values (remember to change $JAVA_HOME with the actual location of the SUN Java Home directory on the target server):

Key Value Format
JAVA_OPTS -Xms256m –Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 Plain Text
JAVA_HOME $JAVA_HOME Plain Text

Go to “Dictionary / Data Dictionary”

Ensure the following values (admin password value is defaulted to “admin”) are set:

Key Value Format
@@DERBY_JNDI_NAME@@ jdbc/localDB Plain Text
@@ADMIN_PASSWORD@@ ******** Password

At this point you can view the project files by clicking “Resources / Files”.  Here you can view, edit, delete and upload project environment files.

Create a Deployment Package

Now the logical environment settings have been checked  we need to create a deployment package from the contents of the project.

Go to “Resources / Software Management / Packages” then select the project JBOSS_60_DEPLOY.  Now click “Add Package Wizard”.  Enter the name JBOSS_60_DEPLOY_0_0_1 the select “Click to finish”, then click “Next”.  Click “Create This Deployment Package” and click “Yes” to confirm.  When the deployment package has been created you will see this message:

Success

The object: JBOSS_60_DEPLOY.jar was created.

Deploy the Package.

Go to “Jobs / New Job” then select the project JBOSS_60_DEPLOY, then open the server, environment, instance and select the application “exampleApp” then click “Next”.  Now select the version, which is the deployment package you have just created, select “Skip to finish” then click “Next”. Click “Execute Request” then click “Yes” to confirm.  This will start to deploy the package.

The steps taken in this deployment are:

  1. Stop JBoss if is it running (use JMX to check if it is running).
  2. Sleep for 5 seconds
  3. Expand the EAR file and any WAR files within it to a temporary directory.
  4. Do a text search replace on all of the project and expanded files.  This will change the context root of the web app from jpetstore to demo.  It will also change the data source JNDI Name in the XML definition file.
  5. Collapse the WAR file and EAR files back into a EAR file.
  6. Copy over the JAR files and XML definition file required for a Derby datasource to the server.
  7. Copy the modified EAR file to the server.
  8. Start JBoss overriding the JAVA_HOME and JAVA_OPT settings (which contains the JVM Heap size settings).
  9. Sleep for 10 seconds
  10. Finish.

Once the job has completed you can view the deployment log file from the Previous Jobs section.

Test the JBoss Server is Running

Go to http://localhost:8180 and view the default JBoss page.

Click on the “Administration Console” link and wait for the admin console to load (this can take a minute or two).  Enter admin for the username and admin for the password then view the new data source and the new Enterprise application in the JBoss console.

To test the enterprise application, go to http://localhost:8180/demo and you should see the demonstration pet store application running.  The back end HSQL database for this demo has not been started so if you click too far into the application it will display an error message stating the application cannot connect to the database.

Snapshot and Compare the Configuration

Take Another Snapshot.

Go to “Resources / Targets / Instances” edit the instance named “all“.  Then click “Snapshot” then click “Yes” to confirm.  The snapshot will be requested.  You can go to “Jobs / Executing Jobs” and see the log output of the snapshot.

Compare the Snapshots

Go to “Environment / Environment Comparison”, click on “Snapshot Comparison”.  Enter “5” into the “Comparison Context size (optional 1-50):” field.  This will display 5 lines above each difference and 5 line below, to give the comparison some context.  If you leave this field blank it will display the complete XML, which can be quite large.  Then select snapshot with ID 2 for the left side and snapshot with ID 1 for the right side, then click “Compare”.

You should see the configuration differences from the “Vanilla” server to the changed server.

Conclusion

In this JBoss demonstration we have configured two RapidDeploy projects, one binary installation project and one deployment project.  The binary project was executed and JBoss was installed onto the remote target using a remote agent.  RapidDeploy connected to the agent then copied over the binary package, the orchestration XML definition and the log4j settings file.  The remote agent then executed the orchestration on the target server.

Once JBoss was installed we configured RapidDeploy settings for the environment and instance which then allowed us to take a snapshot of the profile named “all”.  This was used as a control snapshot.

Next we edited the project environment definition files with the settings to the target server instance of JBoss and created a deployment package from the JBoss deployment project.  This package was then executed on the target server (again using the remote agent).

We validated that the JBoss server was running and the data source and the enterprise application had been deployed to the server.

Finally we took another snapshot of the JBoss profile and compared the differences in the configuration from the earlier snapshot.

This guide should hopefully introduce the reader to simply use RapidDeploy to connect to a target server and run JBoss orchestrations on the target.  The projects and environment definitions can be cloned and easily updated to connect to your own target systems and JBoss instances.  There are many other orchestration tasks that are not discussed in this guide which allows the reader to create custom tailor-made orchestrations.

Did you find the guide "JBoss User Guide For RapidDeploy" useful?

View Results

Loading ... Loading ...

Leave a Reply