Quick Start Hello World User Guide

Introduction

This Quick Start User Guide v3.1 for RapidDeploy demonstrates creating, configuring and running a simple script on either a Windows or Linux/Unix box, from the RapidDeploy Web Interface,  demonstrating generic automation tasks.

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 more likely scenario is to connect to a target server using the RapidDeploy in-built SSH client. Details of how to do this can be found in the MidVision RapidDeploy User Guide.

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

This document explains how to:

  • Install the RapidDeploy Web Based GUI Application
  • Create a Project and Server definition
  • Create a deployment package including a simple hello world shell and bat script
  • Deploy the package to the defined server
  • Demonstrate passing environment specific variables and command line arguments to the script
  • Browse/Interact with some of the RapidDeploy pages

Once these projects are implemented, running the script with different parameters on the same or different servers should take only a minute per new target.

Windows/Linux: This demo project has been configured for use on Windows. However it is quite easy to convert to Linux. Look out for “Linux Configuration Tip:” throughout this guide.

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. “/midvision” for linux or “C:\midvision” for windows.

This will create a directory called midvision. This location will now be referred to as $MV_HOME, e.g. “/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 (which opens as a separate window in Windows environments), alternatively check the $MV_HOME/logs/rapiddeploy-web-app.log for the line ”RapidDeploy web application is started” and ensure there are no errors, then go to http://localhost:9090/MidVision in a web browser. (Replace localhost with your linux server hostname/IP as appropriate)

At the login page enter the default username “mvadmin” and the default password “mvadmin” then click “Login”.  You will then 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 accept the EULA.

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 Hello World Demo

Ensure the web application is started. Go to “Help / Plugin Manager” the “Available Plugins / Patches” tab. Click the “Install” button on the “Hello World 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.

Available Plugins (Click to Enlarge)

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

Configure the Resources.

Please note. If you are running RapidDeploy against an oracle database, a Sql script can be found in $MV_HOME/plugins/Hello World Example App/<VERSION> that will create all of the following resources for you. You will still need to edit each project and replace “MV_HOME” with the correct path to the RapidDeploy install directory, and run a discovery on each project by editing it and then clicking “Discover” and clicking “Ok” to confirm.

Create the Project

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

Field Value
Name HELLO_WORLD
Description HELLO_WORLD desc
Owner mvadmin
Deployment Type codeDeploy
Collection Type WAS_CLUSTER_70
Log Directory $MV_HOME/logs
Project Root Directory $MV_HOME/projects/HELLO_WORLD
Properties Directory $MV_HOME/projects/HELLO_WORLD/scripts/config
Build Store $MV_HOME/buildstore
Promotion Store $MV_HOME/promotionstore
Deployment package search string HELLO_WORLD
Properties file identifier dict
Master in Database False(not selected)

HELLO_WORLD Project (Click to Enlarge)

Now edit the project named HELLO_WORLD 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 HELLO_WORLD context this relates to:

SERVER.Unset.Unset.Unset

As the project HELLO_WORLD has a pre-configured environment definition, the discovery will create a new server named “hwserver01”, a new environment named “hwenvironment01” and a new instance named “hwinstance01”. These are not required for this demo

Orchestration Panel

It is worth looking at the project orchestration panel at this point. The Examples projects have preconfigured orchestrations, but these may be amended as desired to add or change individual task actions (from the list of around 150 on the left hand side) for this deployment. In the example below, the TOKENIZERS tree item is opened, displaying three tasks. Task actions are environment independent actions that run in sequence whenever this deployment project is run (when any deployment package based on this project is deployed).

In this case we see the LocalScriptRunner task highlighted, with its values in the “Selected Task Detail” panel.

Orchestration Panel for the HELLO_WORLD Project (Click to Enlarge)

Linux Configuration Tip: The orchestration tasks for this project will work correctly out of the box for Windows and Linux.

Note the @@SHAPE@@ etc placeholders. Thes are environment independent placeholders, detailing in this case the arguments that our script expects. We can set these on a per environment basis by using an environment specific data dictionary which we discuss later.

Configure the Server

Goto “Resources/Targets/Servers” then edit the server named wasserver01. Edit these fields (remember to change $MV_HOME with the actual location, you will also need to ensure the Build Store directory exists on your target):

Field Value
General Tab
Display Name hwserver01
Hostname localhost or a host of your choice
Build Store: $MV_HOME/remotebuildstore
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”.

Server Definition for hwserver

Click edit on the server named “hwserver01”” 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 sample target

Check configuration

Goto “Environment/ Edit/Promote” then select the HELLO_WORLD project from the drop down.

Edit/Promote panel for the HELLO_WORLD project (Click to Enlarge)

Click the edit button next to the environment.

From the menu panel, select Dictionary/Data Dictionary:

HELLO_WORLD Initial Environment Data Dictionary

Amend the values to match your chosen target.

From the menu panel, select Properties/Instance Variables:

Environment Variables for the first environment in the HELLO_WORLD project

In this case we see that required environment variables (that will be echoed by the script) are set here to dictionary items, such that the environment variables echoed will match the arguments passed into the script. These could equally be absolute values, but using dictionary items means these variables are stored in only one place.

View files associated with this project

From the menu, select “Resources” / “Files”

Browse the file tree to examine the scripts we will run. All of these files may be stored in configuration management and RapidDeply will update the CM tool as appropriate as these files are changed.

Browse HELLO_WORLD Project files (Click to Enlarge)

Create a deployment package

Goto “Resources/Software Management/Packages” then select the HELLO_WORLD project from the drop down.

Click “Add Package Wizard” button and enter “HELLO_WORLD_001″ as the package name. Check the “Skip to Finish” checkbox and click next.

Click “Create This Deployment Package” on the final tab.

HELLO_WORLD initial deployment package (Click to Enlarge)

We have now packaged our project directory, which includes the scripts we will run and the configuration for all of our targets where these scripts should run. In this case we have just one target.

Deploy the Package.

Go to “Jobs / New Job” then select the project HELLO_WORLD then open the server, environment, instance and select the application “scripts” then click “Next”.

New HELLO_WORLD Configuration Deployment Selection

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:

The following steps will:

  1. Deploy the package to the target
  2. Optionally copy the scripts to a location on the target. By default this is disabled.
  3. Run the script on the target, correctly setting environment variables and command line options depending on the target selected.Create a JMS provider

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

View the Logs

Go to “Jobs / Previous Jobs” then select the most recent job (the top one) then Click on the download button to the right of this job.

Previous Jobs for the HELLO_WORLD project

Download a nd view the logs.

Log Snippet for a HELLO_WORLD job

From this snippet, locate the “Hello from the Server” line. Below this you can see the script output, basically printing out the passed in argument values and environment variable values, that we defined in the project.

Result

In this way we can see that any script you chose to run can be populated with command line arguments or environment variables that are defined (and saved in configuration management) for each target the script should be run on. The scripts themselves can also be viewed/edited/stored in configuration management through the tool.

Going Further

Clone the initial environment

Now we have one working environment, we can clone this futher, to run the script on other servers or on the same server but with different variables.

Go to “Environment” / “Edit/Promote” and select the HELLO_WORLD project from the project drop-down.

For the single environment shown, click the “Clone” button on the right-hand-side.

Environment Creation Wizard - Enter Definition

Change the “Environment Name” from” hwenvironment01″ to “Square”.

Click “Next”. We will keep the new environment in the same project so click “Next” again.

Required data items for this environment

In this panel, change the @@SHAPE@@ dictionary item to “square”

Click “Next” and then “Create this Environment”. Thats it, We have now created the new environment.

We could now create a new package including our two environments. Since we have not changed the payload (scripts), just configuration, we can also use the previous package we created, but on the deployment panel we select “Use Latest Config All Environments”. The HELLO_WORLD_001 package will be opened prior to deployment and the new environment definitions added. A unique ID is appended to the package prior to its deployment.

Go ahead and deploy this package as we did before, but selecting the “All Latest Config”  in the deployment wizard.

All Latest Config

Confirm that the script now prints “square” instead of “triangle” for the arguments and environment variables.

More Tutorials

The following additional tutorials to create your own Java Tasks extend this example:

Set up a workspace and run a skeleton task:

Writing a RapidDeploy Java Task Part 1

Add functionality to the task:

Writing a RapidDeploy Java Task Part 2

Leave a Reply