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 onINFO
level. -
Load Semver Step
Loads the Semver
version
file (src/main/resources
) using the Parse Template component. For testing purposes the complete#[payload]
is logged onINFO
level. -
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 onINFO
level.
-
Property Management
The application uses
<configuration-properties>
to load its properties from thesrc/main/resources/<env-name>.properties
file.Additional environment specific property files can be added to the
src/main/resources
folder. The<env-name>
value can be set using themule.env
property acting as a 'switch' allowing to load environment specific properties at runtime.Note: The
<mule.env>
property value defaults tolocal
using<global-property>
. -
HTTP Listener
The application uses a configurable
port
in theHTTP Listener
component, e.g.:http.port=8081
-
Autodiscovery
The application uses a configurable
API Id
andEnvironment
credential pair in the globalAutodiscovery
component, 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-url 2. connected-app-client-id 3. connected-app-client-secret 4. connected-app-grant-type |
2 | Environment | The Environment properties can be used to set the Environment and Runtime Fabric instance details | 1. environment.name 2. 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-name 2. application-client-id 3. application-client-secret |
4 | Application | The Application properties can be used to set the Application domain name and resource allocation parameters | 1. application-domain-name 2. application-cpu-reserved 3. application-cpu-max 4. application-mem-reserved 5. application-mem-max |
5 | Deployment | The Deployment properties can be used to set any relevant deployment settings | 1. deployment-mule-runtime 2. deployment-replicas 3. deployment-replicas-across-nodes 4. deployment-update-strategy 5. deployment-forward-ssl 6. deployment-clustered 7. 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:Verify Publish Deploy |
2 | Multiple Jobs | Multiple jobs pipeline | Jobs:Verify Publish Deploy |
3 | Multiple Jobs - Custom Resources | Multiple jobs pipeline including custom Concourse Resource Types: |
Jobs:Verify / Publish Deploy |