https://github.com/yankeguo-deprecated/dynup
Dynamic Upstream with OpenResty and Redis
https://github.com/yankeguo-deprecated/dynup
Last synced: about 2 months ago
JSON representation
Dynamic Upstream with OpenResty and Redis
- Host: GitHub
- URL: https://github.com/yankeguo-deprecated/dynup
- Owner: yankeguo-deprecated
- License: mit
- Created: 2019-05-15T07:22:11.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-28T18:39:09.000Z (about 2 years ago)
- Last Synced: 2025-02-14T16:58:41.000Z (3 months ago)
- Language: Vue
- Size: 3.9 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dynup
Dynamic Upstream with OpenResty and Redis
## Integration
```nginx
location / {
set $dynup_project test;
set $dynup_redis_host 127.0.0.1;
set $dynup_redis_port 6379;
set $dynup_redis_pass ''; # must exist, empty for null
set $dynup_upstream ''; # must pre-define
access_by_lua_file ../lua/dynup.lua;
proxy_pass http://$dynup_upstream;
}
```## Redis Keys
### Projects (for Web UI Only)
Project names are stored as a set
```plain
> SMEMBERS dynup.projects1) foo
2) bar
```### Backends
```plain
> GET gateway-backends-foo{
"canary": [
"127.0.0.1:8082"
],
"default": [
"127.0.0.1:8081"
]
}
```Backend group `default` MUST exist
### Rules
Frontend rules will be evaluated by Lua script
```plain
> GET gateway-rules-foo[
{
"type": "query",
"fields": [
"canary",
"is_canary"
],
"pattern": "true", // exact string match
// "pattern": "/[Tt].+/", // lua regexp
// "pattern": "[1,2,3]", // list
// "pattern": "<1,10>", // range of number
"target": "canary"
}
]
```Other supported types are `header`
If no rule matched, will fallback to `default` group,you can add a `default` rule like this
```plain
{
"type": "default",
"target": "canary"
}
```## License
Yanke Guo , MIT License