• 沒有找到結果。

Deploying a Flogo App to Pivotal Application Service

在文檔中 TIBCO Flogo® (頁 135-139)

After installing the Cloud Foundry Command Line Interface (cf CLI), you can push a Flogo application to the Pivotal Application Service. For more information on Pivotal Cloud Foundry, Pivotal Application Service and its CLI, refer to the Pivotal Cloud Foundry documentation.

Prerequisites

Execute the following command to ensure that the Cloud Foundry command-line client is installed successfully:

$ cf version

This command returns information about the currently installed version of the Cloud Foundry command-line client. For example:

cf version 6.42.0+0cba12168.2019-01-10

Execute the following command to authenticate yourself for Pivotal Cloud Foundry:

$ cf login

Building a Linux Binary From the Web UI

To build a Linux binary from the Web UI, follow these steps:

1. From the Flogo Enterprise Web UI, build a Linux binary using the Linux/amd64 option. See Building the App section for details.

2. Provide execute permission to the app binary: chmod +x <app-binary>

3. Follow the steps in the appropriate section below.

From the CLI

To build a Linux binary from the CLI, follow these steps:

1. Export your app as a JSON file (for example, flogo-rest.json) by clicking the Export app button on the flow details page.

2. Build a Linux binary for the app from the CLI. Open a command prompt and change directory to

<FLOGO_HOME>/<version>/bin and run:

builder-<platform>_<arch> build -p linux/amd64 -f <path-to-the-.json-file>

This will generate a linux app binary.

3. Provide execute permission to the app binary: chmod +x <app-binary>

4. Follow the steps in the appropriate section below.

Without Using a manifest.yml File Procedure

1. Create a temporary folder.

2. Copy the linux/amd64 binary of the application which you had created in Building a Linux Binary and save it to the temporary folder created in step 1.

Ensure that you do not save the binary to a path which already contains other files and directories.

In your Flogo app, for a REST trigger, ensure that port is set to 8080 in the trigger configuration.

3. In a command window, navigate to the path where you saved the binary and execute the following command:

$ cf push <NAME_IN_PCF> -c './<APP_BINARY_NAME>' -b binary_buildpack -u none

For example:

cf push test1 -c ./Timer-linux_amd64 -b binary_buildpack -u none

For the -u argument, depending upon the health check, provide value as none, port, http, or

process. For example, if the application is a REST API exposing HTTP endpoint, use port after -u. In your Flogo app, for a REST trigger, ensure that port is set to 8080 in the trigger

configuration.

4. After successfully deploying the application to the Pivotal Application Service, you can check the log of the application using the following command:

$ cf logs <APP_NAME_IN_PCF> --recent

Using a manifest.yml File Procedure

1. Create a temporary folder.

2. Copy the linux/amd64 binary of the application which you had created in Building a Linux Binary and save it to the temporary folder created in step 1.

In your Flogo app, for a REST trigger, ensure that port is set to 8080 in the trigger configuration.

You have two options:

If you do not mention Path in the manifest.yml file, you must have both manifest.yml and the application binary in same directory.

If you have the manifest.yaml and application binary in different directories, you must mention the following in manifest.yml

path: <app binary path>

3. Create a manifest file in YAML. The following manifest file illustrates some YAML conventions:

# this manifest deploys REST APP to Pivotal Cloud Foundry applications:

REST-linux_amd64 indicates the name of application binary.

4. Save the manifest.yml and execute the following command in the same directory:

$ cf push

Result

The Flogo application is successfully pushed to Pivotal Cloud Foundry.

Using Spring Cloud Configuration to Override Flogo App Properties

You can use Spring Cloud Configuration to override properties of Flogo apps running on Pivotal Cloud Foundry.

1. Create a Repository and Properties File on Github

2. Setup Spring Cloud Configuration on Pivotal Cloud Foundry

3. Use Spring Cloud Configuration Service with Flogo

Create a Repository and Properties File on Github Procedure

1. Create a repository on Github.

2. In the repository created in step 1, create a property file with the following file naming convention:

<APP_NAME>-<PROFILE>.properties

For example, if a Flogo app name is PCFAPP and profile name is DEV, the properties file name must be PCFAPP-DEV.properties.

3. Populate the <APP_NAME>-<PROFILE>.properties file with the key-value pairs for the overridden App properties.

The name of the property must match the name of the application property. For example, if the application property is named Message, define the property in the properties file as:

Message="<value>"

If the properties are in a group, define the property as:

<groupname>.<propertyname> = <value>

For example, if a property username is under the email group and its value is

[email protected], define the property in the .properties file as:

[email protected]

Setup Spring Cloud Configuration on Pivotal Cloud Foundry

Set up an instance of Config Server for Pivotal Cloud Foundry with the Git repository created above using Spring Cloud Services on Pivotal Cloud Foundry. Refer to Spring Cloud Services for PCF documentation for detailed instructions.

Use Spring Cloud Configuration Service with Flogo Procedure

1. Bind the service instance of Spring Cloud Config Server to your Flogo app.

2. Navigate to the setting of the pushed application.

3. Under User Provided Env Variables, add the following environment variable.

FLOGO_APP_PROPS_SPRING_CLOUD = {"profile":"<PROFILE_NAME>"}

4. Restage the app and see the logs using the following command:

$ cf logs <APP_NAME_IN_PCF> --recent

在文檔中 TIBCO Flogo® (頁 135-139)

相關文件