Contact Us 1-800-596-4880

Registering and Running in Connected Mode with a Connected App

Before You Begin

Before registering Flex Gateway, you must complete the following tasks:

  • Configure a Connected App

    • Include the following scopes:

      • Read Servers

      • Manage Servers

      • View Organization

    • Save the Id and Secret of the Connected app you configure.

  • Install a Flex Gateway

  • Request Manage Servers and Read Servers permissions in Runtime Manager from your Anypoint Platform admin

  • Collect the following information from your Anypoint Platform instance:

    • The Organization ID for the organization where you want to run Flex Gateway

      See Find your Organization ID for more information on how to find your Organization ID.

    • The Environment ID for the environment where you want to run Flex Gateway

      See What API Manager Looks Like for more information on how to find your Environment ID.

Register and Run with a Connected App as a Linux Service

To register a Flex Gateway with Anypoint Platform, you must enter the registration command and then the start command. Each command includes information specific to your Anypoint Platform instance and must be updated before executing. See Before You Begin for more information on how to find the information you will need.

  • --client-id = the Id for the Connected App you configured in Access Management

  • --client-secret = the Secret for the Connected App you configured in Access Management

  • --environment = the Environment Id for the environment in Anypoint Platform where you want the Flex Gateway to run

  • --organization = your Organization ID in Anypoint Platform

  • --split (optional) = the flag that determines whether registration information should split into multiple files. The default value is false.

    If split is set to true, registration information is split into two files: registration.yaml and certificate.yaml. If false, all registration information is contained in one file: registration.yaml.

  • --output-directory (optional) = the directory in which registration information is output

  • my-gateway = the name you want to assign the gateway cluster

Registration Command

After replacing the sample content, register your Flex Gateway by executing the following command:

flexctl register \
--client-id=<your-connected-app-client-id> \
--client-secret=<your-connected-app-client-secret> \
--environment=<your-environment-id> \
--connected=true \
--organization=<your-org-id> \
--output-directory=/usr/local/share/mulesoft/flex-gateway/conf.d \
my-gateway
Use sudo if you encounter file permission issues when running this command.
If you are in Europe you will need to add the --anypoint-url=https://eu1.anypoint.mulesoft.com flag to your command.

In the output directory, you should see the following new registration file(s):

  • registration.yaml

  • certificate.yaml (generated only if the split registration parameter is set to true, otherwise certificate information will be contained in registration.yaml)

These generated files are credentials for you to connect your Flex Gateway. If you lose them you can no longer connect your Flex Gateway.

You should also see your new Flex Gateway in Runtime Manager after clicking Flex Gateway in the left navigation. The gateway’s status is disconnected for now. You need to start the gateway to connect it.

Start Commands

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 gateway’s status is connected. You may need to refresh the page.

If a Flex Replica in Connected Mode 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.

Register and Run with a Connected App in a Docker Container

To register a Flex Gateway with Anypoint Platform, you must enter the registration command and then the start command. Each command includes information specific to your Anypoint Platform instance and must be updated before executing. See Before You Begin for more information on how to find the information you will need.

Substitute Collected Information

Before executing the registration command, replace the following sample information with the information you collected:

  • --client-id = the Id for the Connected App you configured in Access Management

  • --client-secret = the Secret for the Connected App you configured in Access Management

  • --environment = the Environment Id for the environment in Anypoint Platform where you want the Flex Gateway to run

  • --organization = your Organization ID in Anypoint Platform

  • --split (optional) = the flag that determines whether registration information should split into multiple files. The default value is false.

    If split is set to true, registration information is split into two files: registration.yaml and certificate.yaml. If false, all registration information is contained in one file: registration.yaml.

  • --output-directory (optional) = the directory in which registration information is output

  • my-gateway = the name you want to assign the gateway cluster

Registration Command

After replacing the sample content, register your Flex Gateway by executing the following command:

docker run --entrypoint flexctl \
-v "$(pwd)":/registration mulesoft/flex-gateway \
register \
--client-id=<your-connected-app-client-id> \
--client-secret=<your-connected-app-client-secret> \
--environment=<your-environment-id> \
--connected=true \
--organization=<your-org-id> \
--output-directory=/registration \
my-gateway
Use sudo if you encounter file permission issues when running this command.
If you are in Europe you will need to add the --anypoint-url=https://eu1.anypoint.mulesoft.com flag to your command.

In the output directory, you should see the following new registration file(s):

  • registration.yaml

  • certificate.yaml (generated only if the split registration parameter is set to true, otherwise certificate information will be contained in registration.yaml)

These generated files are credentials for you to connect your Flex Gateway. If you lose them you can no longer connect your Flex Gateway.

You should also see your new Flex Gateway in Runtime Manager after clicking Flex Gateway in the left navigation. The gateway’s status is disconnected for now. You need to start the gateway to connect it.

Start Command

Before executing the start command below, update the absolute path to the directory where your Flex Gateway registration files reside.

docker run --rm \
-p 8080:8080 \
-v <absolute-path-to-directory-with-gateway-registration-files>/:/usr/local/share/mulesoft/flex-gateway/conf.d \
mulesoft/flex-gateway
Specify an optional name you want to assign to your Flex Replica by including the following: -e FLEX_NAME=<name-for-flex-replica> \.

Now if you check in Runtime Manager after clicking Flex Gateway in the left navigation, your gateway’s status is connected. You may need to refresh the page.

If a Flex Replica in Connected Mode 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.

Register and Run with a Connected App as a Kubernetes Ingress Controller

To register a Flex Gateway with Anypoint Platform as a Kubernetes ingress controller, you must enter the registration command and then install the flex-gateway Helm chart. Each command includes information specific to your Anypoint Platform instance and must be updated before executing. See Before You Begin for more information on how to find the information you will need.

Substitute Collected Information

Before executing the registration command, replace the following sample information with the information you collected:

  • --client-id = the Id for the Connected App you configured in Access Management

  • --client-secret = the Secret for the Connected App you configured in Access Management

  • --environment = the Environment Id for the environment in Anypoint Platform where you want the Flex Gateway to run

  • --organization = your Organization ID in Anypoint Platform

  • --split (optional) = the flag that determines whether registration information should split into multiple files. The default value is false.

    If split is set to true, registration information is split into two files: registration.yaml and certificate.yaml. If false, all registration information is contained in one file: registration.yaml.

  • --output-directory (optional) = the directory in which registration information is output

  • my-gateway = the name you want to assign the gateway cluster

Registration Command

After replacing the sample content, register your Flex Gateway by executing the following command:

docker run --entrypoint flexctl \
-v "$(pwd)":/registration mulesoft/flex-gateway \
register \
--client-id=<your-connected-app-client-id> \
--client-secret=<your-connected-app-client-secret> \
--environment=<your-environment-id> \
--connected=true \
--organization=<your-org-id> \
--output-directory=/registration \
my-gateway
Use sudo if you encounter file permission issues when running this command.
If you are in Europe you will need to add the --anypoint-url=https://eu1.anypoint.mulesoft.com flag to your command.

In the output directory, you should see the following new registration file(s):

  • registration.yaml

  • certificate.yaml (generated only if the split registration parameter is set to true, otherwise certificate information will be contained in registration.yaml)

These generated files are credentials for you to connect your Flex Gateway. If you lose them you can no longer connect your Flex Gateway.

You should also see your new Flex Gateway in Runtime Manager after clicking Flex Gateway in the left navigation. The gateway’s status is disconnected for now. You need to start the gateway to connect it.

Install Helm Chart into the Namespace

Before installing, ensure that you have:

  • Helm, a tool used to install Flex Gateway, monitoring tools, and applications. A minimum Helm version of 3.0.0 is required.

    Refer to the Helm Chart Configuration Options for information about customizing the chart.

    1. Add the Flex Gateway Helm repository:

      helm repo add flex-gateway https://flex-packages.anypoint.mulesoft.com/helm
    2. Update the Helm repository using the following command:

      helm repo up
    3. Using Ingress, install the flex-gateway Helm chart into the gateway namespace.

      helm -n gateway upgrade -i --create-namespace --wait ingress flex-gateway/flex-gateway \
      --set-file registration.content=registration.yaml

      The command returns something similar to the following:

      NAME: ingress
      LAST DEPLOYED: Tue Oct 19 13:08:07 2021
      NAMESPACE: gateway
      STATUS: deployed
      REVISION: 1
      TEST SUITE: None

Now if you check in Runtime Manager after clicking Flex Gateway in the left navigation, your gateway’s status is connected. You may need to refresh the page.

If a Flex Replica in Connected Mode 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.

Helm Chart Configuration Options

The following command describes the configurable options of the Flex Gateway Ingress Controller Helm chart:

helm show values flex-gateway/flex-gateway

To view the Helm chart README, execute the following:

helm show readme flex-gateway/flex-gateway