docs: update README and architecture for RPM-only packaging

- Remove DEB and el7 references (RPM only: el8, el9, el10)
- Remove Python integration tests from documentation (not automated in CI)
- Add file inventory in architecture.yml (source, packaging, tests)
- Update CI verify jobs to check RPM metadata with rpm -qi
- Organize RPM packages by distribution in dist/rpm/{el8,el9,el10}/
- Add security and RPM packaging features to README
- Split Requirements into Runtime and Packaging sections

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Jacquin Antoine
2026-03-01 00:29:51 +01:00
parent 8b381c7feb
commit e3ea1fb486
4 changed files with 45 additions and 86 deletions

View File

@ -166,6 +166,8 @@ RUN VERSION=$(grep "^Version:" /package/mod_reqin_log.spec | awk '{print $2}') &
FROM alpine:latest AS output
WORKDIR /packages
COPY --from=package-builder /tmp/packages/*.rpm /packages/rpm/
COPY --from=package-builder /tmp/packages/*.el8.*.rpm /packages/rpm/el8/
COPY --from=package-builder /tmp/packages/*.el9.*.rpm /packages/rpm/el9/
COPY --from=package-builder /tmp/packages/*.el10.*.rpm /packages/rpm/el10/
CMD ["sh", "-c", "echo '=== RPM Packages ===' && ls -la /packages/rpm/"]
CMD ["sh", "-c", "echo '=== RPM Packages (el8) ===' && ls -la /packages/rpm/el8/ && echo '' && echo '=== RPM Packages (el9) ===' && ls -la /packages/rpm/el9/ && echo '' && echo '=== RPM Packages (el10) ===' && ls -la /packages/rpm/el10/"]

View File

@ -87,16 +87,18 @@ debug: clean all
## package: Build all RPM packages (el8, el9, el10)
package:
mkdir -p $(DIST_DIR)/rpm
mkdir -p $(DIST_DIR)/rpm/el8 $(DIST_DIR)/rpm/el9 $(DIST_DIR)/rpm/el10
docker build --no-cache --target output -t mod_reqin_log:packager \
--build-arg VERSION=$(VERSION) \
-f Dockerfile.package .
@echo "Extracting packages from Docker image..."
docker run --rm -v $(PWD)/$(DIST_DIR):/output mod_reqin_log:packager \
sh -c 'cp -r /packages/rpm/* /output/rpm/'
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm:/output/rpm mod_reqin_log:packager \
sh -c 'cp -r /packages/rpm/el8 /output/rpm/ && cp -r /packages/rpm/el9 /output/rpm/ && cp -r /packages/rpm/el10 /output/rpm/'
@echo "Packages created:"
@echo " RPM (el8, el9, el10):"
@ls -la $(DIST_DIR)/rpm/
@ls -la $(DIST_DIR)/rpm/el8/
@ls -la $(DIST_DIR)/rpm/el9/
@ls -la $(DIST_DIR)/rpm/el10/
## package-rpm: Build RPM packages (el8, el9, el10)
package-rpm: package
@ -104,22 +106,22 @@ package-rpm: package
## test-package-rpm: Test RPM package installation in Docker (tests el9 by default)
test-package-rpm: package
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm:/packages:ro rockylinux:9 \
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm/el9:/packages:ro rockylinux:9 \
sh -c "dnf install -y /packages/*.el9.*.rpm && echo 'RPM el9 install OK'"
## test-package-rpm-el8: Test el8 RPM installation
test-package-rpm-el8: package
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm:/packages:ro rockylinux:8 \
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm/el8:/packages:ro rockylinux:8 \
sh -c "dnf install -y /packages/*.el8.*.rpm && echo 'RPM el8 install OK'"
## test-package-rpm-el9: Test el9 RPM installation
test-package-rpm-el9: package
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm:/packages:ro rockylinux:9 \
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm/el9:/packages:ro rockylinux:9 \
sh -c "dnf install -y /packages/*.el9.*.rpm && echo 'RPM el9 install OK'"
## test-package-rpm-el10: Test el10 RPM installation
test-package-rpm-el10: package
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm:/packages:ro almalinux:10 \
docker run --rm -v $(PWD)/$(DIST_DIR)/rpm/el10:/packages:ro almalinux:10 \
sh -c "dnf install -y /packages/*.el10.*.rpm && echo 'RPM el10 install OK'"
## test-package: Test all RPM packages installation

View File

@ -11,28 +11,34 @@ Apache HTTPD 2.4 module for logging all incoming HTTP requests as JSON lines to
- **Automatic reconnection**: Reconnects to Unix socket on failure with configurable backoff
- **Throttled error reporting**: Prevents error_log flooding on persistent failures
- **MPM compatible**: Works with prefork, worker, and event MPMs
- **Built-in security**: Sensitive headers (Authorization, Cookie, etc.) are automatically excluded
- **RPM packaging**: Standard RPM packages for Rocky Linux 8/9 and AlmaLinux 10
## Requirements
### Runtime
- Apache HTTPD 2.4+
- GCC compiler
- APR development libraries
- Apache development headers (`httpd-devel` or `apache2-dev`)
### Packaging (RPM)
- Docker (for reproducible builds)
- rpmbuild (inside Docker)
## Installation
### Using Docker (recommended)
```bash
# Build all packages (DEB + RPMs for el7, el8, el9)
# Build all RPM packages (el8, el9, el10)
make package
# Test package installation
make test-package-deb # Test DEB in Docker container
make test-package-rpm-el7 # Test el7 RPM (CentOS 7/RHEL 7)
# Test RPM package installation
make test-package-rpm-el8 # Test el8 RPM (Rocky 8/RHEL 8)
make test-package-rpm-el9 # Test el9 RPM (Rocky 9/RHEL 9)
make test-package # Test all packages
make test-package-rpm-el10 # Test el10 RPM (AlmaLinux 10/RHEL 10)
make test-package # Test all RPM packages
```
### Build from Source
@ -252,28 +258,17 @@ cmake ..
make test
```
### Integration Testing
```bash
# Using GitLab CI (recommended)
# All integration tests run automatically in CI
# Or manually with the Python test suite
python3 tests/integration/test_integration.py --url http://localhost:8080
```
### Build and Test Packages
```bash
# Build all packages (DEB + RPMs for el7, el8, el9)
# Build all RPM packages (el8, el9, el10)
make package
# Test package installation
make test-package-deb # Test DEB in Docker
make test-package-rpm-el7 # Test el7 RPM in Docker
# Test RPM package installation
make test-package-rpm-el8 # Test el8 RPM in Docker
make test-package-rpm-el9 # Test el9 RPM in Docker
make test-package # Test all packages
make test-package-rpm-el10 # Test el10 RPM in Docker
make test-package # Test all RPM packages
```
## License

View File

@ -36,6 +36,17 @@ context:
module:
name: mod_reqin_log
files:
source:
- src/mod_reqin_log.c
- src/mod_reqin_log.h
packaging:
- mod_reqin_log.spec
tests:
- tests/unit/test_module_real.c
- tests/unit/test_config_parsing.c
- tests/unit/test_header_handling.c
- tests/unit/test_json_serialization.c
hooks:
- name: register_hooks
responsibilities:
@ -310,53 +321,6 @@ testing:
execution:
- docker build -f Dockerfile.tests .
- docker run --rm <image> ctest --output-on-failure
integration_tests:
framework: python3
location: tests/integration/test_integration.py
env:
server: apache-httpd 2.4
os: rocky-linux-8+, rocky-linux-9+, almalinux-10+
log_consumer: Unix socket server (Python threading)
scenarios:
- name: basic_logging
description: >
With JsonSockLogEnabled On and valid socket, verify that each request
produces a valid JSON line with all required fields.
checks:
- All required fields present (time, timestamp, src_ip, dst_ip, method, path, host)
- Field types correct (timestamp is integer, time is ISO8601 string)
- Method matches HTTP request method
- name: header_limits
description: >
Configure more headers than JsonSockLogMaxHeaders and verify only
the first N are logged and values are truncated.
checks:
- Header values truncated to JsonSockLogMaxHeaderValueLen (default: 256)
- Only configured headers appear in output
- name: socket_unavailable_on_start
description: >
Start Apache with JsonSockLogEnabled On but socket not yet created;
verify periodic reconnect attempts and throttled error logging.
checks:
- Requests succeed even when socket unavailable
- Module reconnects when socket becomes available
- name: runtime_socket_loss
description: >
Drop the Unix socket while traffic is ongoing; verify that log lines
are dropped, worker threads are not blocked, and reconnect attempts
resume once the socket reappears.
checks:
- Requests complete quickly (<2s) when socket is down
- Module recovers and logs again after socket restoration
execution:
- python3 tests/integration/test_integration.py --url http://localhost:8080
bash_tests:
location: scripts/run_integration_tests.sh
description: >
Legacy bash-based integration tests for simple validation.
Tests JSON format, required fields, header logging via curl and grep.
execution:
- bash scripts/run_integration_tests.sh
ci:
@ -373,14 +337,13 @@ ci:
Separate RPMs are built for each major RHEL/CentOS/Rocky/AlmaLinux version
(el8, el9, el10) due to glibc and httpd-devel incompatibilities
across major versions. A single RPM cannot work across all versions.
All packages (DEB + multi-RPM) are built from Dockerfile.package.
RPM packages are built using rpmbuild with mod_reqin_log.spec file.
stages:
- name: build
description: >
Build all packages (1 DEB + 3 RPMs) using Dockerfile.package with multi-stage build.
Build all RPM packages (el8, el9, el10) using Dockerfile.package with multi-stage build.
dockerfile: Dockerfile.package
artifacts:
- dist/deb/*.deb
- dist/rpm/*.el8.*.rpm
- dist/rpm/*.el9.*.rpm
- dist/rpm/*.el10.*.rpm
@ -397,14 +360,11 @@ ci:
jobs:
- name: verify-rpm-el8
image: rockylinux:8
check: "httpd -M | grep reqin_log"
check: "rpm -qi mod_reqin_log && httpd -M | grep reqin_log"
- name: verify-rpm-el9
image: rockylinux:9
check: "httpd -M | grep reqin_log"
check: "rpm -qi mod_reqin_log && httpd -M | grep reqin_log"
- name: verify-rpm-el10
image: almalinux:10
check: "httpd -M | grep reqin_log"
- name: verify-deb
image: debian:stable
check: "ls -la /usr/lib/apache2/modules/mod_reqin_log.so"
check: "rpm -qi mod_reqin_log && httpd -M | grep reqin_log"