Skip to content

Commit f1c3acd

Browse files
committed
README updates
1 parent 77e62ba commit f1c3acd

File tree

1 file changed

+57
-51
lines changed

1 file changed

+57
-51
lines changed

docker/README.md

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,42 @@ This directory contains Docker configurations for the ngx-inference module and r
55
## Directory Structure
66

77
- `nginx/` - NGINX configurations and Dockerfile for the main inference gateway
8-
- `extproc/` - External processor service for EPP (Endpoint Picker Processor)
9-
- `examples/` - Example services and configurations for testing
8+
- `mock-extproc/` - Mock external processor service implementing EPP (Endpoint Picker Processor) and BBR functionality
9+
- `echo-server/` - Simple Node.js echo server for testing
1010

1111
## Quick Start
1212

1313
### Build and Run with Docker Compose
1414

15+
The docker-compose configuration is located in the `tests/` directory:
16+
1517
```bash
1618
# From the project root
19+
docker-compose -f tests/docker-compose.yml up -d
20+
21+
# Or run from the tests directory
22+
cd tests
1723
docker-compose up -d
1824
```
1925

26+
Access the stack:
27+
- Basic test: `curl -i http://localhost:8081/`
28+
- EPP test: `curl -i http://localhost:8081/epp-test`
29+
- BBR test: `curl -i http://localhost:8081/bbr-test -H 'Content-Type: application/json' --data '{"model":"claude-4","input": "Why is the sky blue"}'`
30+
- BBR & EPP test: `curl -i http://localhost:8081/responses -H 'Content-Type: application/json' --data '{"model":"claude-4","input": "Why is the sky blue"}'`
31+
- Health check: `curl -i http://localhost:8081/health`
32+
2033
### Build Individual Services
2134

2235
```bash
2336
# Build NGINX with ngx-inference module
2437
docker build -f docker/nginx/Dockerfile -t ngx-inference:latest .
2538

26-
# Build external processor service
27-
docker build -f docker/extproc/Dockerfile -t extproc-service:latest .
39+
# Build mock external processor service
40+
docker build -f docker/mock-extproc/Dockerfile -t extproc-mock:latest .
2841

29-
# Build example echo server
30-
docker build -f docker/examples/custom-echo.Dockerfile -t echo-server:latest docker/examples/
42+
# Build echo server
43+
docker build -f docker/echo-server/Dockerfile -t echo-server:latest docker/echo-server/
3144
```
3245

3346
## NGINX Container
@@ -39,71 +52,64 @@ The `nginx/` directory contains:
3952
### Usage
4053

4154
```bash
42-
docker run -p 80:80 \
43-
-v ./examples/basic-config/nginx.conf:/etc/nginx/nginx.conf:ro \
55+
docker run -p 8081:80 \
56+
-v ./docker/nginx/nginx-test.conf:/etc/nginx/nginx.conf:ro \
4457
ngx-inference:latest
4558
```
4659

47-
## External Processor
60+
## Mock External Processor
4861

49-
The `extproc/` directory contains the external processor service that implements the EPP (Endpoint Picker Processor) functionality via gRPC.
62+
The `mock-extproc/` directory contains the mock external processor service that implements both EPP (Endpoint Picker Processor) and BBR (Body Buffer & Rewrite) functionality via gRPC. It uses the `extproc_mock` binary from this repository.
5063

5164
### Usage
5265

5366
```bash
54-
docker run -p 9001:9001 extproc-service:latest
67+
# Run as EPP (Endpoint Picker Processor) on port 9001
68+
docker run -p 9001:9001 \
69+
-e EPP_UPSTREAM=echo-server:80 \
70+
extproc-mock:latest
71+
72+
# Run as BBR on port 9000
73+
docker run -p 9000:9000 \
74+
-e BBR_MODEL=bbr-chosen-model \
75+
extproc-mock:latest \
76+
extproc_mock 0.0.0.0:9000
5577
```
5678

57-
## Examples
79+
## Echo Server
5880

59-
The `examples/` directory contains sample services for testing:
60-
- `custom-echo-server.js` - Simple Node.js echo server for testing
61-
- `custom-echo.Dockerfile` - Dockerfile for the echo server
81+
The `echo-server/` directory contains a simple Node.js echo server for testing with a 50MB payload limit:
82+
- `custom-echo-server.js` - Simple Node.js echo server implementation
83+
- `Dockerfile` - Dockerfile for the echo server
84+
- `package.json` - Node.js dependencies
6285

6386
## Environment Variables
6487

6588
### NGINX Container
6689

67-
- `NGINX_WORKER_PROCESSES` - Number of worker processes (default: auto)
68-
- `NGINX_WORKER_CONNECTIONS` - Worker connections (default: 1024)
90+
The NGINX container uses an official NGINX image with the ngx-inference module dynamically loaded. Configuration is provided via volume-mounted nginx.conf files.
91+
92+
### Mock External Processor
93+
94+
- `EPP_UPSTREAM` - Upstream endpoint for EPP routing (default: echo-server:80)
95+
- `BBR_MODEL` - Model identifier for BBR responses (default: bbr-chosen-model)
96+
- `MOCK_ROLE` - Role identifier (e.g., EPP, BBR)
6997

70-
### External Processor
98+
### Echo Server
7199

72-
- `GRPC_PORT` - gRPC server port (default: 9001)
73-
- `LOG_LEVEL` - Logging level (default: info)
100+
- `PORT` - Server listening port (default: 80)
74101

75102
## Development
76103

77-
For development and testing, you can use the provided docker-compose configuration:
78-
79-
```yaml
80-
# In your docker-compose.yml
81-
version: '3.8'
82-
services:
83-
nginx:
84-
build:
85-
context: .
86-
dockerfile: docker/nginx/Dockerfile
87-
ports:
88-
- "80:80"
89-
volumes:
90-
- ./examples/basic-config/nginx.conf:/etc/nginx/nginx.conf:ro
91-
depends_on:
92-
- extproc
93-
- echo-server
94-
95-
extproc:
96-
build:
97-
context: .
98-
dockerfile: docker/extproc/Dockerfile
99-
environment:
100-
- GRPC_PORT=9001
101-
102-
echo-server:
103-
build:
104-
context: docker/examples
105-
dockerfile: custom-echo.Dockerfile
106-
```
104+
For development and testing, use the docker-compose configuration in the `tests/` directory. The stack includes:
105+
106+
- **nginx**: NGINX with ngx-inference module (exposed on port 8081)
107+
- **mock-epp**: Mock external processor for EPP on port 9001
108+
- **echo-server**: Simple echo server for testing (internal only, accessed via nginx)
109+
110+
All services share the default network allowing DNS resolution by service name.
111+
112+
See `tests/docker-compose.yml` for the complete configuration.
107113

108114
## Troubleshooting
109115

@@ -113,4 +119,4 @@ services:
113119

114120
3. **Permission issues**: Make sure NGINX has proper permissions to read configuration files and write to log directories.
115121

116-
4. **Build failures**: Check that all required build dependencies are available and the Rust toolchain is properly configured.
122+
4. **Build failures**: Check that all required build dependencies are available and the Rust toolchain is properly configured.

0 commit comments

Comments
 (0)