Difference between revisions of "Deployer"

From Gcube Wiki
Jump to: navigation, search
(Deployment Report)
(Deployment Report)
Line 70: Line 70:
 
</pre>
 
</pre>
  
The Packages section reports on the packages deployed while the NewInstances section reports on the ID of new Running Instances of services activated after the deployment activity.
+
The Packages section reports on the packages deployed while the NewInstances section reports on the IDs of new Running Instances activated after the deployment activity.
  
 
==== Sample Usage ====
 
==== Sample Usage ====

Revision as of 22:59, 14 November 2008

The Deployer Service

The Deployer is a gCube Service in charge to support the deployment (and un-deployment) of software packages on the managed hosting node. It also allows to pacth and upgrade any components hosted on the node where it is running.

Design

The Deployer service adopts a Singleton Pattern and it exposes a single port-type, gcube/vremanagement/deployer/Deployer. The single resource (DeployerResource) is created at service startup and maintants the operational state of the service. Such a state includes the number of software packages that have been deployed, their list and all the infomation neeeded to undeploy/upgrade/patch them.

Interface

The operations exposed by the Deployer port-type are:

  • deploy – which takes as input parameter a message containing the software components to be deployed (their identifiers) and other parameters constraining the deployment activity (e.g. the scope) and attempt to deploy them;
  • undeploy – which takes as input parameter a message containing the software components to be removed (their identifiers) and other parameters constraining the un-deployment activity (e.g. the scope) and drop such component from the GHN;
  • update – which takes as input parameter a message containing the software components to be updated (their identifiers) and other parameters constraining the update activity (e.g. the scope) and revise the software components running on the GHN;
  • patch – which takes as input parameter an URI from which the service downloads the patch

The public interface of the Deployer port-type can be found here.

Scope

A Deployer instance must join all the scopes of the hosting gHN. This is because of the operations on the software packages can target any of such scopes.

Software packages

Deployment Report

As result of each operation invoked, a report is produced. If the caller is the VREManager, the report is sent back to the caller, otherwise it is just printed out in the service's log.

This is an example of report produced by the Deploy operation:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Report>
  <Caller>http://dlib33.isti.cnr.it:8002/wsrf/services/gcube/vremanagement/VREManager</Caller>
  <CallerScope>/gcube/devsec</CallerScope>
  <CallbackID>93cf0f70-a62e-11dd-8e40-a6520248df86</CallbackID>
  <GHNID>56606fd0-a62e-11dd-be71-ec2c9e11d1a0</GHNID>
  <Type>DEPLOY</Type>
  <Status>CLOSED</Status>
  <LastUpdate>2008-10-30T03:59:03+01:00</LastUpdate>
  <Packages>
    <Package>
      <ServiceClass>InformationSystem</ServiceClass>
      <ServiceName>IS-Notifier</ServiceName>
      <ServiceVersion>1.00.00</ServiceVersion>
      <PackageName>Notifier-service</PackageName>
      <PackageVersion>1.01.00</PackageVersion>
      <Status>RUNNING</Status>
      <Host>dlib33.isti.cnr.it:8001</Host>
      <Message/>
    </Package>
    <Package>
      <ServiceClass>InformationSystem</ServiceClass>
      <ServiceName>IS-Notifier</ServiceName>
      <ServiceVersion>1.00.00</ServiceVersion>
      <PackageName>Notifier-stubs</PackageName>
      <PackageVersion>1.00.01</PackageVersion>
      <Status>ACTIVATED</Status>
      <Host>dlib33.isti.cnr.it:8001</Host>
      <Message/>
    </Package>
  </Packages>
  <NewInstances>
    <NewInstance>
      <ID>2fc77e50-b294-11dd-80a0-f5a49621b0ea</ID>
      <ServiceClass>InformationSystem</ServiceClass>
      <ServiceName>IS-Notifier</ServiceName>
      <ServiceVersion>1.00.00</ServiceVersion>
      <PackageName>Notifier-service</PackageName>
      <PackageVersion>1.01.00</PackageVersion>
     </NewInstance>
   </NewInstances>
</Report>

The Packages section reports on the packages deployed while the NewInstances section reports on the IDs of new Running Instances activated after the deployment activity.

Sample Usage

In the following, an explanation of the usage of each Deployer operation is provided.

Deploying a software package

The Deploy operation can be invoked as follows:

import org.gcube.common.vremanagement.deployer.stubs.common.PackageInfo;
import org.gcube.common.vremanagement.deployer.stubs.deployer.DeployParameters;
import org.gcube.common.vremanagement.deployer.stubs.deployer.DeployerPortType;
import org.gcube.common.vremanagement.deployer.stubs.deployer.service.DeployerServiceAddressingLocator;
...

DeployParameters param = new DeployParameters();
PackageInfo[] ps = new PackageInfo[2]; //deploys 2 packages
		
for (int i = 1 ; i < (ps.length +1); i++) {
	ps[i-1] = new PackageInfo();
	ps[i-1].setServiceName(...); 
	ps[i-1].setServiceClass(...);
	ps[i-1].setServiceVersion(...);
	ps[i-1].setVersion(...);			
	ps[i-1].setName(...); //packageName		
}			
param.set_package(ps);
param.setTargetScope(...); // the scope in which the packages will be deployed and activated				
param.setCallbackID(""); 
param.setEndpointReference(<the VREManager EPR or null>);

EndpointReferenceType endpoint = new EndpointReferenceType();
try {
	GCUBESecurityManagerImpl managerSec = new GCUBESecurityManagerImpl() {  
    	      public boolean isSecurityEnabled() {return false;}};
	endpoint.setAddress(new Address("http://"+ <Deployer hostname>+":"+ <Deployer port> +"/wsrf/services/gcube/common/vremanagement/Deployer"));				
	DeployerServiceAddressingLocator locator = new DeployerServiceAddressingLocator();			
	DeployerPortType pt = GCUBERemotePortTypeContext.getProxy(locator.getDeployerPortTypePort(endpoint), 
	GCUBEScope.getScope(...),managerSec);			
	
	pt.deploy(param);
			
} catch (Exception e) {
	//manage the error
} 
Upgrading a software package

The update operation can be invoked as follows:


Un-Deploying a software package

The undeploy operation can be invoked as follows:


Patching the gHN

The Deployer allows to patch any local software component or the gCore itself. In order to apply a patch, the file of the pacth must be available at a valid URL.

Preparing the patch

A patch is a tarball (.tar.gz extension) and it:

  • must include at root level a file named apply.sh
  • may include an arbitrary and unconstrained number of files

Therefore, the structur of the patch file, once uncompressed, has to appear as follows:

|-apply.sh
|-*

The apply.sh must be a bash executable shell script providing the patching instructions.

Installing the patch

The patch operation can be invoked as follows:


Afterward, the called Deployer instance:

  • download the patch from the given URL
  • uncompress the tarball
  • execute the bash script using as working directory the uncompressed folder (so any file inside the patch can be addressed with a relative path)

The Deployer test suite

The Deployer test suite is a package distributed together with the Deployer service allowing to perform deployment and update operations on a gHN. The suite structure is the following:

|-test-suite
|--lib
|---org.gcube.common.vremanagement.deployer.testsuite.jar
|
|--samples
|---deploy.ghnmanager.properties
|---deploy.registry.properties
|---update.ghnmanager.properties
|
|--deploy.sh
|--update.sh

The only dependency is against gCore 0.3.0+ that must be installed and configured on the same machine from which the suite is executed (even if it is not needed to be also running).

Usage

To deploy a new package, you need to compile a simple property file with all the co-dependencies of the package and to provide it as input of the deploy.sh script. This is a sample property file that asks for the deployment of two packages:

#global propterties

numOfPackagesToDeploy=2
targetScope=/gcube/devsec
callerScope=/gcube/devsec

# package list

package.1.name=IS-Registry-service
package.1.version=1.0
package.1.servicename=IS-Registry
package.1.serviceclass=InformationSystem
package.1.serviceversion=0.0.0

package.2.name=IS-Registry-stubs
package.2.version=1.0
package.2.servicename=IS-Registry
package.2.serviceclass=InformationSystem
package.2.serviceversion=0.0.0

Where:

  • the numOfPackagesToDeploy property must report the cardinality of the list below
  • the caller scope is the scope of the invocation
  • the target scope is the scope where the packages are deployed (it makes sense only for service packages)
  • the package.X.Y properties identify the package(s) to deploy

After having compiled such a file, you need to run the deploy.sh script by providing:

  • the target GHN's hostname
  • the port on which the target GHN is running
  • the property file above

Example:

./deploy.sh localhost 8080 samples/deploy.registry.properties

Monitoring the Deployer activity

By looking at the container.fulllog file on the target GHN, if the property file above is used as input, a successful deployment reports as follows. Firstly, the first package is deployed:

2008-07-14 21:45:37,703 INFO  impl.Deployer [ServiceThread-17,info:88] Deployer: starting the deployment for N.2 packages...
2008-07-14 21:45:37,703 INFO  operators.DeployerOperator [ServiceThread-17,info:88] DeployerOperator: deploying the package IS-Registry-service...
2008-07-14 21:45:37,704 DEBUG operators.DeployerOperator [ServiceThread-17,debug:64] DeployerOperator: initialising the downloader for package IS-Registry-service...
2008-07-14 21:45:37,705 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: downloading the package IS-Registry-service...
2008-07-14 21:45:37,706 DEBUG deployment.AntRunner [ServiceThread-17,init:75] initializing the Ant project...
2008-07-14 21:45:37,707 DEBUG deployment.AntRunner [ServiceThread-17,init:76] base dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment
2008-07-14 21:45:37,707 DEBUG deployment.AntRunner [ServiceThread-17,init:86] build file = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/deploy.xml
2008-07-14 21:45:37,725 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: the Deployer is trying to download the package from Scope /gcube/devsec...
2008-07-14 21:45:37,730 DEBUG scope.GCUBEScopeManagerImpl [ServiceThread-17,debug:64] GCUBEScopeManagerImpl: Setting scope /gcube/devsec in thread ServiceThread-17(45)
2008-07-14 21:45:37,742 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: downloading ServiceClass=InformationSystem, ServiceName=IS-Registry, ServiceVersion=0.0.0, PackageName=IS-Registry-service, PackageVersion=1.0 from Address: http://dlib05.isti.cnr.it:8080/wsrf/services/gcube/vremanagement/softwarerepository/SoftwareRepository

2008-07-14 21:45:37,742 DEBUG scope.GCUBEScopeManagerImpl [ServiceThread-17,debug:64] GCUBEScopeManagerImpl: Preparing call to service VREManagement,SoftwareRepository in scope /gcube/devsec
2008-07-14 21:45:38,191 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: returned URL = http://dlib05.isti.cnr.it:80/maven/InformationSystem/IS-Registry/0/0/0/IS-Registry-service/1.0/IS-Registry-service-1.0.tar.gz
2008-07-14 21:45:38,193 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: getting data from returned URL...
2008-07-14 21:45:38,456 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: connection return code: 200
2008-07-14 21:45:38,459 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: bytes available out:    4054
2008-07-14 21:45:38,460 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: open URL connection and saving to local cache...
2008-07-14 21:45:38,462 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: Saving package to = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/tmp/IS-Registry-service.tar.gz
2008-07-14 21:45:38,941 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: package successfully downloaded
2008-07-14 21:45:38,942 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: uncompressing the package...
2008-07-14 21:45:38,942 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property base.deploy.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/local-packages
2008-07-14 21:45:38,942 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property service.id = InformationSystem-IS-Registry-0.0.0
2008-07-14 21:45:38,942 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.source.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/tmp
2008-07-14 21:45:38,943 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132]  property package.name = IS-Registry-service
2008-07-14 21:45:38,943 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.file = IS-Registry-service.tar.gz
2008-07-14 21:45:38,987 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: looking for service profile in /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/local-packages/InformationSystem-IS-Registry-0.0.0
2008-07-14 21:45:38,993 DEBUG deployment.AntRunner [ServiceThread-17,init:75] initializing the Ant project...
2008-07-14 21:45:38,994 DEBUG deployment.AntRunner [ServiceThread-17,init:76] base dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment
2008-07-14 21:45:38,994 DEBUG deployment.AntRunner [ServiceThread-17,init:86] build file = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/deploy.xml
2008-07-14 21:45:39,013 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property base.deploy.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/local-packages
2008-07-14 21:45:39,014 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property gar.name = org.gcube.informationsystem.registry.gar
2008-07-14 21:45:39,014 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property service.id = InformationSystem-IS-Registry-0.0.0
2008-07-14 21:45:39,014 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property gar.id = org.gcube.informationsystem.registry
2008-07-14 21:45:39,015 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.source.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/tmp
2008-07-14 21:45:39,015 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.name = IS-Registry-service
2008-07-14 21:45:39,015 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.file = IS-Registry-service.tar.gz
2008-07-14 21:45:40,546 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property base.deploy.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/local-packages
2008-07-14 21:45:40,546 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.source.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/tmp
2008-07-14 21:45:40,588 INFO  operators.DeployerOperator [ServiceThread-17,info:88] DeployerOperator: the package IS-Registry-service has been successfully deployed

... then, the second package is deployed:

2008-07-14 21:45:40,588 INFO  operators.DeployerOperator [ServiceThread-17,info:88] DeployerOperator: deploying the package IS-Registry-stubs...
2008-07-14 21:45:40,588 DEBUG operators.DeployerOperator [ServiceThread-17,debug:64] DeployerOperator: initialising the downloader for package IS-Registry-stubs...
2008-07-14 21:45:40,589 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: downloading the package IS-Registry-stubs...
2008-07-14 21:45:40,591 DEBUG deployment.AntRunner [ServiceThread-17,init:75] initializing the Ant project...
2008-07-14 21:45:40,591 DEBUG deployment.AntRunner [ServiceThread-17,init:76] base dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment
2008-07-14 21:45:40,591 DEBUG deployment.AntRunner [ServiceThread-17,init:86] build file = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/deploy.xml
2008-07-14 21:45:40,605 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: the Deployer is trying to download the package from Scope /gcube/devsec...
2008-07-14 21:45:40,610 DEBUG scope.GCUBEScopeManagerImpl [ServiceThread-17,debug:64] GCUBEScopeManagerImpl: Setting scope /gcube/devsec in thread ServiceThread-17(45)
2008-07-14 21:45:40,612 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: downloading ServiceClass=InformationSystem, ServiceName=IS-Registry, ServiceVersion=0.0.0, PackageName=IS-Registry-stubs, PackageVersion=1.0 from Address: http://dlib05.isti.cnr.it:8080/wsrf/services/gcube/vremanagement/softwarerepository/SoftwareRepository
2008-07-14 21:45:40,612 DEBUG scope.GCUBEScopeManagerImpl [ServiceThread-17,debug:64] GCUBEScopeManagerImpl: Preparing call to service VREManagement,SoftwareRepository in scope /gcube/devsec
2008-07-14 21:45:41,088 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: returned URL = http://dlib05.isti.cnr.it:80/maven/InformationSystem/IS-Registry/0/0/0/IS-Registry-stubs/1.0/IS-Registry-stubs-1.0.tar.gz
2008-07-14 21:45:41,090 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: getting data from returned URL...
2008-07-14 21:45:41,380 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: connection return code: 200
2008-07-14 21:45:41,382 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: bytes available out:    1157
2008-07-14 21:45:41,382 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: open URL connection and saving to local cache...
2008-07-14 21:45:41,384 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: Saving package to = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/tmp/IS-Registry-stubs.tar.gz
2008-07-14 21:45:41,889 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: package successfully downloaded
2008-07-14 21:45:41,889 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: uncompressing the package...
2008-07-14 21:45:41,889 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property base.deploy.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/local-packages
2008-07-14 21:45:41,890 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property service.id = InformationSystem-IS-Registry-0.0.0
2008-07-14 21:45:41,890 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.source.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/tmp
2008-07-14 21:45:41,890 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.name = IS-Registry-stubs
2008-07-14 21:45:41,891 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.file = IS-Registry-stubs.tar.gz
2008-07-14 21:45:41,940 DEBUG deployment.DownloadManager [ServiceThread-17,debug:64] DownloadManager: looking for service profile in /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/local-packages/InformationSystem-IS-Registry-0.0.0
2008-07-14 21:45:41,948 DEBUG deployment.AntRunner [ServiceThread-17,init:75] initializing the Ant project...
2008-07-14 21:45:41,951 DEBUG deployment.AntRunner [ServiceThread-17,init:76] base dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment
2008-07-14 21:45:41,951 DEBUG deployment.AntRunner [ServiceThread-17,init:86] build file = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/deploy.xml
2008-07-14 21:45:41,970 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property base.deploy.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/local-packages
2008-07-14 21:45:41,971 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property jar.name = org.gcube.informationsystem.registry.stubs.jar
2008-07-14 21:45:41,971 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property service.id = InformationSystem-IS-Registry-0.0.0
2008-07-14 21:45:41,987 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.source.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/tmp
2008-07-14 21:45:41,987 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.name = IS-Registry-stubs
2008-07-14 21:45:41,987 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.file = IS-Registry-stubs.tar.gz
2008-07-14 21:45:42,012 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property base.deploy.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/local-packages
2008-07-14 21:45:42,012 DEBUG deployment.AntRunner [ServiceThread-17,setProperties:132] property package.source.dir = /home/manuele/ISTI-projects/D4Science/Test/gCore031/etc/org.gcube.common.vremanagement.deployer/deployment/tmp
2008-07-14 21:45:42,054 INFO  operators.DeployerOperator [ServiceThread-17,info:88] DeployerOperator: the package IS-Registry-stubs has been successfully deployed

and finally the GHN is restarted (if needed):

2008-07-14 21:45:42,054 DEBUG deployment.Report [ServiceThread-17,send:135] Trying to send report to:
2008-07-14 21:45:42,055 INFO  common.ContainerManager [ServiceThread-17,restart:35] DILIGENT: the container is going to be restarted...
2008-07-14 21:45:42,055 INFO  common.ContainerManager [ServiceThread-17,shutdown:56] DILIGENT: the container is shutting down...