Adding Flex Replicas in Local Mode
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 three registration files to a directory on your Linux machine or VM. For example:
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,
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
Finally, edit the file with vim using the following command:
sudo vi env.conf
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
.conffile 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 +
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
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
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.
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 absolute path to the directory where your Flex Gateway configuration files will reside and the FLEX_NAME with 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 \ -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
The Docker logs should include this line:
[flex-gateway-envoy][info] all dependencies initialized. starting workers