njs
lua-nginx-module
njs | lua-nginx-module | |
---|---|---|
3 | 16 | |
737 | 11,087 | |
0.3% | 0.2% | |
9.2 | 8.1 | |
about 22 hours ago | 21 days ago | |
C | C | |
BSD 2-clause "Simplified" License | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
njs
-
The Future of Nginx: Getting Back to Our Open Source Roots
This article came at an interesting timing for me, since I recently started to explore building my own CDN node on top of NGINX open source inspired by this article from Fly: https://fly.io/blog/the-5-hour-content-delivery-network/
I've worked with nginx in the past, and didn't have a great experience, so I was apprehensive diving in, but this time was very different. I think njs (their custom JS scripting environment) was a game changer. Support is built in to nginx core, and available by default in their docker containers, so it's much easier to get started with than Lua scripting. Their JS feature support has some quirks (no optional chaining, array destructuring, console.log's don't show up in logs, are some examples of things that threw me off) but overall nothing that blocked me from implementing the functionality I needed, and the integration points within the nginx config felt fairly natural.
I did run into a number of things that were locked behind their commercial offering that made me a bit uncomfortable betting on it for the long term compared to purely open source alternatives. Off the top of my head:
- DNS discovery. There's a thread on the Fly example repo accompanying the blog post that describes the use case and proposes some workarounds: https://github.com/fly-apps/nginx-cluster/issues/2. Life would be a lot simpler if DNS discovery from the commercial offering was just available (i.e. we can outright delete a brittle bash script that makes DNS queries and reloads nginx on a 5 second interval). This was mentioned in the article as something they're planning to open source.
- Access to some kind of shared key-value store for custom caching logic in njs scripts. With Lua we could just connect to Redis, but njs can't seem to establish persistent network connections for now, so that's off the table. This wasn't mentioned in the article, but they did mention in this Github issue that they're planning on open sourcing their keyval module for this use case: https://github.com/nginx/njs/issues/437. I have some use cases where being able to connect to Redis would be ideal, since syncing keyval across a cluster seems to be eventually consistent (https://docs.nginx.com/nginx/admin-guide/high-availability/z...), but for most of my caching use cases it should be sufficient.
So this article, along with their overall willingness to work with the community to identify and bring commercial features into open source (at least from what I've observed across their responses to Github issues) does a lot to alleviate those concerns.
Though at the end of the day, I don't necessarily need every nginx feature to be in open source. I have no problems with paying for great software like nginx to support its development. But as a small bootstrapped founder, their current pricing structure (from what I could gather on the internet is ~ 2k-5k per running instance), is completely prohibitive. It'd probably require a revamp to the way they sell the software (i.e. self-serve onboarding and automatic license provisioning for smaller customers instead of having customers of all sizes go through expensive sales people), but I'd love to see a more progressive pricing structure with a lower barrier to entry for their commercial product.
-
ngx_stream_js_module: ngx.fetch in js_filter function
I'd leave guys a bug at github: https://github.com/nginx/njs .
- Nginx JavaScript in Your Web Server Configuration
lua-nginx-module
-
Ravi is a dialect of Lua, with JIT and AOT compilers
"small embeddable dynamic languages" are usually used to configure or program other larger compiled applications. This is bes understood by example:
https://create.roblox.com/docs/tutorials/scripting/basic-scr... - make a mini game in Roblox
https://github.com/openresty/lua-nginx-module?tab=readme-ov-... - configure and extend NGINX
https://wezfurlong.org/wezterm/config/lua/general.html - make your terminal more useful (my personal config changes the tab color based on the process name - https://github.com/bbkane/dotfiles/blob/master/wezterm/dot-c...
https://m.youtube.com/watch?v=MQBr9hwf0BY - configure your text editor
- Nginx Development Guide
-
How to add rate limiting in nginx with redis and cloudflare?
If your service is self-hosted, you can build the rate limit rules in Nginx using the OpenResty framework. Note that, if you are using OpenResty, you can use a shared dictionary and you don't necessarily need Redis. However, if you want to use redis though, then you need a redis client like the lua-resty-redis.
-
lua openresty nginx proxy
You may also wish to open a question on the OpenResty repo, as there are not many OpenResty folks that follow this subreddit.
-
listen on port TCP and forward data to HTTP as POST request
/u/givmedat - Your best bet is to use njs module or the nginx lua module I think.
-
What do you use to log whole HTTPS requests in the cluster?
I drop logs at the first app LB using openresty's lua plugin for nginx. This goes into my data lake and we work on it from there. Does this work for everyone? No. Does it work for my F500 employer? Yes. Are there better ways to do this? Sorta.
-
The Future of Nginx: Getting Back to Our Open Source Roots
# - https://github.com/openresty/lua-nginx-module/
-
Writing your own service discovery client for Apache APISIX
We want the client to read the YAML file regularly. For this, we can leverage the power of the Lua Nginx module. It's part of OpenResty, which Apache APISIX is built upon. The module offers additional APIs, and two of them are particularly useful:
- Uma introdução ao NGINX
-
When your API performances becomes a thing, is switching to GO the ultimate solution ?
Depending on how complicated your Python logic is, one option is to use nginx+Lua (https://github.com/openresty/lua-nginx-module). Another option is to extend Envoy (https://www.envoyproxy.io/docs/envoy/latest/extending/extending).
What are some alternatives?
server-side-tls - Server side TLS Tools
Lua - Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.
nginx-cluster - A horizontally scalable NGINX caching cluster
Docker Compose - Define and run multi-container applications with Docker
kubernetes-ingress - NGINX and NGINX Plus Ingress Controllers for Kubernetes
EmmyLuaDebugger - EmmyLua Debugger
cache-handler - Distributed HTTP caching module for Caddy
IdentityServer4 - OpenID Connect and OAuth 2.0 Framework for ASP.NET Core
replace-response - Caddy module that performs replacements in response bodies
caddy-l4 - Layer 4 (TCP/UDP) app for Caddy
Caddy - Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS