Registering and Running in Local Mode with a Token
Before You Begin
Before registering Flex Gateway, you must complete the following tasks:
-
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 registration token for the environment in Anypoint Platform where you want to run Flex Gateway
Navigate to Runtime Manager, select Flex Gateway in the left navigation, and click Add Gateway to generate set of instructions that includes a command block with the registration token.
-
Register and Run with a Token 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.
Substitute Collected Information
Before executing the registration command, replace the following sample information with the information you collected:
-
--token
= the registration token for your environment in Anypoint Platform -
--organization
= your Organization ID in Anypoint Platform -
--split
(optional) = the flag that determines whether registration information should split into multiple files. The default value isfalse
.If
split
is set totrue
, registration information is split into two files:registration.yaml
andcertificate.yaml
. Iffalse
, 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 \
--token=<your-registration-token> \
--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 thesplit
registration parameter is set totrue
, otherwise certificate information will be contained inregistration.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. |
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
Register and Run with a Token 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:
-
--token
= the registration token for your environment in Anypoint Platform -
--organization
= your Organization ID in Anypoint Platform -
--split
(optional) = the flag that determines whether registration information should split into multiple files. The default value isfalse
.If
split
is set totrue
, registration information is split into two files:registration.yaml
andcertificate.yaml
. Iffalse
, 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 -u $UID mulesoft/flex-gateway \
register \
--token=<your-registration-token> \
--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 thesplit
registration parameter is set totrue
, otherwise certificate information will be contained inregistration.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. |
Start Command
Before executing the start command below, update the absolute path to the directory where your Flex Gateway configuration and registration files reside.
docker run --rm \
-v <absolute-path-to-directory-with-gateway-files>/:/usr/local/share/mulesoft/flex-gateway/conf.d \
-p 8080:8080 \
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> \ .
|
The Docker logs should include this line:
[flex-gateway-envoy][info] all dependencies initialized. starting workers
Register and Run with a Token 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:
-
--token
= the registration token for your environment in Anypoint Platform -
--organization
= your Organization ID in Anypoint Platform -
--split
(optional) = the flag that determines whether registration information should split into multiple files. The default value isfalse
.If
split
is set totrue
, registration information is split into two files:registration.yaml
andcertificate.yaml
. Iffalse
, 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 -u $UID mulesoft/flex-gateway \
register \
--token=<your-registration-token> \
--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 thesplit
registration parameter is set totrue
, otherwise certificate information will be contained inregistration.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. |
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.
-
Add the Flex Gateway Helm repository:
helm repo add flex-gateway https://flex-packages.anypoint.mulesoft.com/helm
-
Update the Helm repository using the following command:
helm repo up
-
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
-