Contact Us 1-800-596-4880

Adding Flex Replicas in Local 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

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.

docker run --rm \
-v <absolute-path-to-directory-with-conf-file>/:/etc/flex-gateway/rtm \
-v <absolute-path-to-directory-with-gateway-configuration-files>/:/usr/local/share/mulesoft/flex-gateway/conf.d \
-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