Skip to content

Instantly share code, notes, and snippets.

@pedes
Last active November 14, 2023 16:05
Show Gist options
  • Save pedes/d515ba61df6b9096f77e1d588db346d2 to your computer and use it in GitHub Desktop.
Save pedes/d515ba61df6b9096f77e1d588db346d2 to your computer and use it in GitHub Desktop.

Cheatsheet for MuleSoft Flex Gateway

Install & Run the Container

docker pull mulesoft/flex-gateway:latest

Repository for docker image: https://hub.docker.com/r/mulesoft/flex-gateway/tags

docker run -d --rm -v $(pwd):/usr/local/share/mulesoft/flex-gateway/conf.d -p 8081:8081 mulesoft/flex-gateway

Troubleshooting tip

If the flex is not properly registered, re-run the container from the /flex folder, where you have the registration.yaml file

So, first stop the running container docker container stop $(docker ps -q)

Location of Logs

/var/tmp/mulesoft/flex-gateway/logs

Sample commands to find logs and its configuration docker exec CONTAINER_ID cat /var/tmp/mulesoft/flex-gateway/logs/current

docker logs CONTAINER_ID

Find the container ID with docker ps

Tracing ID header is X-Request-ID

More info: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/observability/tracing

Key Config folders

/usr/local/share/mulesoft/flex-gateway/conf.d

/etc/mulesoft/flex-gateway/fluent

/etc/mulesoft/flex-gateway/conf.d

/var/tmp/mulesoft/flex-gateway

Fluent Bit Config file /var/tmp/mulesoft/flex-gateway/fluent-bit.conf

Useful Commands

List the images and versions, filtered by Flex

docker images mulesoft/flex-gateway

Connect to the container through the terminal

docker exec -it bbca9200bb8b73a2297da99da4fea7bc66fbe0de3db5f3339aaba950c6e0cc9f bash

List the files in the config folder, from the outside of the container

docker exec a6eb04b7d994 ls /usr/local/share/mulesoft/flex-gateway/conf.d/

Run the docker container in detached mode (-d)

docker run -d --rm -v $(pwd):/usr/local/share/mulesoft/flex-gateway/conf.d -p 8083:8081 mulesoft/flex-gateway

References

@pedes
Copy link
Author

pedes commented Nov 14, 2023

anypoint-cli-v4 account:user:describe --client_id 6a6214908ca24b95af9c9bcbc82c62d7 --client_secret BeE7CF5FA09d416da48383b54127301c --environment Sandbox

anypoint-cli-v4 api-mgr:api:list --client_id 6a6214908ca24b95af9c9bcbc82c62d7 --client_secret BeE7CF5FA09d416da48383b54127301c --environment Sandbox

// version 1.3.7 for mule apis, 1.4.0 for flex apis.

anypoint-cli-v4 api-mgr:policy:apply --config '{"rateLimits": [{ "maximumRequests": 3, "timePeriodInMilliseconds": 60000 }], "clusterizable": true, "exposeHeaders": false }' 19108770 rate-limiting --policyVersion 1.3.7 --client_id 6a6214908ca24b95af9c9bcbc82c62d7 --client_secret BeE7CF5FA09d416da48383b54127301c --environment Sandbox

anypoint-cli-v4 api-mgr:policy:apply --config '{"rateLimits": [{ "maximumRequests": 3, "timePeriodInMilliseconds": 60000 }], "clusterizable": true, "exposeHeaders": false }' 19108279 rate-limiting --policyVersion 1.4.0 --client_id 6a6214908ca24b95af9c9bcbc82c62d7 --client_secret BeE7CF5FA09d416da48383b54127301c --environment Sandbox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment