Use tags to configure deployments
In Deploy, you can use the tagging feature to configure deployments by marking which deployables should be mapped to which containers. By using tagging, in combination with placeholders, you can prepare your deployment packages and environments to automatically map deployables to containers and configuration details at deployment time.
To perform a deployment using tags, assign tags to deployables and containers. You can assign tags in an imported deployment package or in the Deploy user interface.
Note: You cannot use an environment variable in a tag.
When deploying an application to an environment, Deploy pairs the deployables and containers based on the following rules:
- Deployables and containers do not have tags.
- One of the deployables or containers is tagged with an asterisk (
- One of the deployables or containers is tagged with a plus sign (
+) and the other has at least one tag.
- Deployables and containers have at least one tag in common.
If none of these rules apply, Deploy will not generate a deployed for the deployable-container combination.
This table shows tag matching in Deploy:
This is an example of assigning a tag to a deployable in the
deployit-manifest.xml file in a deployment package (DAR file):
<?xml version="1.0" encoding="UTF-8"?> <udm.DeploymentPackage version="1.0" application="MyApp"> <orchestrator /> <deployables> <jee.War name="Frontend-WAR" file="Frontend-WAR/MyApp-1.0.war"> <tags> <value>FRONT_END</value> </tags> <scanPlaceholders>false</scanPlaceholders> <checksum>7e21b7dd23d96a0b1da9abdbe1a2b6a56467e175</checksum> </jee.War> </deployables> </udm.DeploymentPackage>
For an example of tagged deployables in a Maven POM file, see Maven documentation.
Create a deployment package that contains two artifacts:
- An EAR file that represents a back-end application
- A WAR file that represents a front-end application
Deploy the package to an environment that contains two containers:
- A JBoss AS/WildFly server where you want to deploy the back-end application (EAR file)
- An Apache Tomcat server where you want to deploy the front-end application (WAR file)
The default behavior for Deploy is to map the EAR and WAR files to the WildFly server, because WildFly can run both types of files. To prevent the WAR file from being deployed to the WildFly server, manually remove it from the mapping.
To prevent Deploy from mapping the WAR file to the WildFly server, tag the WAR file and the Tomcat virtual host with the same tag.
In this example, Deploy maps the WAR file to the Tomcat virtual host only.