Building a TIBCO Flogo® App Executable from an Existing App with the API
Using the API you can build an app executable for an existing Flogo app. The executable can then be deployed and run outside the TIBCO Cloud™. After building the executable, use the GET /v1/subscriptions/{subscriptionLocator}/apps/{appId}/flogo/build
method to download it.
Note: A best practice is to validate the source app in the User Interface before building the executable.
Considerations
- The source app for the executable must contain a trigger for at least one flow or the executable is not built.
- Executables cannot be built for apps pushed using the TIBCO Cloud™ Integration API or the TIBCO Cloud™ - Command Line Interface.
- App executables cannot be built for apps that use:
- TIBCO Cloud™ Mesh — Specifically, apps that include an InvokeRESTService activity configured to use services from TIBCO Cloud Mesh by setting the Discover services from the TIBCO Cloud Mesh option to True
- TIBCO Cloud™ Live Apps connectors
- TIBCO Cloud™ AuditSafe connectors
- TIBCO Flogo® Connector for GitHub
- gRPC trigger
- Custom Golang code
To build an app executable you need the following:
- Subscription Locator — The Subscription Locator of the Organization you want to access. To find Subscription Locators for your organizations use the
GET /v1/userinfo
method to return a list of all of the organizations for your OAuth Token with their Subscription Locators. You can use 0 as the Subscription Locator for the organization that owns the OAuth token. - App ID — ID of the app to be accessed, which can be retrieved using the
GET /v1/subscriptions/{subscriptionLocator}/apps
method. This is the ID of the source app for the executable.
- Use the
POST /v1/subscriptions/{subscriptionLocator}/apps/{appId}/flogo/build
method to build an app executable. - Include the
os
query parameter to select an operating system build option that is compatible with your operating system. Default is linux. Options include linux, darwin, or windows. - Include the
arch
query parameter to select a system architecture that is compatible with your system. Options include amd64 or 386. Default is amd64.Note: Refer to https://golang.org/doc/install/source#environment for additional supported os and arch options. - As the executable builds messages are updated in the response body. When the process is complete, a success message or error message is sent in the response.
Note: Executables are removed from the TIBCO Cloud™ when they are downloaded or after 24 hours.
Sample Script
The following script shows how to build, download, run, and cleanup your executable.
Copy
#!/bin/bash
#CIC Token
CIC_TOKEN="<your OAuth token>"
#Flogo App Id
appId="pbqkrdkwhac56ptzwmrpm4wl2wi376w3"
OS=darwin
Arch=amd64
Compress=true
# This example assumes you are in the AWS US region
BuildBinary() {
code=$(curl -X POST "https://api.cloud.tibco.com/tci/v1/subscriptions/0/apps/${appId}/flogo/build?os=${OS}&arch=${Arch}" -w "%{http_code}" -H "accept: application/json" -H "Authorization: Bearer ${CIC_TOKEN}" -o output.json)
echo "Status code: ${code}"
if [[ "$code" != "200" ]]; then
echo "Build Binary failed, due to: "
cat output.json
exit 1
fi
Status=$(jq -r ".[-1].status" output.json)
if [[ "$Status" == "error" ]]; then
echo "Build binary for appId: ${appId} error"
jq -r ".[-1].details" output.json
exit 1
else
echo "Build binary for AppId succesfully"
fi
}
DownloadBinary() {
curl -X GET "https://api.cloud.tibco.com/tci/v1/subscriptions/0/apps/${appId}/flogo/build?os=${OS}&arch=${Arch}&compress=${Compress}" -H "accept: application/octet-stream" -H "Authorization: Bearer ${CIC_TOKEN}" -o binaryApp
}
RunBinary() {
chmod u+x binaryApp
./binaryApp
}
cleanup() {
rm -rf binaryApp output.json
}
cleanup
BuildBinary
DownloadBinary
RunBinary
Role Requirements
- Admins can build an executable for any app in their organization.
- Users can build an executable for any app they own.
- Read-only users cannot build an executable for any app.
Related Topics
Managing Apps with the TIBCO Cloud™ Integration API
Downloading a TIBCO Flogo® App Executable Using the App ID with the API