Skip to content

Move rule conversion and log reporting into Docker container#14

Merged
dash14 merged 2 commits intomainfrom
refactor/move-js-processing-into-container
Mar 8, 2026
Merged

Move rule conversion and log reporting into Docker container#14
dash14 merged 2 commits intomainfrom
refactor/move-js-processing-into-container

Conversation

@dash14
Copy link
Copy Markdown
Owner

@dash14 dash14 commented Mar 8, 2026

Summary

  • Move wildcard-to-regex rule conversion from the host (Node.js) into the container using QuickJS (convert-rule.mjs), so rules are now passed in wildcard format and converted at container startup
  • Add in-container log reporting via QuickJS (report.mjs + log-parser.mjs), replacing host-side log parsing in report/main.mjs
  • Set up s6 logging pipeline (haproxyhaproxy-log) to persist HAProxy logs to /var/log/haproxy/current, enabling direct log access via docker exec
  • Extract legacy domain/port conversion into setup/lib/legacy-rules.mjs, which now outputs wildcard-format rules instead of regex
  • Add QuickJS test shim and unit tests for the container-side libraries
  • Update compose.test.yml to pass rules in wildcard format instead of pre-converted regex
  • Update docs and Makefile to reflect the new architecture

dash14 added 2 commits March 8, 2026 21:22
Shift JS processing (wildcard→regex conversion, log parsing/reporting)
from the host side into the container using QuickJS. This removes the
Node.js dependency for rule conversion at container startup and enables
structured log reporting via `docker compose exec`.

- Add QuickJS to container; convert rules via stdin/stdout filter
  (convert-rule.mjs) called from init-haproxy-cfg
- Add log parser library (lib/log-parser.mjs) shared by report.mjs
  and its tests
- Move rules.mjs into container (docker/files/tools/lib/); extract
  legacy rule handling to setup/lib/legacy-rules.mjs
- Pass wildcard rules as-is from setup/main.mjs to the container
- Set up s6-rc producer/consumer pipeline for HAProxy logging with
  s6-log outputting to both stdout and file
- Update report/main.mjs to consume structured JSON from container
- Update CI: run QuickJS unit tests via make test_unit
- Update docs/development.md directory structure
- convert-rule.mjs: catch errors and output clean message to stderr
  instead of exposing QuickJS stack traces
- setup/main.mjs: validate rules via buildRules() so invalid patterns
  are reported as ::error:: annotations in GitHub Actions before
  attempting to start the container
@dash14 dash14 merged commit 77920f9 into main Mar 8, 2026
6 checks passed
@dash14 dash14 deleted the refactor/move-js-processing-into-container branch March 8, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant