Apache is a production-ready open source seven-layer full traffic processing platform that serves as an API gateway for business entry traffic with high performance, low latency, official dashboard support, and over fifty plugins. If you are using Kong and are interested in but struggle to get started, try our just open source migration tool Kong-To- to help you migrate smoothly with one click.
Apache is a production-ready open source seven-layer full traffic processing platform that serves as an API gateway for business entry traffic with high performance, low latency, official dashboard support, and over fifty plugins. If you are using Kong and are interested in but struggle to get started, try our just open source migration tool Kong-To- to help you migrate smoothly with one click.
What is Kong-To-
Kong-To- leverages the declarative configuration files of Kong and to migrate configuration data, and adapts to the architecture and functionality of both sides. Currently, we support the migration of configuration data for Route, Service, Upstream, Target, Consumer and three plugins Rate Limiting, Proxy Caching and Key Authentication on one side of Kong, and we have completed a minimal demo using Kong’s Getting Started Guide as an example . We have completed a minimal demo.
How to migrate configuration
To export a Kong declarative configuration file using Deck, refer to the following steps: Kong Official Document: Backup and Restore of Kong’s Configuration
Download the repository and run the migration tool, which will generate the declarative configuration file
.yamlto be used.git clone https://github.com/api7/kong-to-cd kong-to-make build./bin/kong-to- migrate --input kong.yaml --output .yaml# migrate succeedUse
.yamlto configure , refer to Apache Official Document: Stand-alone mode.
Demo Test
Make sure docker is up and running, deploy the test environment, and use docker-compose to run and Kong.
git clone https://github.com/apache/-dockercd kong-to-./tools/setup.shAdd configuration to Kong and test it according to Kong's Getting Started Guide.
- Expose services via Service and Route for routing and forwarding
- Set up Rate Limiting and Proxy Caching plugins for flow limiting caching
- Set up Key Authentication plugin for authentication
- Set up load balancing via Upstream and Target
Export Kong's declarative configuration file to
kong.yaml.go run ./cmd/dumpkong/main.goRun the migration tool, import
kong.yamland generate the configuration file.yamlto docker volumes.export EXPORT_PATH=./repos/-docker/example/_confgo run ./cmd/kong-to-/main.goTest whether the migrated routes, load balancing, plugins, etc. are working properly on Apache side.
Test key auth plugin.
curl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/mock# output: 401Test proxy cache plugin.
# access for the first timecurl -k -I -s -o /dev/null http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"# see if got cachedcurl -I -s -X GET http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"# output:# HTTP/1.1 200 OK# ...# -Cache-Status: HITTest limit count plugin.
for i in {1..5}; do curl -s -o /dev/null -X GET http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"donecurl -k -i -m 20 -o /dev/null -s -w %{http_code} http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org"# output: 429Test load balance.
httpbin_num=0mockbin_num=0for i in {1..8}; do body=$(curl -k -i -s http://127.0.0.1:9080/mock -H "apikey: apikey" -H "Host: mockbin.org") if [[ $body == *"httpbin"* ]]; thenhttpbin_num=$((httpbin_num+1)) elif [[ $body == *"mockbin"* ]]; then mockbin_num=$((mockbin_num+1)) fi sleep 1.5doneecho "httpbin number: "${httpbin_num}", mockbin number: "${mockbin_num}# output:# httpbin number: 6, mockbin number: 2
Conclusion
Subsequent development plans for the migration tool are presented in the Roadmap on Kong-To-'s GitHub repository. Feel free to test and use Kong-To-, and discuss any questions you may have in the Issues section of the repository. Anyone who is interested in this project is welcome to contribute to it!