Difference between revisions of "DEPRECATED - REMOVE IT SmartGears gHN Installation"

From Gcube Wiki
Jump to: navigation, search
(Clean App state)
m (Luca.frosini moved page SmartGears gHN Installation to DEPRECATED - REMOVE IT SmartGears gHN Installation: Duplicated by /SmartGears_Web_Hosting_Node_(wHN)_Installation)
 
(44 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
==Introduction==
 
==Introduction==
  
As very well described in the dedicated gCube developer guide [https://gcube.wiki.gcube-system.org/gcube/index.php/SmartGears| section], SmartGears is a set of Java libraries that turn Servlet-based containers and applications into gCube resources in a transparent way.  
+
As described in detail in in the dedicated [https://wiki.gcube-system.org/gcube/SmartGears WIKI Page] of the gCube Developer's Guide, SmartGears is a set of Java libraries that turn Servlet-based containers and applications into gCube resources, in a transparent way.  
  
In order to achieve the goal of ''Software-as-resource'' and ''Container-as-resource'' infrastructure administrators and site-managers have been equipped with a bundle for the installation and management of the software needed to :
+
In this guide, we show how administrators and site-managers can install SmartGears and manage SmartGears installations.
 
+
* enable any servlet-based container as a resource on the infrastructure
+
* enable any application running on the container as a resource on the infrastructure.
+
  
 
== Prerequisites ==
 
== Prerequisites ==
  
The following are prerequisite for the installation of a SmartGears gHN:
+
The following are prerequisite for a SmartGears installation:
  
* <code>J2SE 1.6 update 4 SDK</code> or greater. [http://www.oracle.com/technetwork/java/javase/ Sun's] reference implementation is recommended, but versions from [http://www-128.ibm.com/developerworks/java/jdk/ IBM], [http://h18012.www1.hp.com/java/ HP], or [http://www.bea.com/framework.jsp?CNT=index.htm&FP=/content/products/weblogic/jrockit/ BEA] should work equally well.
+
* <code>J2SE 1.6 update 4 SDK</code> or greater. [http://www.oracle.com/technetwork/java/javase/ Oracle's] reference implementation is recommended, but versions from [http://www-128.ibm.com/developerworks/java/jdk/ IBM], [http://h18012.www1.hp.com/java/ HP], or [http://www.bea.com/framework.jsp?CNT=index.htm&FP=/content/products/weblogic/jrockit/ BEA] should work equally well.
  
* <code>[http://www.gnu.org/software/tar/tar.html GNU tar]</code> to install gCore from archived distributions.
+
* <code>[http://www.gnu.org/software/tar/tar.html GNU tar]</code> to install the SmartGears from archived distributions.
  
 
* An existing installation of one of the available [http://en.wikipedia.org/wiki/List_of_Servlet_containers  Servlet Containers]
 
* An existing installation of one of the available [http://en.wikipedia.org/wiki/List_of_Servlet_containers  Servlet Containers]
  
The following are pre-requisites for the operation of gHN in any infrastructure:
+
The following are pre-requisites for the operation of a SmartGears-based hosting node in any infrastructure:
  
 
* A static IP address and preferably a DNS name.
 
* A static IP address and preferably a DNS name.
Line 26: Line 23:
 
== Installation ==
 
== Installation ==
  
The SmartGears gHN is available as archived distribution from the gCube Nexus Maven repository. ( link). Once downloaded the distribution can be expanded in any location of the filesystem. The distribution contains all the relevant files and in particular the ''install'' script, which performs the real installation of SmartGears within the servlet container:
+
The SmartGears distribution is available as a tarball from the [http://maven.research-infrastructures.eu/nexus/index.html#welcome gCube Nexus Maven repository], with the following coordinates:
 +
 
 +
<pre>
 +
<dependency>
 +
  <groupId>org.gcube.distribution</groupId>
 +
  <artifactId>smartgears-distribution</artifactId>
 +
  <version>...</version>
 +
  <type>tar.gz</type>
 +
</dependency>
 +
</pre>
 +
 
 +
Once downloaded, the tarball can be expanded in any location of the filesystem, henceforth referred to as the ''installation folder''. The distribution contains all the relevant files, including the <code>install</code> script which performs the real installation of SmartGears within the servlet container.
 +
 
 +
A new folder should be designated to contain the state of the SmartGears-enabled hosting node, and its absolute path configured as the value of the <code>GHN_HOME</code> environment variable. If the folder, does not exist, the <code>install</code> script will create it.
  
 
  <pre>
 
  <pre>
Line 43: Line 53:
 
</pre>
 
</pre>
  
 +
The following parameters must be provided to the script for each servlet container:
 +
 +
* ''-a <app directory>'' : is the folder where applications are stored in the container
 +
* ''-s <lib directory>'' : is the folder where the shared libraries of the container are stored.
 +
 +
In the common case in which the servlet container is Tomcat, however, the single setting:
 +
 +
* ''-s tomcat''
 +
 +
will suffice, provided the environment variable <code>CATALINA_HOME</code> is correctly set.
 +
 +
Other optional parameters include:
 +
 +
* ''-s <distro directory>'': specifies the folder where the Smargears distribution has been downloaded.
 +
* ''-g  <gHN directory>'' : specifies the gHN folder if not provided trough GHN_HOME var
 +
* ''-x'' :  perform a dry run : checks that the specified options are fine without performing a real installation
  
 
== Upgrade ==
 
== Upgrade ==
  
In order to upgrade an existing SmartGears gHN installation the '''download'''  script has been provided to contact the gCube Nexus Repository. The script is available from ''$GHN_HOME/scipts/download''  and it has this options:
+
An existing SmartGears installation can be upgraded with the <code>download</code> script, which contacts the gCube Nexus Repository. The script is available in <code>$GHN_HOME/scipts/download</code> and it offers the following options:
  
 
<pre>
 
<pre>
Line 61: Line 87:
 
== Clean ==
 
== Clean ==
  
The SmartGears gHN serialises locally on the disk the information published on the gCube Information system ( gHN and RunningInstance profiles), in particular:
+
SmartGears stores on disk the information it publishes in the gCube Information System, including hosting node and endpoint profiles. In particular:
  
* gHN profile is serialised within the folder ''$GHN_HOME/state'' in the file ''ghn.xml''
+
* the profile of the hosting node is stored in the file <code>$GHN_HOME/state/ghn.xml</code>
* Apps profiles are stored within the folder  ''$GHN_HOME/state/<app-name>/endpoint.xml''
+
* endpoint profiles are stored in files of the following form: <code>$GHN_HOME/state/<app-name>/endpoint.xml</code>
  
scripts are available in order to clean the state of the gHN ( both gHN and single app) and it quite useful in the case of reinstallation or development.
+
Scripts are available that clean the state of the installation (both node and all or individual endpoint profiles). These scripts can be used when reinstalling SmartGears or during development.
  
=== Clean gHN state ===
+
=== Clean Node State ===
  
The script ''$GHN_HOME/scripts/clean-container-state'' can be used in order to clean the whole gHN state:
+
The script <code>$GHN_HOME/scripts/clean-container-state</code> cleans the entire state of the installation:
  
 
<pre>
 
<pre>
Line 79: Line 105:
 
</pre>
 
</pre>
  
=== Clean App state ===
+
=== Clean Endpoint State ===
  
The script ''$GHN_HOME/scripts/clean-app-state'' can be executed in order to clean the state of a single app:
+
The script <code>$GHN_HOME/scripts/clean-app-state</code> cleans the state of a single endpoint:
  
 
<pre>
 
<pre>
Line 95: Line 121:
 
=== Configuring the Environment ===
 
=== Configuring the Environment ===
  
=== Configuring the gHN ===
+
The only environment-level configuration needed by SmartGears is the <code>GHN_HOME</code> variable, as discussed above.
  
The configuration of the gHN that relates to its operation within the infrastructure and can be found in <code>$GLOBUS_LOCATION/config/GHNConfig.xml</code>. The file <code>$GLOBUS_LOCATION/config/GHNConfig.client.xml</code> ''can'' be used to dedicate a separate configuration to a gHN that operates in [[Contexts#The_gHN_Context|client mode]].
+
==== Tomcat Environment ====
  
The following gHN properties are available for configuration:
+
in the case of Tomcat installation some variables can be usefully added to the env. Assuming a bash shell:
 +
 
 +
export CATALINA_OPTS="-Xmx2000m -Xms2000m"
 +
export CATALINA_PID=~/pid.txt
 +
 
 +
In some cases it could be needed to increase the maximum permanent generation size, so that the VM can hold additional classes. Assuming a bash shell:
 +
 +
export CATALINA_OPTS="-XX:MaxPermSize=512M"
 +
 
 +
=== Configuring the Hosting Node ===
 +
 
 +
The runtime configuration of SmartGears is found in the file <code>$GHN_HOME/container.xml</code>.
 +
 
 +
The following configuration properties are available:
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
|-
 
| '''<code>securityenabled</code>'''
 
| <code>true</code> if the gHN can operate in a secure infrastructure, <code>false</code> otherwise.
 
 
|-
 
|-
 
| '''<code>mode</code>'''
 
| '''<code>mode</code>'''
| either '''<code>CONNECTED</code>''' or '''<code>STANDALONE</code>''' depending on whether the gHN does or does not publish information in the infrastructure.  
+
| either '''<code>offline</code>''' or '''<code>online</code>''' depending on whether the hosting node does or does not publish information in the infrastructure.  
 
|-
 
|-
| '''<code>infrastructure</code>'''
+
| '''<code>hostname</code>'''
| the name of the infrastructure in which the gHN operates. (e.g. <code>gcube</code>, <code>d4science</code>,...).
+
| the hostname of the hosting node to be published on the infrastructure.  
 
|-
 
|-
| '''<code>startScopes</code>'''
+
| '''<code>port</code>'''
| a comma-separated list of VOs that the gHN joins.
+
| the port of the hosting node to be published on the infrastructure.  
 
|-
 
|-
| '''<code>allowedScopes</code>'''
+
| '''<code>infrastructure</code>'''
| a comma-separated list of VOs that the gHN will potentially join (upon VO Manager decision).
+
| the name of the infrastructure in which the hosting nodes operates. (e.g. <code>gcube</code>, <code>d4science</code>,...).
 
|-
 
|-
| '''<code>labels</code>'''
+
| '''<code>vo</code>'''
| the name of the file that includes custom labels to characterize the gHN.  These are added to those automatically derived by gCore and published in the gHN profile. The file name must be relative to the <code>$GLOBUS_LOCATION/config</code> directory.
+
| the VO[s] that the hosting nodes joins.
 
|-
 
|-
| '''<code>GHNtype</code>'''
+
| '''<code>persistence</code>'''
| either '''<code>DYNAMIC</code>''' or '''<code>STATIC</code>''' depending on whether the gHN can or cannot be used as a target for dynamic deployment operations.
+
| an alternative folder where the state of the hosting node and apps state are maintained.
 
|-
 
|-
| '''<code>coordinates</code>'''
+
| '''<code>property</code>'''
| a pair of comma-separated values for the latitude and longitude of the gHN. Coordinates for some popular locations are available [[gHN Coordinates|here]].
+
| an arbitrary property with name/value attributes
 
|-
 
|-
 
| '''<code>country</code>'''
 
| '''<code>country</code>'''
| the two-character [http://www.iso.org/iso/english_country_names_and_code_elements ISO code] of the Country where the gHN is located.  
+
| the two-character [http://www.iso.org/iso/english_country_names_and_code_elements ISO code] of the Country where the hosting node is located.  
 
|-
 
|-
 
| '''<code>location</code>'''
 
| '''<code>location</code>'''
 
| the name of the location.
 
| the name of the location.
 
|-
 
|-
| '''<code>publishedHost</code>'''
+
| '''<code>longitude</code>'''
| the hostname to declare in the GHN and Running Instance profiles, if different from the actual one
+
| the longitude of the hosting node.
 
|-
 
|-
| '''<code>publishedPort</code>'''
+
| '''<code>latitude</code>'''
| the port to declare in the GHN and Running Instance profiles, if different from the actual one
+
| the latitude of the hosting node.
 
|-
 
|-
| '''<code>updateInterval</code>'''
+
| '''<code>publication-frequency</code>'''
| how often the gHN must has to refresh its profile on the IS (in seconds).
+
| how often the hosting node refreshes its profile on the IS (in seconds).
|-
+
| '''<code>portRange</code>''' [optional]
+
| a dash-separated pair of numbers that identify a range of free ports, if any.
+
|-
+
| '''<code>testInterval</code>''' [optional]
+
|  how often the monitoring Probes have to perform local test on the gHN
+
 
|}
 
|}
  
For example, the configuration required to join the gHN to the <code>/gcube/devsec</code> and <code>/gcube/testing</code> VOs is the following:
+
an example of configuration file can be found at [https://gcube.wiki.gcube-system.org/gcube/index.php/SmartGears#Container_Descriptor]
 
+
<pre>
+
infrastructure = gcube
+
startScopes = devsec,testing
+
</pre>
+
 
+
For an in-depth coverage of scope and scope-related parameters (infrastructure and startScopes) see the [[Scope_Management|Developer Guide]].
+
  
 
=== Configuring Logging ===
 
=== Configuring Logging ===
  
=== Supporting resource encryption/decryption ===
+
Please refer to the SmartGears development guide section on logging [https://gcube.wiki.gcube-system.org/gcube/index.php/SmartGears#Logging]
 
+
If the gHN is foreseen to manage gCube encrypted resources, the [http://bscw.i-marine.research-infrastructures.eu/bscw/bscw.cgi/d243895/symm.key AES symmetric key] has to be downloaded and stored in the $GLOBUS_LOCATION/config folder.
+

Latest revision as of 19:10, 17 March 2016

Introduction

As described in detail in in the dedicated WIKI Page of the gCube Developer's Guide, SmartGears is a set of Java libraries that turn Servlet-based containers and applications into gCube resources, in a transparent way.

In this guide, we show how administrators and site-managers can install SmartGears and manage SmartGears installations.

Prerequisites

The following are prerequisite for a SmartGears installation:

  • J2SE 1.6 update 4 SDK or greater. Oracle's reference implementation is recommended, but versions from IBM, HP, or BEA should work equally well.
  • GNU tar to install the SmartGears from archived distributions.

The following are pre-requisites for the operation of a SmartGears-based hosting node in any infrastructure:

  • A static IP address and preferably a DNS name.

Installation

The SmartGears distribution is available as a tarball from the gCube Nexus Maven repository, with the following coordinates:

<dependency>
  <groupId>org.gcube.distribution</groupId>
  <artifactId>smartgears-distribution</artifactId>
  <version>...</version>
  <type>tar.gz</type>
</dependency>

Once downloaded, the tarball can be expanded in any location of the filesystem, henceforth referred to as the installation folder. The distribution contains all the relevant files, including the install script which performs the real installation of SmartGears within the servlet container.

A new folder should be designated to contain the state of the SmartGears-enabled hosting node, and its absolute path configured as the value of the GHN_HOME environment variable. If the folder, does not exist, the install script will create it.

usage:  install [-d <distro directory>] -s tomcat|<lib directory> -a [app directory] [-g gHN directory] [-x|-h] 

  <distro directory> = the directory with the distribution of SmartGears XXX.
                       By default, this is the parent directory of this script.
  <lib directory>    = the directory with libraries shared by all applications in the target container.
  <app directory>    = the directory with all the applications in the target container.
  <gHN directory>    = the directory with logs and files related to the gCube Hosting Node.
                       By default, this is value of the GHN_HOME env var.
  tomcat             = Sets <lib directory> and <app directory> for a target Tomcat container.
  x                  = dry run.
  h                  = shows this help.

The following parameters must be provided to the script for each servlet container:

  • -a <app directory> : is the folder where applications are stored in the container
  • -s <lib directory> : is the folder where the shared libraries of the container are stored.

In the common case in which the servlet container is Tomcat, however, the single setting:

  • -s tomcat

will suffice, provided the environment variable CATALINA_HOME is correctly set.

Other optional parameters include:

  • -s <distro directory>: specifies the folder where the Smargears distribution has been downloaded.
  • -g <gHN directory> : specifies the gHN folder if not provided trough GHN_HOME var
  • -x : perform a dry run : checks that the specified options are fine without performing a real installation

Upgrade

An existing SmartGears installation can be upgraded with the download script, which contacts the gCube Nexus Repository. The script is available in $GHN_HOME/scipts/download and it offers the following options:

usage:  download [-v <version>] [-o <folder>] [-s|-h] 

  <version>          = the version to download.
                     = By default, this is the latest known version.
  s                  = download a snapshot version.
  <folder>           = download to specific folder.
  h                  = shows this help.

Clean

SmartGears stores on disk the information it publishes in the gCube Information System, including hosting node and endpoint profiles. In particular:

  • the profile of the hosting node is stored in the file $GHN_HOME/state/ghn.xml
  • endpoint profiles are stored in files of the following form: $GHN_HOME/state/<app-name>/endpoint.xml

Scripts are available that clean the state of the installation (both node and all or individual endpoint profiles). These scripts can be used when reinstalling SmartGears or during development.

Clean Node State

The script $GHN_HOME/scripts/clean-container-state cleans the entire state of the installation:

usage:  clean-container-state  [-g <ghn_home>] [-h] 

  <ghn_home>   = the gHN directory.
  h             = shows this help.

Clean Endpoint State

The script $GHN_HOME/scripts/clean-app-state cleans the state of a single endpoint:

usage:  clean-app-state -a <app_name> [-g <ghn_home>] [-h] 

  <app-name>    = the application name whose state has to be cleaned
  <ghn_home>    = the gHN directory.
  h             = shows this help.

Configuration

Configuring the Environment

The only environment-level configuration needed by SmartGears is the GHN_HOME variable, as discussed above.

Tomcat Environment

in the case of Tomcat installation some variables can be usefully added to the env. Assuming a bash shell:

export CATALINA_OPTS="-Xmx2000m -Xms2000m"
export CATALINA_PID=~/pid.txt

In some cases it could be needed to increase the maximum permanent generation size, so that the VM can hold additional classes. Assuming a bash shell:

export CATALINA_OPTS="-XX:MaxPermSize=512M"

Configuring the Hosting Node

The runtime configuration of SmartGears is found in the file $GHN_HOME/container.xml.

The following configuration properties are available:

mode either offline or online depending on whether the hosting node does or does not publish information in the infrastructure.
hostname the hostname of the hosting node to be published on the infrastructure.
port the port of the hosting node to be published on the infrastructure.
infrastructure the name of the infrastructure in which the hosting nodes operates. (e.g. gcube, d4science,...).
vo the VO[s] that the hosting nodes joins.
persistence an alternative folder where the state of the hosting node and apps state are maintained.
property an arbitrary property with name/value attributes
country the two-character ISO code of the Country where the hosting node is located.
location the name of the location.
longitude the longitude of the hosting node.
latitude the latitude of the hosting node.
publication-frequency how often the hosting node refreshes its profile on the IS (in seconds).

an example of configuration file can be found at [1]

Configuring Logging

Please refer to the SmartGears development guide section on logging [2]