Quick Start

Overview

Use this quick start section to get your TIBCO Cloud™ API Management - Local Edition Docker images built and deployed with minimal (one container of each component) and default configuration on a single Linux-based or MacOS-based host.

This creates the API Management - Local Edition cluster in untethered mode.

Software Prerequisites

  • Docker must be installed and running on your machine.
    Note: To check if you have Docker installed, run command docker ps or docker info on a terminal screen to verify it is installed and running. If the command is not found, you need to install Docker. For all platforms, see the Docker documentation.
  • Docker has been allocated a minimum of 6GB memory for Local Edition cluster and Installer.
    Note:
    1. Click the Docker icon.
    2. Click Preferences.



    3. Go to Advanced tab as shown below.



  • 'jq' must be installed on the machine.
  • You have the Local Edition Installer in tar.gz format (Example : TIB_mash-local_5.2.0.60_cf.tar.gz) on your machine.

Platform Prerequisites

The quick start setup is supported on Linux-based and MacOS-based machines. Quick start uses the local physical machine and not a virtual machine. It sets up a bare-metal swarm cluster of one node (the local physical machine) and one instance of each type of component. It creates a Docker overlay network for the components to communicate over. There are no additional prerequisites for the quick start setup.

Planning

The Local Edition cluster has a single, logical zone, one instance of each type of component, and uses the local machine as the single node. No additional planning is required for the quick start setup.

Configuration

The Local Edition cluster created using the quick start setup uses the untethered mode of configuration. It uses default credentials and does not need any user inputs to configure the properties, sizes or credentials.

Building and Deploying

  1. Extract the Installer tar.gz file to your desired location and navigate to the folder /<Extracted Folder>/tml-quickstart/ on your terminal.
  2. For a smooth execution, you should stop any previously running tml-installer container (if any) and remove the volume associated with it. Execute the following commands in sequence. This step can be skipped if you are running tml-installer for the first time.
    Sample execution
    1. docker ps -a
      
    2. docker kill <tml-installer container id>
    3. docker volume rm -f tml-quickstart_jenkinsvol
  3. Execute the script quick-start.sh with parameters. The script accepts two parameters:
    • -b - Set to true to build the images.
    • -d - Set to true to create a Local Edition cluster.

    Currently, these parameters are mandatory.

    Sample execution
    ./quick-start.sh -b true -d true

    The installer will use default inputs and build the Local Edition images.

    The quick start script will then create an overlay Docker network, use swarm to create a single node cluster and proceed to create the simple Local Edition cluster.

    If everything goes well, the Local Edition cluster should be ready in around 30-35 minutes (Including Local Edition image building and deployment). At the end of the deployment stage, you may see the message Waiting for TML components to be ready for a long time (10-15 minutes) until everything is active.

  4. The Developer Portal can be accessed at https://localhost:10443/ and Configuration Manager can be accessed at https://localhost:10443/admin.
    Note: Since the cluster is created with default values, you can use the following default username and password to login into Configuration Manager:

    UserName: admin

    Password: Ap1Us3rPasswd

    The default username and password used to log in to the Configuration Manager can also be found in the tml_papi_properties.json file (see the Platform API Properties topic in Configuring Properties Common to all Deployments).

Troubleshooting

If you see the error Error response from daemon: This node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again during execution, follow the steps below:
  1. Stop/kill the running script.
  2. Run docker swarm init.
  3. Rerun the quick start with parameters:
    ./quick-start.sh -b false -d true

Other Use Cases

To only build the image, run the following script:
./quick-start.sh -b true -d false
If you built the image previously, and now want to run deployment only, run the following script:
./quick-start.sh -b false -d true

Validating the TIBCO Cloud™ API Management - Local Edition Cluster

Now that the build stage is done, if the deployment is still running, you can check on the progress using following steps:
  1. Check the running Docker processes:
    $ docker ps
    CONTAINER ID        IMAGE                      COMMAND                  CREATED              STATUS                   PORTS                                              NAMES
    8544fa2e38d4        tml-tm:v5.2.0.1            "/usr/local/bin/tm-e…"   About a minute ago   Up About a minute        22/tcp, 80/tcp, 443/tcp, 8000/tcp, 8083-8084/tcp   tmstack_tm.1.i40jamp8r5m6x6zoszezl7y0h
    45bda152014d        tml-cache:v5.2.0.1         "/usr/local/bin/cach…"   About a minute ago   Up About a minute        11211-11216/tcp                                    cachestack_cache.1.nylb994ie42d7isjndap3cpvw
    62186c91e18e        tml-sql:v5.2.0.1           "/usr/local/bin/sql-…"   About a minute ago   Up About a minute        3306/tcp                                           sqlstack_sql.1.4uk80bcz1dbrbpephki0ikx6r
    5b22a452dc9f        tml-log:v5.2.0.1           "/usr/local/bin/log-…"   About a minute ago   Up About a minute        24023/tcp, 24220/tcp, 24224/tcp                    logstack_log.1.ue4vb7di5ir8sl55hb8y28fjl
    5a527d7ef2ab        tml-cm:v5.2.0.1            "/usr/local/bin/cm-e…"   2 minutes ago        Up 2 minutes (healthy)                                                      cmstack_tmlcm.1.tj6dbpr1p6zjk4gfh482iwlmh
    365297c18733        tml-nosql:v5.2.0.1         "/usr/local/bin/nosq…"   2 minutes ago        Up 2 minutes (healthy)   7000-7001/tcp, 7199/tcp, 9042/tcp, 9160/tcp        nosqlstack_nosql_seed.1.n2ci4fu3i75kc80lq7p49v24x
    5bd04361f7ee        tml-installer:v5.2.0.119   "/sbin/tini -- /usr/…"   26 minutes ago       Up 26 minutes            0.0.0.0:8080->8080/tcp, 0.0.0.0:50000->50000/tcp   tml-installer
    
  2. Log in to the Configuration Manager container and check the components and their states:
    $ docker exec -ti 5a527d7ef2ab bash
    [root@5a527d7ef2ab builder]#
    [root@5a527d7ef2ab builder]# alias cm=clustermanager
    [root@5a527d7ef2ab builder]# cm ls components
    Using cluster [Tibco Mashery Local Reference Cluster]
    Using Zone [local]
    Component ID                          Type            Name      Status      Last Heartbeat Received      Host        Service Port(s)            
    ------------------------------------- --------------- ------ ----------- ----------------------------  ------------ ---------------------------
    b38efc8f-bffa-4a68-bcf5-a21370434b78  cache           cache    ACTIVE      Mar 12 2020 08:59:09 +0000  10.0.0.12     11212,11211,11213,11214,11215,11216
    f1d75242-4c67-4eb9-a8b3-63195689410c  configmanager   cm       RESOLVED    Mar 12 2020 08:59:25 +0000  10.0.0.6      7080
    11261544-ef93-4d1f-8da9-af71b1593763  logservice      log      ACTIVE      Mar 12 2020 08:59:30 +0000  10.0.0.8      24224
    66157d26-43b5-40ff-aefe-b1f52aa2f44b  nosql           nosql    ACTIVE      Mar 12 2020 08:59:09 +0000  10.0.0.3      9042
    fa66dcbb-35af-4fb3-bc87-09382c0f20ef  sql             sql      ACTIVE      Mar 12 2020 08:59:34 +0000  10.0.0.10     3306
    84792b97-b4ba-4a28-b7f4-1b5cfbd6c76a  trafficmanager  tm       STANDBY     Mar 12 2020 08:59:28 +0000  10.0.0.14     8080
    
  3. Check the status of the overall cluster and see what action is pending:
    [root@5a527d7ef2ab builder]# cm cluster status
    *** Checking the status of Cluster 'Tibco Mashery Local Reference Cluster' ***
    *** Checking the status of zone 'local' ***
    TML component [66157d26-43b5-40ff-aefe-b1f52aa2f44b] of type [nosql] found with status [ACTIVE] on Host IP [10.0.0.3]..
    TML component [11261544-ef93-4d1f-8da9-af71b1593763] of type [logservice] found with status [ACTIVE] on Host IP [10.0.0.8]..
    TML component [fa66dcbb-35af-4fb3-bc87-09382c0f20ef] of type [sql] found with status [ACTIVE] on Host IP [10.0.0.10]..
    TML component [b38efc8f-bffa-4a68-bcf5-a21370434b78] of type [cache] found with status [ACTIVE] on Host IP [10.0.0.12]..
    TML component [84792b97-b4ba-4a28-b7f4-1b5cfbd6c76a] of type [trafficmanager] found with status [STANDBY] on Host IP [10.0.0.14]. See details below
    Component ID                          Component Name       Component IP         Component Status     Pending Activity     Error
    ------------------------------------- -------------------- -------------------- -------------------- -------------------- ------------------------------
    84792b97-b4ba-4a28-b7f4-1b5cfbd6c76a  tm                   10.0.0.14            Not Ready
    
  4. After some time, the cluster status should turn READY. You can check the last failing component for its individual status as follows. In this case, the Traffic Manager is running on 10.0.0.14 IP:
    [root@5a527d7ef2ab builder]# curl http://10.0.0.14:9080/container/status
    {
      "tmgcId" : "84792b97-b4ba-4a28-b7f4-1b5cfbd6c76a",
      "ip" : "10.0.0.14",
      "name" : "tm",
      "pending_activity" : "checking component status ...",
      "status" : "Ready"
    }

    As seen in previous step, the Traffic Manager is in ready status, despite what the pending activity indicates. The pending activity was the last successful activity performed by the container agent.

  5. If the status indicates error, check the log-service container for corresponding errors.
    1. Log in to the logservice container
    2. Check the appropriate log files in the /mnt/data directory
    3. Check for any errors in the Configuration Manager container. For example, check the /mnt/data/tml-cm directory.

Creating the Cluster Configuration

Follow these steps to create a "Hello World" API example using Configuration Manager.
  1. Login to Configuration Manager.



  2. Click on API Domains to whitelist your public and internal API domains. Create a new entry for the external and internal domain you plan to use.

  3. Here, create two entries:
    • api.example.com: The public domain name that you plan to use.
    • <your local IP address>: To access your internal Hello World service that runs on your local machine.
  4. Return to the main screen and click API Definitions. This is where you'll link your public and internal APIs.



  5. Create an API called HelloApi.
  6. Click on Endpoints on the left-hand pane. Now you can link the public and internal domains that you whitelisted earlier and specify the API path details.



    The published Endpoint will specify the publicly accessible domain and path for your API. In this example, it is api.example.com.

    The Origin Endpoint contains details about the service to be accessed. For this example, your hello service is used, which runs on your <local ip> on port 9080 with path /hello.
    Note: In the Origin Endpoint, add port 9080 after your local IP and use path /hello only to access the inbuilt Hello Service.
  7. Return to the main screen and click on API Packages. For your reference, the API package is called Hello Package.



  8. Click on Plans on the left-hand pane and create a new Plan. For your reference, the Plan is called Hello Plan.



  9. Click on Definitions to link your previously created endpoint to this package and plan.



    Activate the API definition to associate with your package and plan from the list of "Available API Definitions".

    Once you activate the API definitions, they will show up as Activated API Definitions as seen in the previous screenshot.

  10. Return to the main screen and click on Applications. Create a new Application and select a member for it.



  11. Click Package Keys on the left-hand pane and create a new API key for your service.
  12. Choose your package and plan. In this example, select Hello Package and Hello Plan. Make sure the status is changed to Active, then click Save.



  13. When you click on Package Keys in the left-hand pane, you should see the API key as Active.



  14. Once the API key is Active, note your API key value. Your endpoint will now flow through Local Edition and should be available for successful invocation in a maximum of 15 minutes.
  15. Test the API key by invoking the curl call:
    $ curl -H 'Host: api.example.com' 'http://localhost/hello?api_key=bwhm6qasmuwrpd5uzu4h648j'
     
    {"time":"2019-09-09 22:36:02.630+0000","message":"Hello world"}
    Note: This curl call does not need to be run inside any containers; it can be run from the same location and way you run Docker commands.

Troubleshooting Possible Errors

After creating and activating your API, you may run into the following errors until the data flow is complete. It can take maximum 15 minutes for the API to be active.
  • Error 596:
    $ curl -H 'Host: api.example.com' 'http://localhost/hello?api_key=stgqte7fz73jdey54tahpr9c'
     
    <h1>596 Service Not Found</h1>
  • Error 403:
    $ curl -H 'Host: api.example.com' 'http://localhost/hello?api_key=stgqte7fz73jdey54tahpr9c'
    403 Forbidden

Deleting the Local Edition Cluster

Run the following command to delete a cluster:
delete-quickstart-cluster.sh .