< Previous PageNext Page > Hide TOC

Deployment Tasks

Now that you are acquainted with the deployment tools of WebObjects, you are ready to put that knowledge to work by deploying your applications.

This chapter explains how JavaMonitor allows you to perform most of the tasks required to maintain a WebObjects application site with point-and-click ease. The sections below guide you through the process of adding and configuring hosts, applications, and application instances. Also explained is the load-balancing mechanism used by the HTTP adaptor, which performs load balancing among the instances of an application (which can be distributed across more than one host) and how to set up email notifications so that you and your colleagues are notified when problems arise.

This chapter addresses the following subjects:

Setting Up Hosts

An application host is a computer that runs application instances. For JavaMonitor to be able to identify a host, the host has to be running a wotaskd process. In addition, JavaMonitor itself has to run on a registered host. That is, after launching JavaMonitor for the first time, you must add the computer it’s running on as an application host, as described in “Adding a Host.”

Note: Computers running Mac OS X Server are initially set up so that they go to sleep after a period of inactivity. WebObjects does not operate reliably on a computer that’s asleep. Make sure to disable idle sleep on computers on which you intend to deploy WebObjects applications.

Adding a Host

Before you can deploy applications, you need to tell JavaMonitor which hosts you want to use for deployment. (See “Load Balancing” for additional information regarding load balancing and hosts added in JavaMonitor.) Figure 5-1 shows JavaMonitor’s Hosts page, which you use to add and configure hosts.


Figure 5-1  The Hosts page

The Hosts page

Follow these steps to add an application host to a deployment:

  1. In JavaMonitor, click the Hosts tab.

  2. Enter the name or IP address of the host you want to add in the host text input field.

    The computer must be running a wotaskd process in the port that JavaMonitor sends its lifebeats to.

    Avoid using a loopback address (a connection that does not go over the network), such as localhost or 127.0.0.1. If you do, it must be the only application host in your site.

  3. Choose the appropriate platform from the pop-up menu.

  4. Click Add Host.

Figure 5-2 shows the Hosts page after a host has been added.


Figure 5-2  Newly added host in JavaMonitor

Newly added host in Monitor

Configuring a Host

To change the configuration of an application host, click the Config button on the Hosts page. A page similar to the one in Figure 5-3 appears. It allows you to set the type of the host and to resynchronize configuration information if needed.


Figure 5-3  Host configuration page

Host configuration page

Viewing a Host’s Configuration

To display the configuration of a host, click YES, on the Hosts page. A page similar to the one in Figure 5-4 is displayed in a separate web browser window.


Figure 5-4  Host configuration information page

Host configuration information page

This page displays the current state of the host in several sections.

The section visible in Figure 5-4 shows the contents of the host’s SiteConfig.xml file. For more information on the SiteConfig.xml file, see “Configuration Files.”

The next section shows the adaptor configuration sent to local HTTP adaptors, which lists all running application instances that wotaskd knows about (this includes JavaMonitor processes).

<?xml version="1.0" encoding="ASCII"?>
<adaptor>
    <application name="JavaMonitor">
        <instance id="-8888" port="8888" host="ebruce2.apple.com"/>
    </application>
</adaptor>

Note that the instance ID of the JavaMonitor process is negative. When wotaskd receives a lifebeat from an unregistered application instance (one that has not been added to your site through JavaMonitor), it discloses the instance to the web server with a negative ID number. This allows developers (internal users) to connect to development instances through the HTTP adaptor for testing purposes. To address security concerns, external users can connect to instances with negative ID numbers only if they know the instance’s port number. However, this can be disabled by setting WODirectConnectEnabled to false. See WODirectConnectEnabled in WebObjects Application Properties Reference for details.

To connect to a development instance through the web server, the instance must run on the same computer that the web server runs on, and the computer must be the localhost.

Next is the local adaptor configuration sent to remote HTTP adaptors. This section lists all instances that are active, registered (configured through JavaMonitor), and available to external users.

<?xml version="1.0" encoding="ASCII"?>
<adaptor>
  <application name="Payroll" urlVersion="4">
    <instance id="1" port="2001" host="ebruce.apple.com"/>
  </application>
  <application name="HR" urlVersion="4">
    <instance id="1" port="2002" host="ebruce.apple.com"/>
  </application>
</adaptor>

The next section shows the contents of the HTTP adaptor configuration file. If you tell wotaskd to write the HTTP adaptor configuration file, it lists all the registered application instances on the site, whether they are running or not. (This file is identical across all the site’s application hosts.) See “The HTTP Adaptor Configuration File” for more information and an example of the file’s contents.

The last section lists information on the wotaskd process’s environment, including its port and multicast address.

The Configuration Directory is: /Library/WebObjects/Configuration/
Wotaskd is NOT writing WOConfig.xml to disk
The multicast address is: 239.128.14.2
This wotaskd is running on Port: 1085
Wotaskd is NOT responding to Multicast
WOAssumeApplicationIsDeadMultiplier is 4
The System Properties are: ...

Installing Applications

Before you can deploy applications on your site, you have to install them on the hosts on which you want to run instances of them. Most applications have files of two types:

You can use either Xcode or the Ant build system to install an application on a host. Using these tools, you create an application bundle, also known as the WOA bundle, containing all the files the application needs to run. However, most web applications contain web server resources, such as images. You should place these resources in the web server’s Document Root directory. You do this that by performing a split installation.

In a split installation, a directory containing an application’s web server resources is placed in the web server’s Document Root directory. This directory mirrors the WOA bundle’s organization, but it contains only web server resources. You can place the WOA bundle anywhere you like, preferably a location inaccessible to the outside world.

Building for Deployment with Xcode

To perform a split installation of your application using Xcode 2.1 or later, navigate to your project’s directory and execute the following commands as the root user using your shell editor:

xcodebuild install -configuration Deployment DSTROOT=/
xcodebuild install -configuration WebServer DSTROOT=/

To perform a split installation of your application using Xcode 2.0 or earlier, navigate to your project’s directory and execute the following commands as the root user using your shell editor:

xcodebuild install -buildstyle Deployment DSTROOT=/
xcodebuild install -buildstyle WebServer DSTROOT=/

Building for Deployment with Ant

Starting with WebObjects 5.4 and later, Xcode no longer supports building for deployment for new WebObjects applications based on the Ant build system. As an alternative, you can use the Java Ant build tool to do a split installation.

The steps to build for deployment described below apply to a WebObjects example project. You can find the WebObjects examples in the /Developer/Examples/JavaWebObjects directory.

To perform a split installation of your application using the WebObjects Ant build system, navigate to your project’s directory and execute the following commands while logged in as the root user from a shell:

ant deployment

This command places the application files in the /Library/WebObjects/Applications directory and the web server resources in the Document Root/WebObjects directory.

The WebObjects Ant build system provides three types of application bundles in the dist directory of your project folder:

After producing a split installation on the development computer, copy the WOA bundle and the application’s resources to their final destination (or destinations, in case you want to run instances of the application in several computers) and use JavaMonitor to configure the deployment.

You can place application files in any directory of the application host. Web server resources, however, must be placed in the Document Root directory of the application host. Make sure that you use the following organization:

<Web server Document Root>/
    WebObjects/
        AppName.woa/
            Contents/
                WebServerResources/
                    <resource files>

In most situations you should deploy an application’s logic and resources on different computers. For example, while developing an application on Mac OS X, you can test it with the web server included with the system. However, you should not deploy the application in Mac OS X. Always deploy WebObjects applications on Mac OS X Server.

!

Warning: Never remove the WebServerResources directory that is generated as part of the application bundle.

Setting Up Applications

To deploy an application on your site, it must be installed in the appropriate directories on the hosts that run instances of it. For more information, see “Installing Applications.”

Setting up an application in your site involves three main steps:

Adding an Application

You add applications to your site using JavaMonitor’s Applications page, shown in Figure 5-5.


Figure 5-5  Adding an application using JavaMonitor’s Applications page

Adding an application using Monitor’s Applications page

Follow these steps to add an application to your site:

  1. Enter the application’s name (without the extension) in the Add Application Named text field.

  2. Click Add Application.

Configuring an Application

After you add an application, the application configuration page is displayed. This page has five major sections, which you can show and hide using the disclosure triangles:

New Instance Defaults

Figure 5-6 shows the section of the application configuration page that allows you to set defaults for the application instances. If application instances are running when you change these settings, you need to restart them to apply your changes. For details on the options shown on this page, see the description below or refer to WebObjects Application Properties Reference as indicated.


Figure 5-6  The New Instance Defaults section of the application configuration page

The New Instance Defaults section of the application configuration page

Here’s an explanation of the buttons on the page:

Changing the JVM Size

By default, the maximum allowed RAM usage for a Java application is 64 MB. Changing this setting using JavaMonitor affects only the applications launched by JavaMonitor. Follow these steps to change the JVM size used by applications deployed with JavaMonitor:

  1. Double-click the Applications tab in JavaMonitor.

  2. In the Applications view, click the Config icon to bring up the Configuration window.

  3. Type -Xmx128m in the Additional Arguments text field.

The -Xmx128m option sets the maximum RAM usage to 128 MB, but that is only an example. Experiment with different values to find out what has the best performance for your application. Setting the value too high may cause temporary slowdowns during garbage collection or disk paging. Some applications may benefit from setting the minimum RAM usage equal to the maximum. You can do this by setting the Java VM options to -Xms128m -Xmx128m

Application Settings

Figure 5-7 shows the Application Settings section of the application configuration page. In it, you define application settings that apply to all the instances of the application. For details of the properties shown in this section, see the description below or refer to WebObjects Application Properties Reference as indicated.


Figure 5-7  The Application Settings section of the application configuration page

The Application Settings section of the application configuration page

Scheduling

Figure 5-8 shows the Scheduling section of the application configuration page. After you add instances of an application, you can schedule them individually here. For details, see the description below or WebObjects Application Properties Reference.


Figure 5-8  The Scheduling section of the application configuration page

The Scheduling section of the application configuration page

Email Notifications

Note:  Before you can configure email notifications, you have to tell JavaMonitor which SMTP server to use. See “Configuring Sites.”

Figure 5-9 shows the Email Notification Settings section of the application configuration page. In it you can enter the email addresses of people that are to be notified when instances of the application terminate unexpectedly. For more information, see WebObjects Application Properties Reference.


Figure 5-9  The Email Notifications section of the application configuration page

The Email Notifications section of the Application Configuration page

Load Balancing and Adaptor Settings

Figure 5-10 shows the Load Balancing and Adaptor Settings section of the application configuration page. This is where you enter values for the HTTP adaptor’s configuration properties, including the load-balancing algorithm the adaptor uses to balance user load among the application instances. These settings override the values entered in the HTTP Adaptor Settings section of the Site page. For information on the properties you can set, see the description below or WebObjects Application Properties Reference as indicated.


Figure 5-10  The Load Balancing and Adaptor Settings section of the application configuration page

The Load Balancing and Adaptor Settings section of the application configuration page

Adding Application Instances

After configuring an application in JavaMonitor, you can create application instances with ease.

  1. In JavaMonitor, click the Applications tab. The Applications page is displayed, as shown in Figure 5-11.

    Figure 5-11   The Applications page with one application

    The Applications page with one application
  2. Click the Detail View button under View Instances. The application detail page is displayed, as shown in Figure 5-12.

    Figure 5-12   The application detail page

    The application detail page
  3. Enter the number of instances you want to add in the text input field.

  4. Choose the application host you want the instances to run on from the pop-up menu.

    The application must be installed on the host you choose; otherwise, an error message is displayed when you try to start the instance. See “Installing Applications” for details.

  5. Click Add. Your web browser displays a page like the one in Figure 5-13.

    Figure 5-13   The application detail page after an instance has been added

    The application detail page after an instance has been added

The Status column indicates whether the instance is on or off. The first time the page is displayed, the newly added instances are off. After a moment (or if you click Refresh Now), and if Auto Recover is enabled for the instance, the page refreshes, showing that the instance is active. For details on Auto Recover, see the description of Auto Recover in “New Instance Defaults.” (Read “Setting JavaMonitor Preferences” for how to change the length of the interval between the automatic updates of the application detail page.)

Figure 5-14 shows the application detail page of the HR application, with two instances configured.


Figure 5-14  The application detail page with two instances added

The application detail page with two instances added

The following list describes the instance configuration information that appears in the application detail page:

For an explanation of the columns under Statistics, see “The Application Detail Page.”

The row with the caption ALL INSTANCES contains buttons that perform some of the functions listed above on all the instances of the application. Clicking Config displays the application configuration page.

Configuring Instances

After adding an instance, you can change its configuration in the instance configuration page, shown in Figure 5-15. You can access this page through the instance’s Config button in the application detail page. It contains two sections: Instance Settings and Adaptor Settings. For information on those sections, see “Instance Settings” and “Adaptor Settings.”


Figure 5-15  Instance configuration page

Instance configuration page

Instance Settings

This section is very similar to the New Instance Defaults section of the application configuration page (“New Instance Defaults”). It has two additional properties: ID and Port, which can be changed only after an instance has been added. ID is the application instance number which must be unique for each instance of an application. For Port details, see WOPort in WebObjects Application Properties Reference.

Adaptor Settings

In this section you can change a subset of the properties available in the Load Balancing and Adaptor Settings section of the application configuration page. For details, see the descriptions in “Load Balancing and Adaptor Settings.”

Setting a Password for the Instance Statistics Page

For each instance of your application, there’s a statistics page that displays information such as its running time and memory usage. See “The Instance Statistics Page” for more information on this page. If you want to prevent outside agents from gaining access to the instance statistics page, you can set a password in the Instance Settings section of the instance configuration page. Add the following to the Additional Arguments property:

-WOStatisticsPassword password

Figure 5-16 shows an example where the WOStatisticsPassword argument has been added to the Additional Arguments field.


Figure 5-16   Setting a password for an instance’s statistics page

Setting a password for an instance’s statistics page

Configuring Sites

When you click the Site tab in JavaMonitor, the site configuration page is displayed. It contains three sections:

Figure 5-17 shows the site configuration page.


Figure 5-17  The site configuration page

The site configuration page

Setting JavaMonitor Preferences

When you click the Preferences tab in JavaMonitor, the page in Figure 5-18 is displayed. It contains two sections: JavaMonitor Password and Detail View Refresh Settings.


Figure 5-18  The preferences page

The preferences page

JavaMonitor Password

You can restrict access to JavaMonitor by requiring its users to enter a password before they can use it. When a site is protected this way, the site’s wotaskd processes are also protected; that is, you cannot directly obtain a wotaskd process’s information by connecting to its port.

Figure 5-19 shows the login page that JavaMonitor displays after you password-protect your site.


Figure 5-19  Login page displayed by JavaMonitor on a password-protected site

Login page displayed by Monitor on a password-protected site

When you try to view the configuration of an application host on a site that you’ve password-protected by connecting to the appropriate wotaskd process’s port, you see a page similar to the one shown in Figure 5-20 (the page’s content varies according to your deployment platform).


Figure 5-20  Page returned by wotaskd when the site is password-protected

Page returned by wotaskd when the site is password-protected

On password-protected sites, you have to use JavaMonitor to view an application host’s configuration.

Detail-View Refresh Settings

This section allows you to tell JavaMonitor if you want it to refresh the application detail page and how often to do it.

Load Balancing

Note: Load balancing occurs only between the hosts that the HTTP adaptor knows about. Adding a host in JavaMonitor is not enough. For more information on how to configure hosts in the HTTP adaptor, see “State Discovery.”

Load balancing is a mechanism by which user-load is spread out among the instances of an application; these instances can be running on different hosts. Load balancing ensures that your site’s hardware resources are used efficiently and with the highest level of performance. The default load-balancing scheme used is Random. The following list describes how user load is distributed under each of the provided algorithms:

You can choose a load-balancing algorithm at two levels:

Deploying Multiple Sites

You can deploy and configure separate sites on a set of computers by running multiple web servers, each with its own HTTP adaptor. Such a deployment requires a separate group of wotaskd processes running on the same port. You also need a separate JavaMonitor process to configure each site.

The default installation of the WebObjects Deployment package provides you with one site—one wotaskd process per host, running on port 1085. To create a second site, using the same hardware, you have to add an additional wotaskd process to each of the hosts you want to use.

What separates the environments from each other are the WOPort and WOLifebeatDestinationPort settings of each wotaskd process and the configuration directory used for each site. The application instances send their lifebeats to their WOLifebeatDestinationPort, while wotaskd processes listen for them in their WOPort. Figure 5-21 illustrates two sites on one host.


Figure 5-21  Multiple application environments on one computer

Multiple application environments on one computer

Because JavaMonitor is not started by a wotaskd process, its WOLifebeatDestinationPort argument needs to be set to match wotaskd’s WOPort setting.

For details on how to set the command-line argument values required when starting wotaskd and JavaMonitor processes for separate application environments, see WOPort, WOLifebeatDestinationPort, and WODeploymentConfigurationDirectory in WebObjects Application Properties Reference.



< Previous PageNext Page > Hide TOC


© 2001, 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-10-31)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.