This document describes the development process for nginx-datadog.
It is intended for anyone considering opening an issue or pull request.
NGINX_VERSION=1.29.7 make buildThe resulting Nginx module is .build/ngx_http_datadog_module.so.
If you encounter some difficulties building the module on MacOS, please look at the troubleshooting section.
The build target does the following:
- Download a source release of nginx based on the
NGINX_VERSIONenvironment variable. - Initialize the source tree of
dd-trace-cppas a git submodule. - Initialize the source tree of
libddwafas a git submodule. - Build
dd-trace-cppand the Datadog nginx module together using CMake.
make clean deletes CMake's build directory.
The Makefile contains two target for testing:
build-and-test: build and use the resultant module for testing.test: use the existing built module for testing.
To run one or the other, you can use:
NGINX_VERSION=1.29.7 make build-and-testNGINX_VERSION=1.29.7 ARCH=aarch64 make build-and-testBy default, it will launch the test on the nginx:${NGINX_VERSION}-alpine Docker image.
If you want to use another Nginx image you can use:
BASE_IMAGE=nginx:1.29.7-alpine-slim make build-and-testTo run the tests related to AppSec:
WAF=ON NGINX_VERSION=1.29.7 make build-and-testTo run the tests using an OpenResty image:
RESTY_VERSION=1.29.2.1 make test-openrestyYou can also specificy the OpenResty base image rather then the version using the BASE_IMAGE parameter.
You can pass on arguments to test suites using:
TEST_ARGS="foo=bar" NGINX_VERSION=1.29.7 make testFor more information on tests, see test/README.md.
If during the build of the module, you encounter this error, please ensure that pcre2 is installed on your device. If not, you can install it with:
brew install pcre2If the build still does not work, you can use the flag PCRE2_PATH to specify the pcre2 installation folder it:
PCRE2_PATH=/opt/homebrew/Cellar/pcre2/10.44 NGINX_VERSION=1.29.7 make build