Skip to content

Cloud Foundry

lakshmimekala edited this page Mar 8, 2024 · 3 revisions

Introduction

This document describes how to deploy a TIBCO BusinessEvents application container image on VMware Tanzu Application Service for VMs (TAS for VMs).

TAS for VMs is based on Cloud Foundry and one of the Cloud Foundry certified distributions, which is an open-source cloud app platform, providing a choice of clouds, developer frameworks, and app services.

Prerequisites

  • VMware Tanzu Application Service for VMs environment on your prefered cloud provider (AWS, Azure, GCP, etc) which involves installing Ops Manager and configuring TAS for VMs

Note: We have tried on Azure cloud platform with Small Footprint TAS for VMs which is a repackaging of the TAS for VMs components into a smaller deployment with fewer virtual machines (VMs), however steps outlined in this document should work similarly with other cloud providers as well as TAS for VMs.

Setup

  1. Login to the cloud foundry using the below command:

    cf login -a API-URL -u USERNAME -p PASSWORD
  • For example

    cf login -a api.system.example.com -u admin -p <password>
    
    • API-URL is your API endpoint, the URL of the Cloud Controller in your TAS for VMs instance, which is the system domain defined in domains section of TAS tile.
    • USERNAME and PASSWORD are the Admin credentials in UAA section from TAS tile Credentials tab.

    For more information on command line options refer here.

  1. Target a specific organization and space.

    cf create-org ORG
    cf create-space SPACE
    cf target -o ORG -s SPACE
  2. Enable the diego-docker feature to run docker images.

    cf enable-feature-flag diego_docker

Deployment

Follow below steps to deploy BE application image with single cache and inference agents in Cloud Foundry.

  1. Clone the repo:

    git clone https://github.com/TIBCOSoftware/be-tools.git
    cd be-tools/cloud/cloud-foundry
  2. The deployment uses manifest.yml file by default. Update the below mentioned details in the manifest.yml file.

    • Add required environment variables for your BE image in manifest.yml file in both cache and inference env sections.We have added sample environment variables from the Fraud Detection application. Ex:For FTL cluster update

       FTL/REALM_SERVER: <REALM_URL>
    • Update BE Docker image. If your docker image is in a Private repository update Docker username. While pushing the application append CF_DOCKER_PASSWORD=PASSWORD to the cf push command (in Step 3) as below:

       CF_DOCKER_PASSWORD=$PASSWORD cf push <APP-NAME> -u process

    Note: If your Private repository is AWS ECR refer here. Google Container registry refer here.

  3. Use the below command to deploy Business Events application:

    • Deploy BE applications without cache using:

      cf push inference -u process
    • Deploy BE applications with cache using:

       cf push cache -u process
       cf push inference -u process
  4. For Service discovery you need to create network policies to open communication between cache and inference applications. For BE application with Activespaces cache we need to use the below network policies:

    # Enable network communication from cache to inference on tcp port 50000
    cf add-network-policy cache inference --port 50000 --protocol tcp
    # Enable network communication from inference to cache on tcp port 50000
    cf add-network-policy inference cache --port 50000 --protocol tcp

Note: For additional examples on multiple cache nodes refer to be-tools/cloud/cloud-foundry/examples folder.

Testing

Add Route for the application port:

  1. Get the APP_GUID from the below command:

    cf app inference --guid
  2. Add the application port:

    cf curl /v2/apps/<APP_GUID> -X PUT -d '{"ports": [APP_PORT]}'
  3. Get the ROUTE_GUID from the below command:

    cf curl /v2/apps/<APP_GUID>/routes
  4. Add the required route mapping to the application:

    cf curl /v2/route_mappings -X POST -d '{"app_guid": "<APP_GUID>", "route_guid": "<ROUTE_GUID>", "app_port": <APP_PORT>}'
  5. Verify the Route mappings:

    cf curl /v2/routes/<ROUTE_GUID>/route_mappings
  6. Delete the other unneccesary route mappings:

    cf curl /v2/route_mappings/<ROUTE_MAPPING_ID> -X DELETE
  7. Obtain the route of the deployed cloud foundry application using the below command:

    cf app <APP_NAME>
  8. Test the application by using the route obtained in step 7. For example, if you have deployed the FraudDetectionStore example you can use the readme.html. Update the route in the readme.html file and follow the instructions in it to test the application.

  9. Check the application logs using below command:

    cf logs <APP_NAME> --recent

Delete App

  1. Delete app with below command

    cf delete <APPNAME>
    

example:

  • To delete app only, execute below command

    cf delete cache
    
  • To delete app and routes without confirmation, execute below command

    cf delete -rf cache
    

Note: If you wish not to delete route, omit r from the above command

Clone this wiki locally