Skip to content

A simple Mule 4 API, used for testing & demonstrating Concourse pipelines.

License

Notifications You must be signed in to change notification settings

mulesoft-catalyst/mule-concourse-pipeline-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mule-concourse-pipeline-example

About

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.

Description

Specification

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 Details

Overview Flow Overview

Flow Steps

  1. Log Start Step

    Logs the start of the flow using the default Logger component (Core). For testing purposes the complete #[payload] is logged on INFO level.

  2. Load Semver Step

    Loads the Semver version file (src/main/resources) using the Parse Template component. For testing purposes the complete #[payload] is logged on INFO level.

  3. 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"
            }
        }
    }
    
  4. Log End Step

    Logs the end of the flow using the default Logger Component (Core). For testing purposes the complete #[payload] is logged on INFO level.

Application Properties

  1. Property Management

    The application uses <configuration-properties> to load its properties from the src/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 the mule.env property acting as a 'switch' allowing to load environment specific properties at runtime.

    Note: The <mule.env> property value defaults to local using <global-property>.

  2. HTTP Listener

    The application uses a configurable port in the HTTP Listener component, e.g.:

    http.port=8081

  3. Autodiscovery

    The application uses a configurable API Id and Environment credential pair in the global Autodiscovery component, e.g.:

    api.id=16084400
    anypoint.platform.client_id=[CLIENT ID]
    anypoint.platform.client_secret=[CLIENT SECRET]
    

Semver

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.

Usage

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
mvn test
2 Application asset publication to Exchange
mvn deploy -DskipTests
3 Application asset deployment to a Runtime Fabric instance
mvn deploy -DmuleDeploy -DskipTests -Dmule.env.name=dev -Danypoint.platform.url=anypoint.mulesoft.com -Dconnected.app.client.id=[CLIENT ID] -Dconnected.app.client.secret=[CLIENT SECRET] -Dconnected.app.grant.type=client_credentials -Denvironment.name=Development -Drtf.instance.name=fabric-instance -Dapplication.domain.name=example.org -Dapplication.cpu.reserved=1000m -Dapplication.cpu.max=1500m -Dapplication.mem.reserved=3500Mi -Dapplication.mem.max=3500Mi -Dapplication.client.id=bdfea201b67c ... 393f65ab097975628 -Dapplication.client.secret=a835230238d4 ... 3961A097ded787fEC -Ddeployment.mule.runtime=4.3.0 -Ddeployment.replicas=1 -Ddeployment.replicas.across.nodes=false -Ddeployment.update.strategy=rolling -Ddeployment.forward.ssl=false -Ddeployment.clustered=false -Ddeployment.last.mile.security=false

Example Pipelines

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:
  • Anypoint Exchange - exchange-concourse-resource
  • Anypoint Runtime Fabric - rtf-concourse-resource
  • Jobs:
  • Verify / Publish
  • Deploy
  • About

    A simple Mule 4 API, used for testing & demonstrating Concourse pipelines.

    Topics

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Contributors 4

    •  
    •  
    •  
    •  

    Languages