└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # upyun-resty 2 | 3 | UPYUN's open source software for OpenResty development. 4 | 5 | ![](http://iresty.b0.upaiyun.com/assets/upyun-resty.png_/fw/400) 6 | 7 | # Table of Contents 8 | 9 | * [What is UPYUN](#what-is-upyun) 10 | * [What is OpenResty](#what-is-openresty) 11 | * [Tech Talks](#tech-talks) 12 | * [201411 Beijing OSC](#201411-beijing-osc) 13 | * [201511 Beijing OpenResty Con](#201511-beijing-openresty-con) 14 | * [201608 Guangzhou UPYUN OpenTalk](#201608-guangzhou-upyun-opentalk) 15 | * [201612 Shenzhen OpenResty Con](#201612-shenzhen-openresty-con) 16 | * [201712 Hangzhou OpenResty Meetup](#201712-hangzhou-openresty-meetup) 17 | * [201811 Hangzhou OpenResty Con](#201811-hangzhou-openresty-con) 18 | * [201901 Shenzhen OpenResty x OpenTalk](#201901-shenzhen-openresty-x-opentalk) 19 | * [201903 Beijing OpenResty x OpenTalk](#201903-beijing-openresty-x-opentalk) 20 | * [Projects](#projects) 21 | * [Middleware](#middleware) 22 | * [Project Slardar](#project-slardar) 23 | * [Nginx Modules](#nginx-modules) 24 | * [base64-nginx-module](#base64-nginx-module) 25 | * [zstd-nginx-module](#zstd-nginx-module) 26 | * [Libraries](#libraries) 27 | * [checkups](#checkups) 28 | * [httpipe](#httpipe) 29 | * [redis-ratelimit](#redis-ratelimit) 30 | * [sync](#sync) 31 | * [ctxdump](#ctxdump) 32 | * [consul](#consul) 33 | * [load](#load) 34 | * [requests](#requests) 35 | * [limit-rate](#limit-rate) 36 | * [Community Contributions](#community-contributions) 37 | * [slice filter and If-Range requests](#slice-filter-and-if-range-requests) 38 | * [autoindex module and request body](#autoindex-module-and-request-body) 39 | * [ngx.req.raw_header with single line break](#ngx.req.raw_header-with-single-line-break) 40 | * [ngx_lua and filter finalize problem](#ngx_lua-and-filter-finalize-problem) 41 | * [segmentation fault might occur when SSL renegotiation happens](#segmentation-fault-might-occur-when-SSL-renegotiation-happens) 42 | * [Work at UPYUN](#work-at-upyun) 43 | 44 | # What is UPYUN 45 | 46 | - website: https://www.upyun.com 47 | - github: https://github.com/upyun 48 | - blog: http://io.upyun.com 49 | 50 | # What is OpenResty 51 | 52 | - website: https://openresty.org 53 | - github: https://github.com/openresty 54 | 55 | OpenResty is a full-fledged web platform by integrating the standard Nginx core, LuaJIT, many carefully written Lua libraries, lots of high quality 3rd-party Nginx modules, and most of their external dependencies. It is designed to help developers easily build scalable web applications, web services, and dynamic web gateways. 56 | 57 | # Tech Talks 58 | 59 | ## 201411 Beijing OSC 60 | 61 | - Using ngx_lua in UPYUN ([Slide](http://iresty.b0.upaiyun.com/slides/using-ngxlua-in-upyun.pdf) | [Github](https://github.com/timebug/using-ngxlua-in-upyun)) - @timebug 62 | 63 | ![](http://iresty.b0.upaiyun.com/assets/using-ngxlua-in-upyun.png_/fw/400) 64 | 65 | ## 201511 Beijing OpenResty Con 66 | 67 | - Using ngx_lua in UPYUN 2 ([Slide](http://iresty.b0.upaiyun.com/slides/using-ngxlua-in-upyun-2.pdf) | [Github](https://github.com/timebug/using-ngxlua-in-upyun)) - @timebug 68 | 69 | ![](http://iresty.b0.upaiyun.com/assets/using-ngxlua-in-upyun-2.png_/fw/400) 70 | 71 | ## 201608 Guangzhou UPYUN OpenTalk 72 | 73 | - 基于 ngx_lua 的动态服务路由方案 ([Slide](http://iresty.b0.upaiyun.com/slides/%E5%9F%BA%E4%BA%8Engx_lua%E7%9A%84%E5%8A%A8%E6%80%81%E6%9C%8D%E5%8A%A1%E8%B7%AF%E7%94%B1%E6%96%B9%E6%A1%88.pdf)) - @yejingx 74 | 75 | ![](http://iresty.b0.upaiyun.com/assets/%E5%9F%BA%E4%BA%8Engx_lua%E7%9A%84%E5%8A%A8%E6%80%81%E6%9C%8D%E5%8A%A1%E8%B7%AF%E7%94%B1%E6%96%B9%E6%A1%88.png_/fw/400) 76 | 77 | ## 201612 Shenzhen OpenResty Con 78 | 79 | - OpenResty 在云处理服务器集群中的应用 ([Slide](http://iresty.b0.upaiyun.com/slides/OpenResty%E5%9C%A8%E4%BA%91%E5%A4%84%E7%90%86%E6%9C%8D%E5%8A%A1%E9%9B%86%E7%BE%A4%E4%B8%AD%E7%9A%84%E5%BA%94%E7%94%A8.pdf)) - @yejingx 80 | 81 | ![](http://iresty.b0.upaiyun.com/assets/OpenResty%E5%9C%A8%E4%BA%91%E5%A4%84%E7%90%86%E6%9C%8D%E5%8A%A1%E9%9B%86%E7%BE%A4%E4%B8%AD%E7%9A%84%E5%BA%94%E7%94%A8.png_/fw/400) 82 | 83 | ## 201712 Hangzhou OpenResty Meetup 84 | 85 | - OpenResty TCP 服务代理和动态路由 ([Slide](https://iresty.b0.upaiyun.com/HangzhouMeetup201712/OpenResty%20TCP%20%E6%9C%8D%E5%8A%A1%E4%BB%A3%E7%90%86%E5%92%8C%E5%8A%A8%E6%80%81%E8%B7%AF%E7%94%B1.pdf)) - @huangnauh 86 | 87 | ![](https://iresty.b0.upaiyun.com/assets/OpenResty%20TCP%20%E6%9C%8D%E5%8A%A1%E4%BB%A3%E7%90%86%E5%92%8C%E5%8A%A8%E6%80%81%E8%B7%AF%E7%94%B1.png_/fw/400) 88 | 89 | - OpenResty 项目性能优化实践 ([Slide](https://iresty.b0.upaiyun.com/HangzhouMeetup201712/OpenResty%20%E9%A1%B9%E7%9B%AE%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E5%AE%9E%E8%B7%B5.pdf)) - @tokers 90 | 91 | ![](https://iresty.b0.upaiyun.com/assets/OpenResty%20%E9%A1%B9%E7%9B%AE%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E5%AE%9E%E8%B7%B5.png_/fw/400) 92 | 93 | ## 201811 Hangzhou OpenResty Con 94 | 95 | - 又拍云 OpenResty/Nginx 服务优化实践 ([Slide](https://github.com/tokers/tech-slides/blob/master/%E5%8F%88%E6%8B%8D%E4%BA%91%E6%9C%8D%E5%8A%A1%E4%BC%98%E5%8C%96%E5%AE%9E%E8%B7%B5%E2%80%94%E2%80%94%E5%BC%A0%E8%B6%85.pdf)) - @tokers 96 | 97 | ![](https://iresty.b0.upaiyun.com/assets/openresty-2018-upyun-alex.png_/fw/400) 98 | 99 | ## 201901 Shenzhen OpenResty x OpenTalk 100 | 101 | - OpenResty 动态流控的几种姿势 ([Slide](https://iresty.b0.upaiyun.com/slides/OpenResty%20%E5%8A%A8%E6%80%81%E6%B5%81%E6%8E%A7%E7%9A%84%E5%87%A0%E7%A7%8D%E5%A7%BF%E5%8A%BF.pdf)) - @timebug 102 | 103 | ![](https://iresty.b0.upaiyun.com/assets/OpenResty%20%E5%8A%A8%E6%80%81%E6%B5%81%E6%8E%A7%E7%9A%84%E5%87%A0%E7%A7%8D%E5%A7%BF%E5%8A%BF.jpeg_/fw/400) 104 | 105 | ## 201903 Beijing OpenResty x OpenTalk 106 | 107 | - OpenResty 在又拍云容器平台中的应用 ([Slide](https://iresty.b0.upaiyun.com/slides/OpenResty%E5%9C%A8%E5%8F%88%E6%8B%8D%E4%BA%91%E5%AE%B9%E5%99%A8%E5%B9%B3%E5%8F%B0%E4%B8%AD%E7%9A%84%E5%BA%94%E7%94%A8.pdf)) - @yejingx 108 | 109 | ![](https://iresty.b0.upaiyun.com/assets/OpenResty%E5%9C%A8%E5%8F%88%E6%8B%8D%E4%BA%91%E5%AE%B9%E5%99%A8%E5%B9%B3%E5%8F%B0%E4%B8%AD%E7%9A%84%E5%BA%94%E7%94%A8.jpeg_/fw/400) 110 | 111 | # Projects 112 | 113 | ## Middleware 114 | 115 | ### Project Slardar 116 | 117 | - github: https://github.com/upyun/slardar 118 | 119 | Slardar is a HTTP load balancer based on Nginx and lua-nginx-module, by which you can update your upstream list and run lua scripts without reloading Nginx. 120 | 121 | ## Nginx Modules 122 | 123 | ### base64-nginx-module 124 | 125 | - github: https://github.com/timebug/base64-nginx-module 126 | 127 | This module allows for on-the-fly base64 encode. As same as the standard ngx\_http\_gzip_module. 128 | 129 | ### zstd-nginx-module 130 | 131 | - github: https://github.com/tokers/zstd-nginx-module 132 | 133 | Nginx module for the [Zstandard compression](https://facebook.github.io/zstd/). 134 | 135 | ## Libraries 136 | 137 | ### checkups 138 | 139 | - github: https://github.com/upyun/lua-resty-checkups 140 | 141 | Manage Nginx upstreams in pure ngx_lua. 142 | 143 | * Periodically heartbeat to upstream servers 144 | * Proactive and passive health check 145 | * Dynamic upstream update 146 | * Balance by weighted round-robin or consistent-hash 147 | * Synchronize with Nginx upstream blocks 148 | * Try clusters by levels or by keys 149 | 150 | ### httpipe 151 | 152 | - github: https://github.com/timebug/lua-resty-httpipe 153 | 154 | Lua HTTP client cosocket driver for OpenResty / ngx_lua, interfaces are more flexible. 155 | 156 | * HTTP 1.0/1.1 and HTTPS 157 | * Flexible interface design 158 | * Streaming reader and uploads 159 | * Chunked-encoding request / response body 160 | * Sets the timeout for read and send operations 161 | * Limit the maximum response body size 162 | * Keepalive 163 | 164 | ### redis-ratelimit 165 | 166 | - github: https://github.com/timebug/lua-resty-redis-ratelimit 167 | 168 | This lua library is a request processing rate limit module for ngx_lua. It is used to limit the request processing rate per a defined key between multiple NGINX instances. The limitation is done using the "leaky bucket" method. 169 | 170 | ### sync 171 | 172 | - github: https://github.com/upyun/lua-resty-sync 173 | 174 | This lua-resty library help you to synchronize data(from redis, mysql, memcached and so on) based on the version changes. 175 | 176 | It will check the freshness by comparing the version cached by itself(stored in shared memory) and the one from your external suits, data will be updated when the cached one is stale or for the first time. 177 | 178 | ### ctxdump 179 | 180 | - github: https://github.com/tokers/lua-resty-ctxdump 181 | 182 | `ngx.ctx` is a magic table provided by ngx_lua, it can be used to store per-request Lua context data, however the lifetime is limited to the current location. 183 | 184 | See this [issue](https://github.com/openresty/lua-nginx-module/issues/1057) for the details. 185 | 186 | This lua-resty library can help you to bypass this limitation, i.e. it stashes and applies the old `ngx.ctx` for avoiding being destoried after Nginx internal redirect happens. 187 | 188 | ### consul 189 | 190 | - github: https://github.com/huangnauh/lua-resty-consul 191 | 192 | This Lua library can help OpenResty/ngx_lua users to load config from consul. 193 | 194 | ### load 195 | 196 | - github: https://github.com/huangnauh/lua-resty-load 197 | 198 | This Lua library can help OpenResty/ngx_lua users to dynamically load lua files/scripts. 199 | 200 | ### requests 201 | 202 | - https://github.com/tokers/lua-resty-requests 203 | 204 | Yet Another HTTP library for OpenResty. 205 | 206 | ### limit-rate 207 | 208 | - https://github.com/upyun/lua-resty-limit-rate 209 | 210 | Lua module for limiting request rate for OpenResty/ngx_lua, using the "token bucket" method. 211 | 212 | ## Community Contributions 213 | 214 | ### slice filter and If-Range requests 215 | 216 | The semantic of If-Range isn't implemented correctly when using nginx's slice module. 217 | 218 | See [here](https://trac.nginx.org/nginx/ticket/1357) for the details. 219 | 220 | ### autoindex module and request body 221 | 222 | The autoindex module doesn't discard the request body explicitly, 223 | hence request body will be treated as a pipelined request, and most of time 224 | another unexpected response will be sent to client. 225 | 226 | See [here](https://trac.nginx.org/nginx/ticket/1439) for the details. 227 | 228 | ### ngx.req.raw_header with single line break 229 | 230 | When the header delimiter is `\n`(rather than `\r\n`), 231 | `ngx.req.raw_header` cannot get the complete protocol headers in some case. 232 | 233 | See [here](https://github.com/openresty/lua-nginx-module/issues/1200) for the details. 234 | 235 | ### ngx_lua and filter finalize problem 236 | 237 | some ngx_lua's APIs(like `ngx.flush`) don't handle the nginx filter finalize correctly, 238 | thus the Lua VM may raise some exceptions. 239 | 240 | See [here](https://github.com/openresty/lua-nginx-module/issues/1131) for the details. 241 | 242 | ### segmentation fault might occur when SSL renegotiation happens 243 | 244 | When the SSL/TLS handshake reuses a existing session and the connection upgrades to HTTP/2, 245 | segmentation fault might occur when SSL/TLS renegotiation happens. 246 | 247 | This problem only happens under the specific Nginx and OpenSSL combinations. 248 | 249 | See [here](https://github.com/openresty/lua-nginx-module/issues/1354) for the details. 250 | 251 | # Work at UPYUN 252 | 253 | - See more: http://io.upyun.com/join-our-team/ 254 | --------------------------------------------------------------------------------