Contact Us 1-800-596-4880

Adding Flex Replicas in Connected Mode

Before You Begin

Before getting started, ensure you have completed the following tasks:

Add a Flex Replica as a Linux Service

Adding a Flex Replica as a Linux Service includes the following tasks:

  • Copy and paste the three registration files created during registration to your Linux machine or VM.

  • Create the configuration folder and file and edit the contents of the file

  • Run the Flex Gateway start command.

Copy the Registration Files

Copy the three registration files to a directory on your Linux machine or VM. For example:

  • 6eb79785-c2f0-4e06-b574-8a030a321d74.conf

  • 6eb79785-c2f0-4e06-b574-8a030a321d74.key

  • 6eb79785-c2f0-4e06-b574-8a030a321d74.pem

Determine the path where these files live by using the command, pwd, then save the path and the UUID, or name, of the .conf file for later use. For example, /Users/jane/flex-gateway/6eb79785-c2f0-4e06-b574-8a030a321d74.conf.

Create Configuration Folder and File

Before executing the start command, you must create a configuration directory and file and edit the contents of that file.

First create the configuration directory using the following command:

sudo mkdir /etc/systemd/system/flex-gateway-agent.service.d/

Afterwards, create a configuration file within that directory and name it env.conf.

Finally, edit the file with vim using the following command:

sudo vi env.conf

Add Configuration Content

Add the content below to the env.conf file, after replacing the following sample content with your own:

  • <path-and-uuid-of-conf-file>.conf = the path and UUID of the .conf file that was created when you registered the gateway

  • <name-for-flex-replica> = a name for your Flex Replica

[Service]

Environment=FLEX_RTM_ARM_AGENT_CONFIG=<path-and-uuid-of-conf-file>.conf
Environment=FLEX_NAME=<name-for-flex-replica>

After you have added the content to the env.conf file, save the file with ESC + :wq.

Start Commands

Reload the env.conf configuration with the following command:

sudo systemctl daemon-reload

Start Flex Gateway with the following command:

sudo systemctl start flex-gateway

Verify that the Flex Gateway service is running successfully:

systemctl list-units flex-gateway*

You should see a list of services. Flex Gateway is successfully running if each service has a status of active.

  UNIT                              LOAD   ACTIVE SUB     DESCRIPTION
  flex-gateway-fluent-reloader.path loaded active waiting flex-gateway-fluent-reloader.path
  flex-gateway-agent.service        loaded active running flex-gateway-agent.service
  flex-gateway-envoy.service        loaded active running flex-gateway-envoy.service
  flex-gateway-fluent.service       loaded active running flex-gateway-fluent.service
  flex-gateway.service              loaded active exited  Application

Now if you check in Runtime Manager after clicking Flex Gateway in the left navigation, your Flex Gateway will have an additional replica listed. You may need to refresh the page.

Currently, you cannot unregister or delete Flex Replicas. If a Flex Replica is stopped it will be removed from the UI in Runtime Manager after 30 days. Otherwise, it will appear in the Runtime Manager UI even if it is no longer running.

Add a Flex Replica in a Docker Container

To add a Flex Replica in a Docker Container you must run the Flex Gateway start command using the file path and name of the same .conf file created during registration. If you are running the container locally, you will also need to use a different port.

Start Command

Before executing the start command below, update the placeholder text with the absolute path to the directory with the .conf file, and the UUID of the .conf file. Additionally, update the FLEX_NAME to the name you want to assign to your Flex Replica.

docker run --rm \
-v <absolute-path-to-directory-with-conf-file>/:/etc/flex-gateway/rtm \
-p 8080:8080 \
-e FLEX_RTM_ARM_AGENT_CONFIG=/etc/flex-gateway/rtm/<UUID-of-your-file>.conf \
-e FLEX_NAME=<name-for-flex-replica> \
mulesoft/flex-gateway

Now if you check in Runtime Manager after clicking Flex Gateway in the left navigation, your Flex Gateway will have an additional replica listed. You may need to refresh the page.