Difference between revisions of "Deployer"
Manuele.simi (Talk | contribs) (→The Deployer Service) |
Manuele.simi (Talk | contribs) (→Patching any component) |
||
Line 93: | Line 93: | ||
</pre> | </pre> | ||
− | ===== Patching | + | ===== 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. | 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. | ||
Line 100: | Line 100: | ||
* must include at root level a file named '''apply.sh''' | * must include at root level a file named '''apply.sh''' | ||
* may include an arbitrary and unconstrained number of files | * may include an arbitrary and unconstrained number of files | ||
− | The | + | <pre> |
+ | |-apply.sh | ||
+ | |-* | ||
+ | </pre> | ||
+ | |||
+ | The '''apply.sh''' must be a bash executable shell script providind the patching instructions. | ||
====== Installing the patch ====== | ====== Installing the patch ====== |
Revision as of 01:26, 20 October 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.
Operations
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
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, otherwis it is just printed out in the service's log. The structure of the report is the following:
This is an example of report produced:
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <Report> <Type>DEPLOYMENT</Type> <LastUpdate>2008-09-25T16:54:35+02:00</LastUpdate> <Packages> <Package> <ServiceClass>InformationSystem</ServiceClass> <ServiceName>IS-Notifier</ServiceName> <ServiceVersion>1.00.00</ServiceVersion> <PackageName>Notifier-stubs</PackageName> <PackageVersion>1.00.00</PackageVersion> <Status>DEPLOYED</Status> <Host>dlib33.isti.cnr.it:8002</Host> <GHN>a938b7d0-88ce-11dd-a38a-f9b09f00a04e</GHN> </Package> <Package> <ServiceClass>DVOS</ServiceClass> <ServiceName>AuthorizationService</ServiceName> <ServiceVersion>1.00.00</ServiceVersion> <PackageName>Stubs</PackageName> <PackageVersion>0.00.00</PackageVersion> <Status>DEPLOYED</Status> <Host>dlib33.isti.cnr.it:8002</Host> <GHN>a938b7d0-88ce-11dd-a38a-f9b09f00a04e</GHN> </Package> <Package> <ServiceClass>InformationSystem</ServiceClass> <ServiceName>IS-Notifier</ServiceName> <ServiceVersion>1.00.00</ServiceVersion> <PackageName>Notifier-service</PackageName> <PackageVersion>1.00.00</PackageVersion> <Status>DEPLOYED</Status> <Host>dlib33.isti.cnr.it:8002</Host> <GHN>a938b7d0-88ce-11dd-a38a-f9b09f00a04e</GHN> </Package> <Package> <ServiceClass>DVOS</ServiceClass> <ServiceName>AuthorizationService</ServiceName> <ServiceVersion>1.00.00</ServiceVersion> <PackageName>Main</PackageName> <PackageVersion>0.00.00</PackageVersion> <Status>DEPLOYED</Status> <Host>dlib33.isti.cnr.it:8002</Host> <GHN>a938b7d0-88ce-11dd-a38a-f9b09f00a04e</GHN> </Package> </Packages> </Report>
Sample Usage
In the following, an explations of the usage of each Deployer operation is provided.
Deploying a software package
The Deploy operation can be invoked as follows:
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
|-apply.sh |-*
The apply.sh must be a bash executable shell script providind 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...