https://github.com/leancloud/resty-marathon-lb
基于 OpenResty 的 Marathon 服务发现 & 路由
https://github.com/leancloud/resty-marathon-lb
marathon marathon-lb mesos openresty
Last synced: 6 months ago
JSON representation
基于 OpenResty 的 Marathon 服务发现 & 路由
- Host: GitHub
- URL: https://github.com/leancloud/resty-marathon-lb
- Owner: leancloud
- Created: 2017-04-09T10:11:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-09T11:02:07.000Z (over 8 years ago)
- Last Synced: 2025-04-05T04:51:18.397Z (7 months ago)
- Topics: marathon, marathon-lb, mesos, openresty
- Language: Lua
- Size: 16.6 KB
- Stars: 12
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# resty-marathon-lb
## 这是啥玩意
这是一个 LeanCloud 维护的基于 OpenResty 的服务发现路由。
在 nginx 配置里说明要 proxy_pass 的 Marathon 应用,就可以直接路由过去了。```nginx
server {
listen 80;
server_name example.com;
location / {
dyups_interface;
# "marathon-rest-api地址#应用id:应用端口"
set $marathon_app "marathon:8080#your-awesome-app:4000";
set $upstream "";
access_by_lua_file "lua/marathon-app.lua";
proxy_pass http://$upstream;
}
}
``````bash
$ curl http://example.com/ping
This is your awesome app serving at port 23745 (a Mesos allocated port)
```## 怎么用
看看 `nginx.conf` 和 `components.conf`。
通过 `build.sh` 可以构建出一个 docker 镜像,用这个部署就可以了。
可以直接用 `--net=host` 来部署,会暴露4个端口:
- 80 HTTP
- 880 接受 Proxy Protocol 的 HTTP
- 443 HTTPS
- 8443 接受 Proxy Protocol 的 HTTPS## License
MIT