Remotely debugging a TIBCO Streaming server in a Docker container

Remotely debugging a TIBCO Streaming server in a Docker container

book

Article ID: KB0075530

calendar_today

Updated On:

Products Versions
TIBCO Streaming -

Description

How can I use the StreamBase Studio Test/Debug perspective EventFlow debugger on an application running in a Docker container in a cloud environment?

Issue/Introduction

Configure and expose server port, debug port, and discovery service port to the StreamBase Studio network.

Resolution

There are several required configuration settings needed to attach the StreamBase Studio debugger to an already running remote application.


1. Configure the application StreamBase Engine  (type = "com.tibco.ep.streambase.configuration.sbengine") HOCON configuration file, jvmArgs section, to include the setting:
  -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
Port 8000 is the default debug port. If this port conflicts with other services, change it to a free port.

For example:
 configuration = {   StreamBaseEngine = {     jvmArgs = [       "-Xmx3g"       "-Xms512m"       "-XX:+UseG1GC"       "-XX:MaxGCPauseMillis=500"       "-XX:ConcGCThreads=1"       "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000"     ]
The "suspend=n" option may be replaced with "suspend=y" in order to stop at breakpoints within custom adapter Java init() and typecheck() methods.


2. Configure the application Client API Listener (type = "com.tibco.ep.streambase.configuration.sbclientapilistener") configuration to have a known port. Port 10000 is the default, but it may also be changed to a free port.

For example:
   ClientAPIListener = {     apiListenerAddress = {       portNumber = 10000



3. Start the container with the client port, debug port, and service discovery port exposed on the same network on which StreamBase Studio is running:

$ docker network create --driver bridge sbnet
$ docker run -d --name dt --network=sbnet -e NODENAME=A.DT -e DISCOVERY=54321 -p 8000:8000 -p 10000:10000 -p 54321:54321/udp dt_app


In this example the default ports are used and not aliased to different host ports, the name of the image is "dt_app", and the container is given name "dt". The "sbnet" bridge network was previously created to allow multiple docker containers to communicate. The network may be given any name, "sbnet" is not special. The "sbnet" network is not required for this example, but included since this is frequently used.

You may confirm from the host that the application is accessible on the network using commands:
  epadmin display services
  epadmin servicename=A.DT display engine



4. In StreamBase Studio create a Debug Configuration (also known as a Launch Configuration, or Run Configuration) under the "Attach to EventFlow Fragment" list. Specify the hostname and ports to used to expose the node and container on the network. Identify the EventFlow module (.sbapp) which is running as the top-level application in the "default" container.

Example:
Shows configuration settings for URL, .sbapp, and debug port in an Attach to EventFlow fragment debug configuration

Click "Debug" to start the session.

If the application to be debugged is not running in the "default" container, change the "Target EventFlow Fragment URI:" to include the container name as so:
  sb://hostname:port/containername