{{ message }}
feat: scripts/run + README run instructions for the OpenResty demo#6
Merged
Conversation
The compiled Lua.Ngx bindings wrap the ngx.* API the lua-nginx-module injects, so they only run inside an OpenResty worker. scripts/run serves the dist modules under OpenResty (locations /say and /status) so they can be curled, mirroring scripts/build. - flake.nix: add openresty to the dev shell so `nix develop -c ./scripts/run` works. - scripts/run: generate a minimal nginx.conf and serve dist/*.lua via dofile. - README.md: document build, run, and how to consume the bindings (dofile + curried Effect). - .gitignore: ignore the direnv cache (.direnv/).
There was a problem hiding this comment.
Pull request overview
Adds a first-class way to run and manually exercise the generated Lua.Ngx* Lua modules inside an OpenResty worker, along with documentation and Nix-shell support so contributors can curl a working demo without hand-writing an nginx config.
Changes:
- Add
scripts/runto generate a temporarynginx.confand servedist/*.luavia OpenResty with/sayand/statusendpoints. - Extend the dev shell (
flake.nix) to includeopenrestysonix develop -c ./scripts/runworks out of the box. - Document build/run usage and embedding the linked
dist/*.luamodules in your own nginx config; ignore.direnv/.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- scripts/run — validate PORT is a 1..65535 integer before interpolating it into the config (#6 (comment)) - scripts/run — fail fast if either served dist module is missing, not just Lua.Ngx.lua (#6 (comment))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds a way to actually run the compiled bindings, plus the docs to go with it.
The Lua.Ngx bindings wrap the
ngx.*API that the lua-nginx-module injects, so they only work inside an OpenResty worker. Until now there was no way to exercise them short of hand writing an nginx config. This addsscripts/run, which generates a minimal config and serves the dist modules under OpenResty so you can curl them, mirroring howscripts/buildproduces them.Changes:
nix develop -c ./scripts/runhas everything it needs, pinned by the flake like the rest of the toolchain.dist/*.luaviadofile, with/sayand/statuslocations.PORT=overrides the listen port. It fails fast with a clear message if openresty is not on PATH (the common case being a direnv shell that predates this change), pointing atnix develop -c ./scripts/runordirenv reload.Verified locally:
nix develop -c ./scripts/runserves on :8099,curl /sayreturns the greeting, andcurl /statusshows the HTTP_OK constant (200) with ngx.status set to 404.