"Seegrid will be due for a migration to confluence on the 1st of August. Any update on or after the 1st of August will NOT be migrated"

THREDDS Installation on Lenny (Debian 5)

System requirements

  • Prerequisite :
    • Sun Java 1.6
    • Apache Tomcat 5.5 or above (Latest version of Tomcat 6.0 recommended)

Environment variables

  • JAVA_HOME (e.g. /usr/lib/jvm/java-6-sun/ PLEASE READ this).
  • CATALINA_HOME (e.g. /var/lib/tomcat6/)

Configuring mod_proxy_ajp with Tomcat 6 for THREDDS

  • Ensure that the AJP 1.3 Connector is enabled on port 8009:
    • Edit $CATALINA_HOME/conf/server.xml
           <!-- Define an AJP 1.3 Connector on port 8009 -->
           <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
           
  • Locate configuration directory: ls -l /etc/apache2/sites-enabled/000-default
     lrwxrwxrwx 1 root root 26 2009-02-17 15:36 /etc/apache2/sites-enabled/000-default -> ../sites-available/default 
  • Edit /etc/apache2/sites-available/default
    • After , insert/edit the following:
            ProxyPreserveHost On
            ProxyRequests Off
            <Proxy *>
               Order deny,allow
               Allow from all
            </Proxy>
      
            #Tomcat Manager
            ProxyPass /manager ajp://localhost:8009/manager
            ProxyPassReverse /manager ajp://localhost:8009/manager
      
            #THREDDS
            ProxyPass /thredds ajp://localhost:8009/thredds
            ProxyPassReverse /thredds ajp://localhost:8009/thredds
            

  • Restart Apache2 and Tomcat 6:
    • /etc/init.d/apache2 restart
    • /etc/init.d/tomcat6 restart

  • To test that your have configured the AJP Proxy correctly, try to access the tomcat manager via your internet browser (e.g. http://apacsrv6/manager/html)

Configure file permissions for THREDDS

  • When THREDDS is deployed, it will try to create a folder content in $CATALINA_HOME. In order to do that, tomcat requires write access to the directory.

Ensure modules required by THREDDS are loaded

  • Phsyically examine that the following modules are loaded: ls /etc/apache2/mods-enabled
    • proxy_ajp.load
    • proxy.load
  • If they are not loaded, load them using a2enmod (e.g. a2enmod proxy, a2enmod proxy_ajp)
  • Restart Apache2.

Downloading & Deploying(or upgrading)

  • Download the TDS WAR file from Unidata's web site.
  • We will be using the current stable version, TDS 4.1.
  • Move thredds.war into /usr/local/thredds/archive. Use this folder to store all the files required in setting up THREDDS
  • We will refer to $THREDDS_HOME as /usr/local/thredds/.
  • For Unix systems:
    • Create the folder $THREDDS_HOME/unpacked and copy the contents of thredds.war into $THREDDS_HOME/unpacked/thredds-4.1
    • You can treat WAR files as JAR files and unpack them the same way. (i.e jar xf thredds.war)
    • Any modification can be done in this folder. These changes can be tracked by comparing this folder to the original files.
    • Create a Symbolic Link $THREDDS_HOME/current and point it to $THREDDS_HOME/unpacked/thredds-4.1
    • A Symbolic Link created as follows:
      ln -s source_file link_name
    • Whenever an upgrade is performed, edit the Symbolic Link to point to the new folder (where the upgraded web application is).
  • For Windows systems:
    • Create the folder $THREDDS_HOME/current and copy the contents of thredds.war into it.
    • Any modification can be done in this folder. These changes can be tracked by comparing this folder to the original files.
    • Whenever an upgrade is performed, stop the service, rename the existing folder $THREDDS_HOME/current to $THREDDS_HOME/current-YYYY-MM-DD.
    • The upgraded web application should then be renamed to $THREDDS_HOME/current.

Configuring THREDDS

  • Create the file thredds-tomcat.xml in $THREDDS_HOME. Edit the file and insert the following:
    <!-- Please expand $THREDDS_HOME - remember $THREDDS_HOME is not a real variable -->
    <Context path="/thredds" docBase="$THREDDS_HOME/current">
    </Context>
    
  • Edit the following files:
  • $THREDDS_HOME/current/WEB-INF/classes/thredds/server/tds.properties. edit these 2 fields:
    tds.content.root.path=../content
    tds.content.path=data    
    
  • Note: If tds.content.root.path specified is not $TOMCAT/content/thredds, ensure that $TOMCAT/content/thredds does not exist as this would confuse THREDDS.
  • (Optional):
  • $THREDDS_HOME/current/WEB-INF/web.xml. Edit the context path:
      <context-param>
        <param-name>ContextPath</param-name>
        <param-value>thredds</param-value>
      </context-param>   
    
  • Grant write permissions on $THREDDS_HOME to Tomcat .
  • Start Tomcat and access the Web Application Manager (http://HOST:PORT/manager/html)
  • Under Deploy, specify the Context Path as /thredds and specify the location of the XML Configuration file ($THREDDS_HOME/thredds-tomcat.xml).
  • Deploy the web application. This should create a folder $THREDDS_HOME/content/data/*.
  • Test that the THREDDS service has been deployed via your internet browser (e.g. http://HOST:PORT/thredds)

THREDDS Catalog Review

  • THREDDS catalogs collect, organize, and describe accessible datasets. They provide a hierarchical structure for organizing the datasets as well as an access method (URL) and a human understandable name for each dataset. Further descriptive information about each dataset can also be added.

THREDDS Catalog Configuration

  • The THREDDS catalog is configured in catalog.xml ($THREDDS_HOME/content/data/catalog.xml); example:
    <?xml version="1.0" encoding="UTF-8"?> 
    <catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
       xmlns:xlink="http://www.w3.org/1999/xlink" name="THREDDS-IDD WCS Data Server" version="1.0.1">    
    
      <service name="all" serviceType="Compound" base="">
        <service name="wcs" serviceType="WCS" base="/thredds/wcs/" />
        <service name="openDAP" serviceType="OPENDAP" base="/thredds/dodsC/" />
        <service name="http" serviceType="HTTPServer" base="/thredds/fileServer/" />
      </service>
    
      <dataset name="THREDDS-IDD WCS Data Server">
        <metadata inherited="true">
          <serviceName>all</serviceName>
          <authority>unidata.ucar.edu:</authority>
          <dataType>Grid</dataType>
        </metadata>
        <datasetScan name="GALEON Test Data" path="galeon" dirLocation="content/wcsExample/testdata/" filter=".*\.nc$" />
      </dataset>
    
      <dataset name="Test Single Dataset" ID="testDataset" serviceName="openDAP"
               urlPath="content/testdata/testData.nc" dataType="Grid"/>
      <dataset name="Test Single Dataset 2" ID="testDataset2" serviceName="openDAP"
         urlPath="content/testdata/testData2.nc" dataType="Grid"/>
    
      <datasetScan name="Test all files in a directory" ID="testDatasetScan"
                   path="testAll" location="content/testdata">
    
        <metadata inherited="true">
          <serviceName>all</serviceName>
          <dataType>Grid</dataType>
        </metadata>
    
        <filter>
          <include wildcard="*eta_211.nc"/>
        </filter>
      </datasetScan>
    
      <catalogRef xlink:title="Test Enhanced Catalog" xlink:href="enhancedCatalog.xml" name=""/>
    
    </catalog>
         

  • Configuring service type used by dataset
          <service name="dapService" serviceType="OpenDAP" base="/thredds/dodsC/" />
          
    • The serviceType element defines a OPeNDAP service and has the name dapService.

  • Dataset
         <datasetRoot path="test" location="content/testdata/" />
         <dataset name="Test Single Dataset" ID="testDataset" serviceName="dapService"
               urlPath="test/testData.nc" dataType="Grid"/>
         
    • Each datasetRoot element defines a single mapping between a URL base path and a directory. The URL base path so defined can then be used in accessible datasets for files under the mapped directory.
    • The serviceName element corresponds to the name of the service configured previously.
    • The urlPath element points to the accessible dataset
            <datasetScan name="Test all files in a directory" ID="testDatasetScan"
                     path="testAll" location="content/testdata">
            
    • Each datasetScan element also defines a single mapping between a URL base path and a directory. Unlike the datasetRoot element which works with dataset elements to define the datasets served, the datasetScan element will automatically serve some or all of the datasets found in the mapped directory.
            <catalogRef xlink:title="My Other Catalog"
                    xlink:href="myOtherCatalog.xml" />
            <catalogRef xlink:title="Far Away Univ catalog"
                    xlink:href="http://www.farAwayU.edu/thredds/catalog.xml" />
            
    • The catalogRef elements link to a relative catalog and a remote catalog

Custom Metadata (WMS GetCapabilties Document).

  • THREDDS 4.1
    • To configure THREDDS to display custom metadata for the WMS GetCapabilties document, edit the OGCMeta.xml.
    • The default location for OGCMeta.xml can be found in $THREDDS_HOME/current/WEB-INF/OGCMeta.xml
    • Note: Whenever a new thredds.war is deployed, it would overwrite this file. Make a backup of this file as a precaution.
  • THREDDS 4.2
    • Edit $CATALINA_HOME/content/thredds/threddsConfig.xml.
    • Modify the param serverInformation.

Debugging

  • The logs can be found at:
    • $CATALINA_HOME/logs
    • $CATALINA_HOME/content/thredds/logs

Related links:

Tested on

  • apacsrv6
Topic revision: r11 - 02 Feb 2011, DerrickWong
 

Current license: All material on this collaboration platform is licensed under a Creative Commons Attribution 3.0 Australia Licence (CC BY 3.0).