Agents

Agents act as proxies to mediate communication among FTL applications and components deployed in separate containers on cloud hosts. Agents also assist FTL clients to discover the locations of the realm servers.

Motivation

While Docker containers are an easy way to deploy FTL components and applications, generic communications across Docker containers and hosts can be cumbersome to configure and maintain. If your applications communicate only using FTL messages, then agents can eliminate the need to configure communication among containers. (Agents implement an ambassador pattern.)

Agents and Containers

The diagram depicts two cloud server hosts on which FTL applications run in containers. An agent runs in a container on each server. The realm server runs in a container on server A.

Consider the following sequence of events:
  1. The realm server starts.
  2. Agent A starts.
  3. Agent B starts, and establishes communication with all other agents (in this example, agent A is the only other available agent).
  4. Application 1 starts, and attempts to discover the realm servers.
  5. Agent A responds to application 1, and supplies the location of the realm server (that is, its host and port).
  6. Application 1 connects directly to the realm server.
  7. Applications 2 and 3 similarly discover and connect to the realm server, with agent B supplying the realm server location.
  8. Agents A and B mediate communications between applications 1 and 2, and between applications 1 and 3.
  9. Agent B mediates communications between applications 2 and 3.

Details to Notice

The agent runs as a service in a Docker container. The realm server and application clients also run in Docker containers.

The realm server can run on any host. (If the realm server has affiliated satellites and backups, they too can run on any hosts.)

One agent service runs on each host on which an FTL component or client runs. On the agent command line, supply the locations (host and port) of the primary and secondary realm servers.

FTL clients specify only discover:// as the realm server location. The agent automatically supplies the actual locations of the primary and secondary realm servers. For example:

docker run -it --rm ftl-client tibrecvex -id tcp discover:// -c 600