Apache ShenYu Docker#

Java 原生API网关,用于服务代理、协议转换和API治理

Docker#

Run Apache ShenYu Admin#

docker network create shenyu
docker run -d --name shenyu-admin -p 9095:9095 --net shenyu apache/shenyu-admin

Run Apache ShenYu Bootstrap#

docker run -d -p 9195:9195 -e "shenyu.local.enabled=true" --net shenyu apache/shenyu-bootstrap
docker run -d --name shenyu-bootstrap -p 9195:9195 -e "shenyu.local.enabled=true" -e SHENYU_SYNC_WEBSOCKET_URLS=ws://shenyu-admin:9095/websocket --net shenyu apache/shenyu-bootstrap

Set router#

curl --location --request POST 'http://localhost:9195/shenyu/plugin/selectorAndRules' \
--header 'Content-Type: application/json' \
--header 'localKey: 123456' \
--data-raw '{
    "pluginName": "divide",
    "selectorHandler": "[{\"upstreamUrl\":\"127.0.0.1:8080\"}]",
    "conditionDataList": [{
        "paramType": "uri",
        "operator": "match",
        "paramValue": "/**"
    }],
    "ruleDataList": [{
        "ruleHandler": "{\"loadBalance\":\"random\"}",
        "conditionDataList": [{
            "paramType": "uri",
            "operator": "match",
            "paramValue": "/**"
        }]
    }]
}'

Runtime Environment#

Architecture#

https://shenyu.apache.org/assets/images/shenyu-architecture-3d-2b673fe8dfd0ef6a14223ffd00bfe824.png

Screenshots#

https://shenyu.apache.org/zh/img/home/2_2.jpg

https://shenyu.apache.org/zh/img/home/2_3.jpg

https://shenyu.apache.org/zh/img/home/2_4.jpg

https://shenyu.apache.org/zh/img/home/2_5.jpg

https://shenyu.apache.org/zh/img/home/2_6.jpg

https://shenyu.apache.org/zh/img/home/2_7.jpg

https://shenyu.apache.org/zh/img/home/2_8.jpg

References#