Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# The Nginx version must match the one in System Tests, in
# https://github.com/DataDog/system-tests/blob/main/utils/build/docker/cpp_nginx/nginx.Dockerfile#L3,
# and must be one of the versions built in GitLab CI build-and-test-fast.
NGINX_VERSION: 1.29.6
NGINX_VERSION: 1.29.7
WAF: ON
MIRROR_REGISTRY: ""
steps:
Expand Down
22 changes: 3 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# source code fetched by the build
/nginx/

# build arifacts
*.so*
/.build
/.musl-build
/.openresty-build
/.vscode/

# text editor noise
.*.sw?
.vscode/

# file used as part of the build configuration
/nginx-version-info
/openresty-version-info

# scratch directory for preparing releases
/.release/

# Python
__pycache__/

/metrics.csv
.DS_Store
*.so*
1 change: 0 additions & 1 deletion .gitlab/build-and-test-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ build-nginx-fast:
- "1.26.3"
- "1.27.5"
- "1.28.3"
- "1.29.6"
- "1.29.7"
WAF: ["ON", "OFF"]

Expand Down
52 changes: 33 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
This document describes the development process for `nginx-datadog`.
It is intended for anyone considering opening an issue or pull request.

Building locally
Building Locally
----------------

```shell
NGINX_VERSION=1.25.2 make build
NGINX_VERSION=1.29.7 make build
```

The resulting nginx module is `.build/ngx_http_datadog_module.so`.
The 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](#Troubleshooting).

Expand All @@ -18,49 +19,59 @@ The `build` target does the following:
- Download a source release of nginx based on the `NGINX_VERSION` environment variable.
- Initialize the source tree of `dd-trace-cpp` as a git submodule.
- Initialize the source tree of `libddwaf`as a git submodule.
- Build `dd-trace-cpp` and the Datadog nginx module together using
CMake.
- Build `dd-trace-cpp` and the Datadog nginx module together using CMake.

`make clean` deletes CMake's build directory.

Testing
-------

The makefile contains two target for testing:
- `build-and-test`: builds and use the resultant module for testing
- `test`: use the existing built module for testing
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:

### Linux, MacOS AMD64

```shell
NGINX_VERSION=1.25.2 make build-and-test
NGINX_VERSION=1.29.7 make build-and-test
```

### MacOS with Apple Silicon

```shell
NGINX_VERSION=1.25.2 ARCH=aarch64 make build-and-test
NGINX_VERSION=1.29.7 ARCH=aarch64 make build-and-test
```
By 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:

By 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:

```shell
BASE_IMAGE=nginx:1.25.2-alpine-slim make build-and-test
BASE_IMAGE=nginx:1.29.7-alpine-slim make build-and-test
```

### Additional test options

To run the tests related to AppSec:

```shell
WAF=ON NGINX_VERSION=1.25.2 make build-and-test
WAF=ON NGINX_VERSION=1.29.7 make build-and-test
```

To run the tests using an openresty image:
To run the tests using an OpenResty image:

```shell
RESTY_VERSION=1.27.1.1 make test-openresty
RESTY_VERSION=1.29.2.1 make test-openresty
```
You can also specificy the openresty base image rather then the version using the `BASE_IMAGE` parameter.

You 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:

```shell
TEST_ARGS="foo=bar" NGINX_VERSION=1.25.2 make test
TEST_ARGS="foo=bar" NGINX_VERSION=1.29.7 make test
```

For more information on tests, see [test/README.md](test/README.md).
Expand All @@ -70,10 +81,13 @@ Troubleshooting
### fatal error: 'pcre2.h' file not found on MacOS

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:

```shell
brew install pcre2
```

If the build still does not work, you can use the flag `PCRE2_PATH` to specify the pcre2 installation folder it:

```shell
PCRE2_PATH=/opt/homebrew/Cellar/pcre2/10.44 NGINX_VERSION=1.25.2 make build
PCRE2_PATH=/opt/homebrew/Cellar/pcre2/10.44 NGINX_VERSION=1.29.7 make build
```
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<img alt="Datadog Tracing Nginx" src="mascot.svg" height="200"/>

[![codecov](https://codecov.io/gh/DataDog/nginx-datadog/graph/badge.svg?token=SZCZI1FAYU)](https://codecov.io/gh/DataDog/nginx-datadog)

# Datadog Nginx Module
This repository contains the source code for the `ngx_http_datadog_module`, an Nginx module
that integrates Datadog [APM](https://docs.datadoghq.com/tracing) and
Expand Down Expand Up @@ -111,7 +112,7 @@ Below are specific commands and options for different build targets.
> The `build-musl` target builds against [musl](https://www.musl-libc.org/) to guarantee portability.

```shell
WAF=ON ARCH=x86_64 NGINX_VERSION=1.27.1 make build-musl
WAF=ON ARCH=x86_64 NGINX_VERSION=1.29.7 make build-musl
```

Options:
Expand All @@ -128,7 +129,7 @@ The Nginx module will be generated at `.musl-build\ngx_http_datadog_module.so`.
To build the module for OpenResty:

```shell
WAF=ON ARCH=x86_64 RESTY_VERSION=1.27.1.1 make build-openresty
WAF=ON ARCH=x86_64 RESTY_VERSION=1.29.2.1 make build-openresty
```

Options:
Expand All @@ -145,7 +146,7 @@ The Nginx module will be generated at `.musl-build\ngx_http_datadog_module.so`.
To build the module for [Ingress Nginx](https://github.com/kubernetes/ingress-nginx):

```shell
WAF=ON ARCH=x86_64 INGRESS_NGINX_VERSION=1.11.2 make build-ingress-nginx
WAF=ON ARCH=x86_64 INGRESS_NGINX_VERSION=1.15.1 make build-ingress-nginx
```

Options:
Expand Down
6 changes: 3 additions & 3 deletions example/ingress-nginx/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ controller:
image:
registry: docker.io
image: datadog/ingress-nginx-injection
# The first part of the tag, 'v1.14.1', is the version of the ingress-nginx controller.
# The second part of the tag, '-dd.v1.11.0', which is optional, is the version of the
# The first part of the tag, 'v1.15.1', is the version of the ingress-nginx controller.
# The second part of the tag, '-dd.v1.14.0', which is optional, is the version of the
# Datadog Nginx module.
# Check <https://hub.docker.com/repository/docker/datadog/ingress-nginx-injection/tags>
# for the list of all versions supported.
tag: "v1.14.1-dd.v1.11.0"
tag: "v1.15.1-dd.v1.14.0"
distroless: false
extraEnvs:
- name: DD_AGENT_HOST
Expand Down
2 changes: 1 addition & 1 deletion example/openresty/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e
cd "$(dirname "$0")"/..

if [ -z "$RESTY_VERSION" ]; then
export RESTY_VERSION=1.27.1.2
export RESTY_VERSION=1.29.2.1
fi

if [ -z "$BASE_IMAGE" ]; then
Expand Down
2 changes: 1 addition & 1 deletion example/tracing/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

cd "$(dirname "$0")"/..

BASE_IMAGE="${BASE_IMAGE:-nginx:1.29.4-alpine}"
BASE_IMAGE="${BASE_IMAGE:-nginx:1.29.7-alpine}"
export BASE_IMAGE

# Fail fast in case the base image is not supported.
Expand Down
2 changes: 1 addition & 1 deletion example/tracing/services/nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Build an nginx container that includes the module for Datadog tracing.
# The default value for BASE_IMAGE is to silent the InvalidDefaultArgInFrom
# warning. Actually BASE_IMAGE is set in docker-compose.yml.
ARG BASE_IMAGE=nginx:1.29.4-alpine
ARG BASE_IMAGE=nginx:1.29.7-alpine
FROM ${BASE_IMAGE}

# Install the Datadog tracing module.
Expand Down
Loading