Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Latest commit

 

History

History
95 lines (73 loc) · 4.29 KB

File metadata and controls

95 lines (73 loc) · 4.29 KB

TaskLauncher Cloud Foundry Sink

The TaskLauncher-CloudFoundry sink consumes a TaskLaunchRequest message, then deploys and launches a task onto a Cloud Foundry instance using the Cloud Foundry Spring Cloud Deployer. With that being said a single TaskLauncher-CloudFoundry can launch different tasks based on the artifact that is specified in the TaskLaunchRequest.

Input

Headers:

  • Content-Type: application/octet-stream

Payload:

A byte array containing the TaskLaunchRequest

Output

N/A (deploys and launches task to a Cloud Foundry instance).

Using the TaskLauncher

The task launcher deploys and launches a Spring Cloud Task Boot application as a task on the Cloud Foundry Platform based on contents from the TaskLaunchRequest message that it receives. The TaskLaunchRequest contains attributes that are used by the task launcher to execute the task:

  • uri - contains the uri to the Spring Cloud Task Boot application artifact that the task launcher will deploy to the Cloud Foundry Platform.

  • commandLineArguments - list of commandlineArguments to be used by the Spring Cloud Task Boot application.

  • deploymentProperties - properties to be used by the task launcher to deploy the task to the platform.

Note
Any message received by the sink, that does not contain a TaskLaunchRequest will log an error.

Remote Repositories

If the tasklauncher-cloudfoundry app needs to resolve artifacts from remote maven repositories, be sure to set the --maven.remote-repositories properties. For example:

java -jar task_launcher_cloudfoundry.jar --maven.remote-repositories.repo1.url=https://repo.spring.io/libs-snapshot
spring.cloud.deployer.cloudfoundry.api-timeout

Timeout for blocking API calls, in seconds. (Long, default: 360)

spring.cloud.deployer.cloudfoundry.domain

The domain to use when mapping routes for applications. (String, default: <none>)

spring.cloud.deployer.cloudfoundry.org

The organization to use when registering new applications. (String, default: <none>)

spring.cloud.deployer.cloudfoundry.password

Password to use to authenticate against the Cloud Foundry API. (String, default: <none>)

spring.cloud.deployer.cloudfoundry.services

The names of services to bind to all applications deployed as a module. This should typically contain a service capable of playing the role of a binding transport. (Set<String>, default: <none>)

spring.cloud.deployer.cloudfoundry.skip-ssl-validation

Allow operation using self-signed certificates. (Boolean, default: false)

spring.cloud.deployer.cloudfoundry.space

The space to use when registering new applications. (String, default: <none>)

spring.cloud.deployer.cloudfoundry.url

Location of the CloudFoundry REST API endpoint to use. (URL, default: <none>)

spring.cloud.deployer.cloudfoundry.username

Username to use to authenticate against the Cloud Foundry API. (String, default: <none>)

Build

$ ./mvnw clean install -PgenerateApps
$ cd apps

You can find the corresponding binder based projects here. You can then cd into one one of the folders and build it:

$ ./mvnw clean package

Examples

The following example assumes a TaskLaunchRequest payload is sent to a default destination called input, the sink retrieves the uri of the task jar, the command line arguments, and deployment properties from the TaskLaunchRequest, which it uses to deploy and launch the task.

java -jar task_launcher_cloudfoundry.jar --maven.remote-repositories.repo1.url=https://repo.spring.io/libs-snapshot \
    --spring.cloud.deployer.cloudfoundry.url=https://api.local.pcfdev.io \
    --spring.cloud.deployer.cloudfoundry.org=user-dataflow \
    --spring.cloud.deployer.cloudfoundry.space=development \
    --spring.cloud.deployer.cloudfoundry.domain=local.pcfdev.io \
    --spring.cloud.deployer.cloudfoundry.username=admin \
    --spring.cloud.deployer.cloudfoundry.password=admin \
    --spring.cloud.deployer.cloudfoundry.skipSslValidation=true \
    --spring.cloud.deployer.cloudfoundry.taskTimeout=300