> For the complete documentation index, see [llms.txt](https://lbxa.gitbook.io/waf/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lbxa.gitbook.io/waf/journey/challenges/dependency-hell.md).

# Dependency Hell

Avoiding building from source when you can

To test if anything would work in the first place I had to write and test basic NGINX modules in C. This required installing NGINX from a source on my Linux machine. Anyone who's installed anything from source understands how time-consuming chasing up outdated dependencies can be.

The big issue even if you do manage to get everything working on your machine after a while, how can you guarantee it will work for another developer? Hence it's crucial for this barrier to be low if this project is to thrive in the open source community.

> But it works on my machine!

An easy way to guarantee it'll work on any other computer is my containerising. Developers won't be forced to use a virtualisation tool like Docker but having a clear Dockerfile in the code base will at least provide guidance on how to setup the system correctly.&#x20;

The following Dockerfile builds NGINX from the source and configures the environment for NGINX module development.&#x20;

```docker
FROM debian:stable
# FROM debian:slim-bullseye to save some bytes

# Update the package repository and install the necessary dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    wget \
    git \
    curl \
    zlib1g-dev \
    libpcre3-dev \
    libpcre2-dev \
    libssl-dev \
    llvm-dev \
    libclang-dev \
    clang \
    automake \
    autoconf \
    libtool \
    vim

# Download Nginx source code
WORKDIR /nginx

ENV NGINX_VER=1.14.2
RUN git config --global http.sslVerify false
RUN wget --no-check-certificate https://nginx.org/download/nginx-${NGINX_VER}.tar.gz
RUN tar -xzvf nginx-${NGINX_VER}.tar.gz
RUN rm nginx-${NGINX_VER}.tar.gz

# Configure and compile Nginx with dynamic module support
WORKDIR /nginx/nginx-${NGINX_VER}
RUN ./configure --with-compat
RUN make
RUN make install
RUN cp objs/nginx /usr/sbin/nginx

# default dynamic modules directory
RUN mkdir /usr/local/nginx/modules

EXPOSE 80

# Start Nginx
# Define the ENTRYPOINT as the NGINX executable
ENTRYPOINT ["nginx", "-g", "daemon off;"]
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://lbxa.gitbook.io/waf/journey/challenges/dependency-hell.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
