-
Notifications
You must be signed in to change notification settings - Fork 10
GuideDeploymentManagement
One of the most useful services provided by the Overlord: DTGov system is the Deployment Service. This is a service that makes it possible to deploy a binary artifact stored in the S-RAMP repository into a target runtime environment such as JBoss EAP. This Deployment Service can easily be invoked from a Governance Workflow and is often included as part of a Deployment Lifecycle business process.
Invoking the Deployment Service from a Governance Workflow should be a simple matter of using the HttpClientDeploy task defined in the HttpClientWorkDefinitions.wid file as described in the Governance Workflows chapter of this guide. Within a BPMN2 process, the XML markup might look something like this:
<bpmn2:task id="Task_1" drools:taskName="HttpClientDeploy" drools:displayName="Deploy" drools:icon="run-build-install.png" name="Deploy to DEV"> <bpmn2:incoming>bpmn20:SequenceFlow_9</bpmn2:incoming> <bpmn2:outgoing>bpmn20:SequenceFlow_10</bpmn2:outgoing> <bpmn2:ioSpecification id="_InputOutputSpecification_10"> <bpmn2:dataInput id="_DataInput_47" itemSubjectRef="__NameInputItem" name="Url"/> <bpmn2:dataInput id="_DataInput_48" itemSubjectRef="__NameInputItem" name="Method"/> <bpmn2:dataInput id="_DataInput_49" itemSubjectRef="__NameInputItem" name="Uuid"/> <bpmn2:dataInput id="_DataInput_50" itemSubjectRef="__NameInputItem" name="Target"/> <bpmn2:inputSet id="_InputSet_10" name="Input Set 10"> <bpmn2:dataInputRefs>_DataInput_47</bpmn2:dataInputRefs> <bpmn2:dataInputRefs>_DataInput_48</bpmn2:dataInputRefs> <bpmn2:dataInputRefs>_DataInput_49</bpmn2:dataInputRefs> <bpmn2:dataInputRefs>_DataInput_50</bpmn2:dataInputRefs> </bpmn2:inputSet> </bpmn2:ioSpecification> <bpmn2:dataInputAssociation id="_DataInputAssociation_47"> <bpmn2:sourceRef>DeploymentUrl</bpmn2:sourceRef> <bpmn2:targetRef>_DataInput_47</bpmn2:targetRef> </bpmn2:dataInputAssociation> <bpmn2:dataInputAssociation id="_DataInputAssociation_48"> <bpmn2:targetRef>_DataInput_48</bpmn2:targetRef> <bpmn2:assignment id="Assignment_1"> <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="FormalExpression_16">POST</bpmn2:from> <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="FormalExpression_17">_DataInput_48</bpmn2:to> </bpmn2:assignment> </bpmn2:dataInputAssociation> <bpmn2:dataInputAssociation id="_DataInputAssociation_49"> <bpmn2:sourceRef>ArtifactUuid</bpmn2:sourceRef> <bpmn2:targetRef>_DataInput_49</bpmn2:targetRef> </bpmn2:dataInputAssociation> <bpmn2:dataInputAssociation id="_DataInputAssociation_50"> <bpmn2:targetRef>_DataInput_50</bpmn2:targetRef> <bpmn2:assignment id="Assignment_14"> <bpmn2:from xsi:type="bpmn2:tFormalExpression" id="FormalExpression_17">dev</bpmn2:from> <bpmn2:to xsi:type="bpmn2:tFormalExpression" id="FormalExpression_18">_DataInput_50</bpmn2:to> </bpmn2:assignment> </bpmn2:dataInputAssociation> </bpmn2:task>
The above task uses the DeploymentUrl and ArtifactUuid parameters that were passed in to the business process when it was invoked. It populates the inputs required by HttpClientDeploy including an input parameter named Target. The Target parameter maps to a configured Deployment Target. The target is a logical name and corresponds to a physical runtime environment configured in the DTGov configuration file (dtgov.properties). See the next section for details.
In order to make logical Deployment Targets available they must be configured in the DTGov configuration file. Typically an organization would configure three or four Deployment Targets, including:
-
dev - the development environment
-
qa - the test environment
-
stage - the staging environment
-
prod - the final production environment
Of course, any number of targets can be configured. Here is an example of how to configure the above four targets in the DTGov configuration file:
governance.targets= dev|http://www.jboss.org/overlord/deployment-status.owl#InDev|copy|/tmp/dev/jbossas7/standalone/deployments governance.targets= qa|http://www.jboss.org/overlord/deployment-status.owl#InQa|copy|/tmp/qa/jbossas7/standalone/deployments governance.targets=stage|http://www.jboss.org/overlord/deployment-status.owl#InStage|copy|/tmp/stage/jbossas7/standalone/deployments governance.targets= prod|http://www.jboss.org/overlord/deployment-status.owl#InProd|copy|/tmp/prod/jbossas7/standalone/deployments
The format of each target is as follows:
LogicalName|Classifier|DeploymentType|TypeSpecificParams
-
'LogicalName' : used in the BPMN process as described in the previous section as the value of Target
-
'Classifier' : a classifier that should get added to the binary deployment artifact when deployed to the target environment (and removed when undeployed)
-
'DeploymentType' : how to deploy to the environment. Valid values as of this writing include copy, rhq, as_cli, maven
Depending on the type of the deployment, additional parameters may be required. In the example above, the 'copy' deployment type requires a folder on the server, which is where it will copy the deployment artifact.
Here are some examples of how to use the other deployment types:
governance.targets= rhq_example |#Example|rhq|{rhq.user}::{rhq.password}::{rhq.baseUrl} governance.targets= cli_example |#Example|as_cli|asuser::aspassword::ashost::asport governance.targets= maven_example|#Example|maven|scp://m2.example.com/m2/snapshot-repository::false::true
Whenever the Deployment Service is used to deploy an artifact from the repository, it also annotates that artifact with relevant undeployment information. This annotation takes the form of another artifact in the repository of type ext/UndeploymentInformation. The annotation artifact will have a relationship named describesDeployment pointing from it back to the deployment artifact it annotates.
This undeployment information is used whenever an artifact needs to be undeployed. Undeploy of an artifact happens when a new version of that artifact is being deployed to a particular environment (deployment target). When this happens, the old version (whichever version is currently deployed in that environment) is undeployed in preparation of the new deployment.
Once the artifact is undeployed, its undeployment information artifact is deleted from the repository and any relevant classifier associated with the target environment is removed from the deployment artifact.
Note: please see the Configuring DTGov chapter for information about how to coordinate the configuration of the Deployment Service with the configuration of the DTGov User Interface (the Deployment Management UI).