Next Previous Contents

## 5. TAS and Web Servers

The Tango Application Server runs as it's own process, where it services requests from a web server. This allows for some functionality such as load splitting and direction, as well as freedom of choice in web server and platform. The TAS need not be on the same machine as the web server, nor is it limited to being even on one machine.

The preferred way of having a web server talk to Tango is through a plugin. The plugin is written in the web server's API, or Application Programming Interface, to take advantage of specific features of that web server, as well as the advantage of having the code execute as part of the web server, instead of as a separate CGI process. On Solaris, Tango has a plugin for Netscape Server and for Apache in later versions of Tango 2000. Tango for Linux has a plugin for Apache.

## 5.1 Netscape Server Configuration

### Tango 3.x

Locate your Netscape configuration files in /whatever/netscape/suitespot/https-MYSERVER/config generally. To the mime.types file, add this line:

    type=magnus-internal/taf exts=taf

Add these two lines to the top of the obj.conf file (no line breaks; each line which starts with 'init' is a full line. Thus, there are two lines total)

    Init fn=load-modules shlib=/var/opt/EDI/lib/TangoNS_ep3.so funcs="Tango_main,Tango_main_init"

    Init fn=Tango_main_init stanza="TangoNS_ep3.so"

Add this line to the obj.conf file inside of the <Object name=default> area, with the other services.

    Service fn="Tango_main" method="(GET|HEAD|POST)" type="magnus-internal/taf"

You'll then need to use your Netscape Administration Server to restart the server, telling it to load the configuration files when it informs you that they've been hand-edited. Then, try hitting a TAF file. If it works, great! If not, go through your configuration file again. Most of the time, a misconfiguration is the reason for it not working. One space or quotation mark out of place will destroy the entire setup.

### Tango 2000

Locate your Netscape configuration files in /whatever/netscape/suitespot/https-MYSERVER/config, generally. To the mime.types file, add this line:

    type=magnus-internal/taf exts=taf,tcf

Then, add these two lines to the beginning of the obj.conf file. Note that there are no line breaks in each line.

    Init fn=load-modules shlib=/opt/PVSWtango/lib/libtango4ns.so funcs="Tango_main,Tango_main_init"

    Init fn=Tango_main_init stanza="libtango4ap.so" tangoconfigpath=/opt/PVSWtango/configuration

Add this line to the obj.conf file inside of the <Object name=default> area, with the other services.

    Service fn="Tango_main" method="(GET|HEAD|POST)" type="magnus-internal/taf"

You'll then need to use your Netscape Administration Server to restart the server, telling it to load the configuration files when it informs you that they've been hand-edited. Then, try hitting a TAF file. If it works, great! If not, go through your configuration file again. Most of the time, a misconfiguration is the reason for it not working. One space or quotation mark out of place will destroy the entire setup.

### Tango 2000 Service Pack 1

Installation is the same as for Tango 2000, but with this extra line added to the services in the <Object name=default> area of the obj.conf file:

    Service fn="Tango_main" method="(GET|HEAD|POST)" type="magnus-internal/tml"

Also, the mime.types file should have this line used instead of the one for Tango 2000:

    type=magnus-internal/taf exts=taf,tcf,tml

## 5.2 Apache Server Configuration

Tango 2000 for Linux, and Tango 2000 Service Pack 1 for Solaris both support the Apache webserver through an Apache plugin. Apache will require mod_so support for all of these. The documentation states that you must custom build your Apache; this is misleading. You must build your Apache only if the pre-built version you're using doesn't have mod_so support. There are two places to check for this:

First, try running your Apache server with a '-l' argument. If mod_so is listed, you're fine.

    # httpd -l
    Compiled-in modules:
    http-core.c
    mod_so.c

Second, try looking in your httpd.conf file for an 'AddModule mod_so.o' line. If you don't have mod_so support (also known as DSO support) in some way, you'll need to compile a version that does.

### Tango 2000

At the end of your httpd.conf file, add these lines:

    LoadModule t4_module /usr/local/tango/lib/libtango4ap.so
    TangoModule t4_module
     /usr/local/tango/configuration/t4client.ini

Modify the paths to the .so and .ini files as appropriate on your setup.

Your t4client.ini will then need a stanza for t4_module. See the t4client.ini section for examples.

### Tango 2000 Service Pack 1

At the end of your httpd.conf file, add these lines:

    LoadModule t4_apache /usr/local/tango/lib/libtango4ap.so
    TangoModule t4_apache
     /usr/local/tango/configuration/t4client.ini

Modify the paths to the files as appropriate; Solaris defaults to /opt/PVSWtango/ for the Tango home.

Your t4client.ini will then need a stanza for t4_apache. See the t4client.ini section for examples.

## 5.3 tXclient.ini - CGI/Plugin configuration

Tango uses a client configuration file to tell the CGI or Plugins where to send Tango requests. The file consists of two sections; a declaration section and an information section. Here is an example for a file controlling a CGI:

    [Tango Client Definitions]
    t4.cgi=Put A Description Here

    [t4.cgi]
    TANGO_SERVER=127.0.0.1,18100

And an example of a file with both a CGI and an Apache plugin:

    [Tango Client Definitions]
    t4.cgi=My Tango CGI
    t4_apache=My Apache
     Plugin

    [t4.cgi]
    TANGO_SERVER=127.0.0.1,18100

    [t4_apache]
    TANGO_SERVER=127.0.0.1,18100

Further entries can be made as appropriate. Use this list to find what 'keyword' to use to reference a CGI/Plugin:

CGI

  Use the name of the CGI. For example, you could have two CGIs, t4.cgi and t4private.cgi, each pointing to a different Tango server.

Netscape Plugin (Tango 2000)

  Use 'libtango4ns.so' as the name. You shouldn't try to load multiple plugins.

Netscape Plugin (Tango 3.x)

  Use 'TangoNS_ep3.so'

Apache Plugin

  Use 't4_module' for Tango 2000 and 't4_apache' for Tango 2000 Service Pack 1. You shouldn't try to load multiple modules.

Tango 3 versions earlier than 3.6 use a slightly different format. TANGO_SERVER is broken into two lines; TANGO_HOST and TANGO_PORT. Here's an example:

    [Tango Client Definitions]
    t3.cgi

    [t3.cgi]
    TANGO_HOST=127.0.0.1
    TANGO_PORT=18000

## 5.4 Load Splitting/Load Balancing

All versions of Tango starting with 3.6 have allowed Load Splitting. You can define a series of Tango servers that a plugin can use, and it will distribute new requests between the servers. Users who make subsequent requests are directed back to the server they were at previously via the UserReference search argument or cookie. Users cannot move between servers without losing their variables and what not. Also, what Tango currently does is not load balancing; that is expected for a future release of Tango.

Tango does not need to be running on the same machine as the web server in any event. You need only run configure Tango's VALIDHOST configuration variable to include the IP address of the web server machine. Then, in the web server machine's t4client.ini file, put in the IP address and port number as usual.

### Tango Load Splitting

To add multiple Tango servers, add an entry to the t4server.ini file with the new name of the server, and add a new stanza for it, generally by copying an existing stanza. Then, change all directory names to be unique, such as LOGDIR. Make sure that it's running on a unique port. Tango defaults to port 18100. Here is an abbreviated example of a t4server.ini file with two Tango Application Server instances:

    [Tango Definitions]
    TAS_1=MyFirstServer
    TAS_2=MySecondServer

    [TAS_1]
    ...
    LISTENERPORT=18100
    ...
    LOGDIR=/usr/local/tango/log.TAS_1

    ...

    [TAS_2]
    ...
    LISTENERPORT=18101
    ...
    LOGDIR=/usr/local/tango/log.TAS_2
    ...

All other configuration variables would be filled in as appropriate.

To run Tango with a specific configuration definition, use the -c switch.

    $ ./tango4d -c TAS_1
    $ ./tango4d -c TAS_2

The -c switch can be used in conjunction with the -k switch to kill servers as well.

Note that you'll need the appropriate licenses, either one Corporate or Professional license, or as many Standard licenses as you want Tango servers.

In the t4client.ini file, simply add the IP address and port of each server to the TANGO_SERVER line of the appropriate CGI or Plugin, colon delimited. Here is an example t4client.ini file, using the CGI, pointing to three separate Tango servers running on the same machine, on ports 18100, 18101 and 18102.

    [Tango Client Definitions]
    t4.cgi=My CGI

    [t4.cgi]
    TANGO_SERVER=127.0.0.1,18100:127.0.0.1,18101:127.0.0,1,18102

### Load Balancing - Hardware Load Balancers

You can use a hardware load balancing device with Tango so long as your webserver farm is behind the load splitting device, and each webserver is using an exact copy of the same t4client.ini file. The t4client.ini file should be configured to use every Tango machine you want available. The UserReference based Tango redirection should function normally.

Next Previous Contents