A simple Mule 4 API, used for testing & demonstrating Mule 4 application deployments using Concourse pipelines in combination with a generic Mule 4 pipeline resource: mule-concourse-pipeline.
The example pipelines can be used as a foundation for (more) complex pipeline definitions.
Note: Although the example pipelines assume Runtime Fabric as the target deployment options, a similar approach can be followed for other deployment options like CloudHub and Standalone Mule runtimes.
The API has a single operation, providing runtime, host & container information:
| # | Key | Value |
|---|---|---|
| 1 | Endpoint | host:port/workerinfo |
| 2 | Method | GET |
| 3 | Headers | NA |
Flow Steps
-
Log Start Step
Logs the start of the flow using the default Logger component (Core). For testing purposes the complete
#[payload]is logged onINFOlevel. -
Load Semver Step
Loads the Semver
versionfile (src/main/resources) using the Parse Template component. For testing purposes the complete#[payload]is logged onINFOlevel. -
Create Response Step
Creates the API response using the Transformation component, e.g.:
{ "version": "1.0.2", "origin": { "app": { "encoding": "UTF-8", "name": "mule4-workerinfo-dev", "standalone": true, "workDir": "/opt/mule/./.mule/mule4-workerinfo-dev" }, "server": { "env": { . . . "ORG_ID": "8cc90329 ... 5db10edc3257", . . . "APP_NAME": "mule4-workerinfo-dev", . . . "ENV_ID": "c02e8cc1 ... 3551dd0e0f75" }, "fileSeparator": "/", "host": "mule4-workerinfo-dev-7f4b85fd5-t58sx", "ip": "10.244.84.69", "locale": { "unicodeLocaleKeys": [], "country": "", "ISO3Language": "eng", "displayName": "English", "language": "en", . . . }, "javaVendor": "Private Build", "javaVersion": "1.8.0_265", "osArch": "amd64", "osName": "Linux", "osVersion": "4.18.0-80.11.2.el8_0.x86_64", "systemProperties": { "java.vendor": "Private Build", "sun.java.launcher": "SUN_STANDARD", "sun.management.compiler": "HotSpot 64-Bit Tiered Compilers", "os.name": "Linux", . . . "wrapper.port": "34000", "wrapper.arch": "x86" }, "timeZone": "GMT", . . . "userName": "app" } } } -
Log End Step
Logs the end of the flow using the default Logger Component (Core). For testing purposes the complete
#[payload]is logged onINFOlevel.
-
Property Management
The application uses
<configuration-properties>to load its properties from thesrc/main/resources/<env-name>.propertiesfile.Additional environment specific property files can be added to the
src/main/resourcesfolder. The<env-name>value can be set using themule.envproperty acting as a 'switch' allowing to load environment specific properties at runtime.Note: The
<mule.env>property value defaults tolocalusing<global-property>. -
HTTP Listener
The application uses a configurable
portin theHTTP Listenercomponent, e.g.:http.port=8081 -
Autodiscovery
The application uses a configurable
API IdandEnvironmentcredential pair in the globalAutodiscoverycomponent, e.g.:api.id=16084400 anypoint.platform.client_id=[CLIENT ID] anypoint.platform.client_secret=[CLIENT SECRET]
To support Semver versioning, a version file has been added (src/main/resources) that can be used by a Concourse Semver resource to drive the versioning aspects of the Mule application asset.
The Maven POM file supports the following properties.
| No. | Category | Description | Properties |
|---|---|---|---|
| 1 | Platform | The Platform properties can be used to set the platform url and Connected Apps credentials | 1. anypoint-platform-url2. connected-app-client-id3. connected-app-client-secret4. connected-app-grant-type |
| 2 | Environment | The Environment properties can be used to set the Environment and Runtime Fabric instance details | 1. environment.name2. rtf.instance.name |
| 3 | Settings | The Settings properties can be used to set any relevant application level settings like environment name and autodiscovery properties | 1. mule-env-name2. application-client-id3. application-client-secret |
| 4 | Application | The Application properties can be used to set the Application domain name and resource allocation parameters | 1. application-domain-name2. application-cpu-reserved3. application-cpu-max4. application-mem-reserved5. application-mem-max |
| 5 | Deployment | The Deployment properties can be used to set any relevant deployment settings | 1. deployment-mule-runtime2. deployment-replicas3. deployment-replicas-across-nodes4. deployment-update-strategy5. deployment-forward-ssl6. deployment-clustered7. deployment-last-mile-security |
The following is an overview of the relevant Maven goals:
| No. | Operation | Sample Command |
|---|---|---|
| 1 | Application build and test |
|
| 2 | Application asset publication to Exchange |
|
| 3 | Application asset deployment to a Runtime Fabric instance |
|
The following is an overview of the different Concourse pipeline examples. All examples build, test, package, publish and deploy this application using different pipeline approaches:
| No. | Pipeline | Description | Details |
|---|---|---|---|
| 1 | Single Job | Single job pipeline with 3 separate tasks | Tasks:VerifyPublishDeploy |
| 2 | Multiple Jobs | Multiple jobs pipeline | Jobs:VerifyPublishDeploy |
| 3 | Multiple Jobs - Custom Resources | Multiple jobs pipeline including custom Concourse Resource Types: |
Jobs:Verify / PublishDeploy |
