orlabs / orange Goto Github PK
View Code? Open in Web Editor NEWOpenResty/Nginx Gateway for API Monitoring and Management.
Home Page: http://orange.sumory.com
License: MIT License
OpenResty/Nginx Gateway for API Monitoring and Management.
Home Page: http://orange.sumory.com
License: MIT License
按照文档安装好orange之后,全局监控里看不到一点数据。
启动nginx的时候有如下报错,不知道会不会有影响:
2016/06/20 23:24:26 [error] 7939#0: [lua] config_loader.lua:21: load(): Load config file from ./orange.conf
2016/06/20 23:24:26 [error] 7939#0: [lua] file_store.lua:16: new(): load file store configurations... ./data.json
Intro: https://www.serfdom.io/intro
Let's introduce a new sync flow for orange cluster.
Modify (plugin configuration) -> Test (Passed) -> Push to Data Store (MySQL) -> Notify to all orange cluster (using serf) -> Pull configuration from DB.
Rule
使用post请求的化,重定向不允许,使用代理的化,没法接收post请求的参数。请问怎么处理?
使用nginx的反向代理可以用post请求,在orange怎么配置反向代理?
justhacker:orange jhp$ sudo make install
Orange installed.
env: resty: No such file or directory
make: *** [install] Error 127
justhacker:orange jhp$
Using https://github.com/thibaultcha/lua-resty-jit-uuid instead, no longer libuuid required.
orange.conf设为true后,登录界面一直进不去,出现502,
"dashboard": {
"auth": true,
"session_secret": "y0ji4pdj61aaf3f11c2e65cd2263d3e7e5",
"whitelist": [
"^/auth/login$",
"^/error/$"
]
},
启动是成功的
justhacker:orange jhp$ sudo orange restart
[INFO] Orange: 0.6.1
[INFO] ngx_lua: 10006
[INFO] nginx: 1011002
[INFO] Lua: LuaJIT 2.1.0-beta2
[INFO] Stop orange...
[INFO] args:
[INFO] ngx_conf:/usr/local/orange/conf/nginx.conf
[INFO] prefix:/usr/local/orange
[INFO] orange_conf:/usr/local/orange/conf/orange.conf
[INFO] args end.
[INFO] ORANGE_CONF=/usr/local/orange/conf/orange.conf nginx -p /usr/local/orange -c /usr/local/orange/conf/nginx.conf -s stop
[SUCCESS] Orange stoped.
[INFO] Start orange...
[INFO] args:
[INFO] ngx_conf:/usr/local/orange/conf/nginx.conf
[INFO] prefix:/usr/local/orange
[INFO] orange_conf:/usr/local/orange/conf/orange.conf
[INFO] args end.
[INFO] Start orange command execute.
[INFO] ORANGE_CONF=/usr/local/orange/conf/orange.conf nginx -p /usr/local/orange -c /usr/local/orange/conf/nginx.conf
[SUCCESS] Orange started.
看日志出现这个问题
2017/02/17 21:02:00 [error] 52233#0: *25 lua entry thread aborted: runtime error: content_by_lua(nginx.conf:165):3: loop or previous error loading module 'dashboard.main'
stack traceback:
coroutine 0:
[C]: in function 'require'
content_by_lua(nginx.conf:165):3: in function <content_by_lua(nginx.conf:165):1>, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:9999"
大拿,你好,orange做API网关时,新增API时,upstream能否增加keepalive参数啊
我按照安装说明进行操作,orange的服务也启动起来了,但是却没有样式,请指教可能是哪里出了问题,谢谢
2016/07/06 12:44:09 [error] 19220#0: [lua] config_loader.lua:21: load(): Load config file from /opt/nginx/orange.conf
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_db.lua:35: query(): connected to mysql, reused_times:0 sql:select key
, value
from meta where key
like "%.enable", context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_store.lua:48: query(): MySQLStore:query empty, sql:select key
, value
from meta where key
like "%.enable", context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_db.lua:35: query(): connected to mysql, reused_times:1 sql:select value
from monitor order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_store.lua:48: query(): MySQLStore:query empty, sql:select value
from monitor order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_db.lua:35: query(): connected to mysql, reused_times:2 sql:select value
from redirect order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_store.lua:48: query(): MySQLStore:query empty, sql:select value
from redirect order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_db.lua:35: query(): connected to mysql, reused_times:3 sql:select value
from rewrite order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_store.lua:48: query(): MySQLStore:query empty, sql:select value
from rewrite order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_db.lua:35: query(): connected to mysql, reused_times:4 sql:select value
from waf order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_store.lua:48: query(): MySQLStore:query empty, sql:select value
from waf order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_db.lua:35: query(): connected to mysql, reused_times:5 sql:select value
from divide order by id asc, context: ngx.timer
2016/07/06 12:44:09 [error] 19222#0: [lua] mysql_store.lua:48: query(): MySQLStore:query empty, sql:select value
from divide order by id asc, context: ngx.timer
1、全局统计中的address应为服务器的IP地址,不应该是IP地址和端口号
2、uptime应该为持续运行时间,不应该是启动时的那个时刻时间
new feature for PostgreSQL store
type support.
很不错的作品
不知在设计orange的时候是否参考了VeryNginx的设计。如果有的话,出于对作者的尊重,请在Readme中注明这一点,谢谢
nginx.conf中
location / {
set $upstream_host $host;
改为
location / {
set $upstream_host $host:$server_port;
kong
.nginx: [emerg] unknown directive "init_by_lua_block" in /data/app/orange/./conf/nginx.conf:43
看数据库 里插入的那条默认数据是64位的,问题是dashboard里没有用户管理,那么我要新增一个用户的时候,密码怎么计算出来???
It look like only support unix-like OS, because of the libuuid.
Am I right?
Create a spa dashboard, remove lor template. This would reduce the dependency of lua and get better performance. Also, it's easy to deploy and test.
经我们测试发现:
1.重写选择器配置多个,请求全部匹配
2.分流选择器配置多个,匹配后会跳出
我们选择器都是配置的url match,这样就都是是通过正则匹配的。
然后每个选择器又有多个规则,也是url match,也要正则匹配。
1.这样策略一多,每个请求就经过了很多 正则匹配, 是否会很损耗性能?
2.如果选择器只配一个,用全流量方式, 只在规则那匹配,这样会少了很多正则匹配,相对上面性能是否会好一些?
=============
我们有对orange做ab压测,发现相比openresty,未开启分流损耗性能20%,开启一条分流策略,性能损耗30%。
很担心选择器和规则过多,又都是正则匹配,性能会很差。
请问 你那边有相关的性能数据吗? 规则过多有什么好的优化方式?
我们打算选择器只用一个全流量。
谢谢!
It's unquestionable, given this issue for urging multiply variables extractor from a request URI, that it's leaving a lot to be desired.
Yet, as demonstrated by the wide range of different ideas on how it should be improved, it's hard to find consensus on what 'better' actually looks like. Having looked through the discussions in QQ group, there are two broad categories into which the concerns fall into: the first is adding dyadic array for all variable extractors and the second is adding features for new rest template directive.
Dyadic array would increase complexity for configuration and process. But this would be the best solution for URI variable regular matching searching and would support a max range of URI.
So a new custom variable extract directives
is a niche requirement, and we want to focus our efforts on making apps a possibility so that it is possible to add a brand new directive suits your use-case for getting multiply variables for a URI, rather than modify old ones. Therefore this issue exists purely to address a new restful URI extractor and a new directive. As for me, I would like to name them as Restful Template
.
Old variable extractor using ${number}
directive to identify expected variables. But Restful Template
would using a new directive differ before. It is {variable name}
.
There are two key things which makes this new directive quite desirable:
${number}
.I would give some restrictions on what this Restful Template
could and couldn't.
{variable name}
directive is equal to (.+)
.queryString
, head
and body
.variable name
would be a unique word, it don't have any blank symbol and couldn't equal to predefined placeholder. (Because we would store the url variables by using your defined name as a key in url variable store.)Predefined placeholder
{queryString[variable]}
means exist query string, if you leave the variable blank like {queryString}
, this would append all query string from client.{head[variable]}
would exactor header value.{body[variable]}
would just get the variable from request body(Ajax, url encoded, multipart).Best practice
We have a public restful api for user login:
Name | Variables |
---|---|
GET | /api/v3/account/login |
Query String | username={username}&password={password}&apiKey={apiKey} |
Rewrite | /dashboard/account?action=login&version=v3&username={username}&password={password} |
This would be defined like:
"conditions": [
{
"type": "URI",
"operator": "restful",
"value": "/api/{version}/{service}/{action}"
}
]
"handle": {
"trim_qs": false,
"url_tmpl": "/dashborad/{service}?action={action}&version={version}&{queryString}",
"log": true
}
A real request could like:
GET http://orange_request_host:8888/api/v3/account/login?username=syhily&password=123456&apiKey=312b3b123123ubcbjkh324
REWRITE http://upstream_service_host:8080/dashborad/account?action=login&version=v3&username=syhily&password=123456&apiKey=312b3b123123ubcbjkh324
oad_data_by_mysql函数中,init_enable_of_plugin初始化插件为true时l记录日志的级别建议为ngx.INFO,代码大致为512,522行
https://github.com/sumory/orange/blob/master/orange/plugins/monitor/api.lua:
There used to be 8 routes, but now only /monitor/stat
left over.
It seems more like a bug instead of api change...
Auto init database from schema.
➜ orange git:(master) ✗ sh start.sh
start orange..
nginx: [error] [lua] orange.lua:159: init(): Startup error: ./orange/utils/utils.lua:170: ./orange/utils/handle.lua:5: module 'resty.template' not found:
no field package.preload['resty.template']
no file '../resty/template.lua'
no file '/usr/local/lor/resty/template.lua'
no file '/usr/local/openresty/site/lualib/resty/template.lua'
no file '/usr/local/openresty/site/lualib/resty/template/init.lua'
no file '/usr/local/openresty/lualib/resty/template.lua'
no file '/usr/local/openresty/lualib/resty/template/init.lua'
no file './resty/template.lua'
no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta2/resty/template.lua'
no file '/usr/local/share/lua/5.1/resty/template.lua'
no file '/usr/local/share/lua/5.1/resty/template/init.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/resty/template.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/resty/template/init.lua'
no file '/usr/local/openresty/site/lualib/resty/template.so'
no file '/usr/local/openresty/lualib/resty/template.so'
no file './resty/template.so'
no file '/usr/local/lib/lua/5.1/resty/template.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/resty/template.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/local/openresty/site/lualib/resty.so'
no file '/usr/local/openresty/lualib/resty.so'
no file './resty.so'
no file '/usr/local/lib/lua/5.1/resty.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
===============
local function assert_condition(real, operator, expected)
if not real then
ngx.log(ngx.ERR, string_format("assert_condition error: %s %s %s", real, operator, expected))
return false
end
然后执行到了这里.
请问 orange-v0.6.sql 什么时候放出来? 0.5.1 的 sql 跟 0.6 版本的字段好像不匹配了
we just need this feature, perhaps use balancer_by_lua
will do
[root@localhost chenghui]# orange start
[INFO] Orange: 0.6.2
[INFO] ngx_lua: 10007
[INFO] nginx: 1011002
[INFO] Lua: LuaJIT 2.1.0-beta2
[INFO] args:
[INFO] ngx_conf:/usr/local/orange/conf/nginx.conf
[INFO] prefix:/usr/local/orange
[INFO] orange_conf:/usr/local/orange/conf/orange.conf
[INFO] args end.
[INFO] Start orange command execute.
[INFO] ORANGE_CONF=/usr/local/orange/conf/orange.conf nginx -p /usr/local/orange -c /usr/local/orange/conf/nginx.conf
nginx: [emerg] unknown directive "stub_status" in /usr/local/orange/conf/nginx.conf:139
dashboard首页在orange跑一段时间后就会出现500错误。
错误日志:
2016/12/19 09:47:19 [error] 28429#0: *195 [lua] server.lua:72: fn(): /usr/local/orange/dashboard/routes/dashboard.lua:74: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
/usr/local/lor/lor/lib/router/layer.lua:120: in function </usr/local/lor/lor/lib/router/layer.lua:119>
[C]: in function 'ipairs'
/usr/local/orange/dashboard/routes/dashboard.lua:74: in function 'fn'
/usr/local/lor/lor/lib/router/layer.lua:118: in function </usr/local/lor/lor/lib/router/layer.lua:117>
[C]: in function 'xpcall'
/usr/local/lor/lor/lib/router/layer.lua:117: in function 'handle_request'
/usr/local/lor/lor/lib/router/route.lua:93: in function 'next'
/usr/local/lor/lor/lib/router/route.lua:97: in function 'fn'
/usr/local/lor/lor/lib/router/layer.lua:118: in function </usr/local/lor/lor/lib/router/layer.lua:117>
[C]: in function 'xpcall'
/usr/local/lor/lor/lib/router/layer.lua:117: in function 'handle_request'
/usr/local/lor/lor/lib/router/router.lua:194: in function 'next'
/usr/local/lor/lor/lib/router/router.lua:214: in function 'fn'
/usr/local/lor/lor/lib/router/layer.lua:118: in function </usr/local/lor/lor/lib/router/layer.lua:117>
[C]: in function 'xpcall'
/usr/local/lor/lor/lib/router/layer.lua:117: in function 'handle_request'
/usr/local/lor/lor/lib/router/router.lua:205: in function 'next'
/usr/local/lor/lor/lib/router/router.lua:214: in function 'handle'
/usr/local/lor/lor/lib/application.lua:95: in function 'handle'
/usr/local/lor/lor/lib/application.lua:54: in function 'run'
content_by_lua(dashboard.conf:28):4: in function <content_by_lua(dashboard.conf:28):1>,
如题
如题,这时候恢复lor到0.2.6的时候能够正常访问,希望作者兼容下
新WAFの機能:攻撃がある場合、についてはルールとイベント中にIPデータを提供するしてください、または、バッチファイル実行のインターフェースがある、良いですよ。
以上
调用 /redirect/configs接口时 api_error 报closed keepalive connection (104: Connection reset by peer)。请问是什么原因?
.editorconfig
file目前支持集群部署吗?我研究了下,好像一些限制都是基于单机的
我的请求是这样的http://hostA/orange/say/hello
, 我想通过rewrite模块将url地址重写成http://hostB/say/hello
,(hostA变成hostB,并且去掉orange),但是我在配置了rewrite之后一直是404,后来看了代码发现orange的urlrewrite功能并不能改变host,我的变量提取配置的是(orange),处理配置的是${1},请问下orange的重定向是否无法满足我的这种需求??或者有其他的组合配置方式?
how to configure the upstream server ?
Adding these two plugins: https://getkong.org/plugins/request-transformer https://getkong.org/plugins/response-transformer on orange.
[root@localhost openresty-1.11.2.2]# orange start
[INFO] Orange: 0.6.2
[INFO] ngx_lua: 10007
[INFO] nginx: 1011002
[INFO] Lua: LuaJIT 2.1.0-beta2
[INFO] args:
[INFO] ngx_conf:/usr/local/orange/conf/nginx.conf
[INFO] prefix:/usr/local/orange
[INFO] orange_conf:/usr/local/orange/conf/orange.conf
[INFO] args end.
[INFO] Start orange command execute.
[INFO] ORANGE_CONF=/usr/local/orange/conf/orange.conf nginx -p /usr/local/orange -c /usr/local/orange/conf/nginx.conf
nginx: [error] init_by_lua error: init_by_lua:2: module 'orange.orange' not found:
no field package.preload['orange.orange']
no file '../orange/orange.lua'
no file '/usr/local/lor/orange/orange.lua'
no file '/usr/local/openresty/site/lualib/orange/orange.lua'
no file '/usr/local/openresty/site/lualib/orange/orange/init.lua'
no file '/usr/local/openresty/lualib/orange/orange.lua'
no file '/usr/local/openresty/lualib/orange/orange/init.lua'
no file './orange/orange.lua'
no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta2/orange/orange.lua'
no file '/usr/local/share/lua/5.1/orange/orange.lua'
no file '/usr/local/share/lua/5.1/orange/orange/init.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/orange/orange.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/orange/orange/init.lua'
no file '/usr/local/openresty/site/lualib/orange/orange.so'
no file '/usr/local/openresty/lualib/orange/orange.so'
no file './orange/orange.so'
no file '/usr/local/lib/lua/5.1/orange/orange.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/orange/orange.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/local/openresty/site/lualib/orange.so'
no file '/usr/local/openresty/lualib/orange.so'
no file './orange.so'
no file '/usr/local/lib/lua/5.1/orange.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/orange.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
init_by_lua:2: in main chunk
1.install success openresty/luajit ,ln -s nginx , and ln -s luajit
2.install lor
2.user by root
sh start.sh , show error
2016/06/20 23:24:26 [error] 7939#0: [lua] config_loader.lua:21: load(): Load config file from ./orange.conf
2016/06/20 23:24:26 [error] 7939#0: [lua] file_store.lua:16: new(): load file store configurations... ./data.json
:) thx
Add a configure script to generate Makefile.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.