Quick Start Apache User Guide

Introduction

This Quick Start Apache User Guide v3.1 for RapidDeploy should be read as an extension to the MidVision RapidDeploy User Guide. It details the specifics related to installing, deploying to and snapshoting an Apache server. Please ensure you have read and understood the concepts in that guide before reading this one.

The document is a guide to demonstrate the Apache capabilities of the product. 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:

  • Take a snapshot of an existing Apache configuration.
  • Create a template from the snapshot, and promote this to create further downstream environments based on this initial “golden” environment. This promote uses the RapidDeploy Snapshot/Template/Promote framework and doesn’t rely on any scripts.
  • Detect configuration drift and compare environment configurations.

This demonstration assumes that you have an existing Apache installation. If you wish to install a binary Apache image, please download and compile or install from the Apache HTTP Server WebSite. If you are running on windows, you can follow the section on installing Apache on windows using an MSI package.

Once these demo projects are implemented, deploying configuation to further Apache installations is a simple matter of cloning (copying) the environment configurations already set up and deploying them either through the UI or the RapidDeploy command line API.

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 apache 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 Apache Demo

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

Select Apache from Available Plugins (Click to Enlarge)

Alternatively, download the latest zip file from http://www.midvision.co.uk/wordpress/dnld/plugins/demo_projects_310/rapiddeploy-demo-projects-3.1.0-apache.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/Apache 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 Projects

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

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

APACHE_BINARY_INSTALL Project (Click to Enlarge)

Then click “Create”. Now add another project.

Field Value
Name APACHE_CONFIGURE
Description APACHE_CONFIGUREdesc
Owner mvadmin
Deployment Type codeDeploy
Collection Type APACHE_2
Log Directory $MV_HOME/logs
Project Root Directory $MV_HOME/projects/APACHE_CONFIGURE
Properties Directory $MV_HOME/projects/APACHE_CONFIGURE/apache/config
Build Store $MV_HOME/buildstore
Promotion Store $MV_HOME/promotionstore
Deployment package search string APACHE_CONFIGURE
Properties file identifier dict
Master in Database False(Not Selected)

Then click “Save”.

APACHE_CONFIGURE (Click to Enlarge)

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

SERVER.APACHE_INSTALL.APACHE_INSTANCE.WEB_APPLICATION

As the project APACHE_DEPLOY has a pre-configured environment definition, the discovery will create a new server named “apserver01”, a new environment named “apacheEnvironment01” and a new instance named “apacheInstance01”. We will later configure the connection details to the server so we can install Apache and also we will configure the environment and the instance.

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. Open the APACHE_CONFIGURE project. In the example below, the APACHE tree item is opened, displaying Apache 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).

Take a look at the orchestrations for the other projects.

Orchestration Panel for the APACHE_CONFIGURE Project (Click to Enlarge)

Linux Configuration Tip: The orchestrations these Apache projects will work correctly out of the box for Windows and Linux.

Configure the Server

Goto “Resources/Targets/Servers” then edit the server named tcserver01. 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 apserver01
Hostname localhost
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”.

Click edit on the server named “apserver01”” 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 Apache Installation Directory for APACHE_BINARY_INSTALL

In this demo we configure and deploy an Apache MSI package using the ApacheMsiInstallerTask in the supplied demo orchestration file. On Linux/Unix servers you will need to compile a version of Apache for the target platform and create a deployment package which is deployed using the Apache BinaryInstallTask.

In this section we define the file path that Apache is/will be installed into on the target server. Subsequent installations on this or other servers can be based on the same APACHE_BINARY_INSTALL project by defining additional installations.

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

Enter these fields. Remember to change $APACHE_HOME with the actual location you want to install Apache to, the default value for this demonstration example is:

Linux: Not Applicable for this demo

Windows: “c\midvision\apps\Apache”

Field Value
Installation Path $APACHE_HOME
Server apserver01
Project APACHE_BINARY_INSTALL

Then click “Create”.

The following environment variables are required, amend yourserver, yourdomain as appropriate.

Key Value
SERVICENAME Apache2.2
SERVERPORT 83
mode install
SERVERNAME yourserver
SERVERDOMAIN yourdomain.com
SERVERADMIN administrator@yourdomain.com
ALLUSERS 1
INSTALLDIR $APACHE_HOME

Installation for the APACHE_BINARY_INSTALL project on apserver01

Install Apache

Now you have defined a server and an installation directory you can install Apache to your target server at the location specified, if it is not already present. RapidDeploy can be used to install Apache 2 binaries on Linux/Unix, but this is not covered in this demo project.

If you are using windows, download the latest MSI package from http://mirror.catn.com/pub/apache//httpd/binaries/win32/httpd-2.2.21-win32-x86-no_ssl.msi

Create a zip file including this package. Name it the same but with a “.zip” extension.

Add this package to your buildstore and deploy it.

  • Go to Jobs / New Job and select the APACHE_BINARY_INSTALL project from the drop-down list. Select the apserver and the installation directory.

    APACHE_BINARY_INSTALL Job Selection

  • On the next tab select the binary zip file you created above, and skip to finish.
  • Begin the deployment.

This will install the Apache binaries, create a windows service available to all users, configure the httpd.conf file and start the service.

Note: If you get an error similar to:

MSI (s) (AC:E8) [11:25:58:532]: Product: Apache HTTP Server 2.2.21 -- Error 1606.Could not access network location C:/Temp/apps/Apache.

Make sure you have set the INSTALLDIR property to $APACHE_HOME using windows file separators (“\”).

Take a Snapshot

Now we will take a snapshot of the version of Apache that has just been installed/already exists. It is a “Golden Image” version of the configuration, which will be used to compare against and promote in the future.

Go to “Resources / Targets / Environments” edit the environment named “apacheEnvironment01″.

Edit the environment to set the following values:

Field Value
Binary Install Path $APACHE_HOME
Server apserver01
Software Product Apache HTTP Server v2.2

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.

Apache Environment apacheEnvironment01 - Take Snapshot

Convert the Snapshot to a template

Go to “Environment / Edit/Promote”, Select the  “APACHE_CONFIGURE” project.

Now click “Create Snapshot from template”.

  • Accept the defaults on the “Configuration Directory” tab.
  • On the “Snapshot Selection” tab, choose the snapshot you just requested.

    APACHE_CONFIGURE Snapshot selection

  • On the “Name” tab, enter “apacheInstance01″ for the instance, and “httpd” for the application.

    APACHE_CONFIGURE Name selection

  • On the “Create Template” tab we can add dictionary items as placeholders in the configuration. Here we will template the name of the “httpd.conf” file. This demonstrates that we can change the name of the httpd.conf file as an environment specific parameter, as many organisations distribute multiple httpd.conf files to the same Apache conf directory. Click “Edit Local”, find the line: <key>conf\httpd.conf</key> and replace with  <key>conf\@@HTTPD_CONF_NAME@@</key>

    APACHE_CONFIGURE Create Template Tab

  • On the “Environment” tab, add the name for the new Apache environment as follows. Either set to “httpd.conf” to overwrite existing file, or set to another name to create a new httpd.conf on the target. Leave this as httpd.conf in this example.

    APACHE_CONFIGURE Environment Tab

  • On the final tab Click “Create This Environment”.
Name Tab in the Snapshot to Template Wizard

Edit the template directly

Now go into “Environment/ Edit/Promote. Select the APACHE_CONFIGURE project. Edit httpd environment.

Edit Template for the first environment in the APACHE_CONFIGURE project.

Select “Resources / Files”. Navigate down to @@HTTPD_CONF_NAME@@, this is the templated name of the httpd.conf file we set earlier. Here we can parameterise more values if we wish, for example because requirements have changed since the template was created. Change the Listen directive to be a dctionary item @@LISTEN_ADDRESS@@ as follows:

httpd.conf Listen Directive

Save the configuration.

Now go to “Dictionary / Data Dictionary “and add a dictionary item for this environment @@LISTEN_ADDRESS@@ = 0.0.0.0:87

Save LISTEN_ADDRESS to the data dictionary

Save the configuration.

Create a new Package

Use the package creation wizard to create a package for the APACHE_CONFIGURE project.

Deploy the Package (APACHE_CONFIGURE).

This next project will demonstrate how to use the configuration based tasks to configure Apache.

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

APACHE_CONFIGURE Project First Deployment

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. Update the configuration to set the Listen directive

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

APACHE_CONFIGURE Completed Deployment

Take another Snapshot

Take another snapshot of the “apacheEnvironment01″, as per the previous snapshot instructions.

Compare Snapshots

Go to “Environment / Environment Comparison”.

On the “Snapshot Comparison” panel, select for the left side and right side to compare, the two snapshots taken previously.

Set the “Comparison Context size (optional 1-50):” to 5, to display 5 rows of context around each difference, and select compare:

Snapshot settings for the APACHE_CONFIGURE example

The snapshot shows the difference (macPostSize):

Comparison of Snapshots for the APACHE_CONFIGURE example

Stop/Start Apache

Looking back at the project orchestration for the APACHE_CONFIGURE project, you’ll see StopApacheTask and StartApacheTask. If you enable these tasks and rerun the deployment, your Apache instance should be started on the port you selected.

Response from Apache HTTP Server

Result

We have shown how to take a snapshot of an Apache environment, template and promote back changes. We have also shown how to compare this environment over time to detect configuration drift.

We can now “clone” the environment configured in the project we have created to may further downstream Apache environments.

In theory we do not need to create any further projects.

Once we are settled on our optimum apache configuration, we can deploy this to all of our apache installations, changing any environment specific items we choose on a per environment basis by use of the data dictionary.

Comments are closed.