1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
version: '3.8'
services:
nntp-proxy:
build:
context: .
dockerfile: Dockerfile
container_name: nntp-proxy
ports:
- "8119:8119"
environment:
# Proxy configuration (these match the CLI env vars in src/bin/nntp-proxy.rs)
NNTP_PROXY_PORT: 8119
NNTP_PROXY_ROUTING_MODE: hybrid # Options: standard, per-command, hybrid
# NNTP_PROXY_THREADS: 4 # Optional: number of worker threads (default: number of CPUs)
RUST_LOG: info # Log level: trace, debug, info, warn, error
# Backend server 0 (required - at least one server must be configured)
NNTP_SERVER_0_HOST: news.example.com
NNTP_SERVER_0_PORT: 119
NNTP_SERVER_0_NAME: "Primary News Server"
# NNTP_SERVER_0_USERNAME: your_username # Optional: backend authentication
# NNTP_SERVER_0_PASSWORD: your_password # Optional: backend authentication
# NNTP_SERVER_0_MAX_CONNECTIONS: 10 # Optional: max connections (default: 10)
# Backend server 1 (optional - for load balancing)
# NNTP_SERVER_1_HOST: news2.example.com
# NNTP_SERVER_1_PORT: 119
# NNTP_SERVER_1_NAME: "Secondary News Server"
# NNTP_SERVER_1_MAX_CONNECTIONS: 10
# Backend server 2 (optional)
# NNTP_SERVER_2_HOST: news3.example.com
# NNTP_SERVER_2_PORT: 119
# NNTP_SERVER_2_NAME: "Tertiary News Server"
# NNTP_SERVER_2_MAX_CONNECTIONS: 10
restart: unless-stopped
# Health check
healthcheck:
test:
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
# Resource limits (adjust as needed)
deploy:
resources:
limits:
cpus: '2'
memory: 512M
reservations:
cpus: '1'
memory: 256M
# Optional: Mount config file instead of using env vars
# If you prefer TOML configuration, uncomment this and comment out NNTP_SERVER_* env vars above
# volumes:
# - ./config.toml:/etc/nntp-proxy/config.toml:ro
# Optional: Logging configuration
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Example: Multiple backend servers with load balancing
nntp-proxy-loadbalanced:
build:
context: .
dockerfile: Dockerfile
container_name: nntp-proxy-lb
ports:
- "8120:8119"
environment:
NNTP_PROXY_PORT: 8119
NNTP_PROXY_ROUTING_MODE: hybrid
RUST_LOG: info
# -----------------------------------------------------------------------------
# SECURITY WARNING: Never commit real credentials to version control!
# Use a .env file (which should be in .gitignore) or environment variables.
# Example: Copy .env.example to .env and fill in your actual credentials.
# Then use: ${BACKEND_USER_0} and ${BACKEND_PASS_0} below.
# -----------------------------------------------------------------------------
# Three backend servers for round-robin load balancing
NNTP_SERVER_0_HOST: news1.example.com
NNTP_SERVER_0_PORT: 119
NNTP_SERVER_0_NAME: "News Server 1"
NNTP_SERVER_0_USERNAME: ${BACKEND_USER_0}
NNTP_SERVER_0_PASSWORD: ${BACKEND_PASS_0}
NNTP_SERVER_1_HOST: news2.example.com
NNTP_SERVER_1_PORT: 119
NNTP_SERVER_1_NAME: "News Server 2"
NNTP_SERVER_1_USERNAME: ${BACKEND_USER_1}
NNTP_SERVER_1_PASSWORD: ${BACKEND_PASS_1}
NNTP_SERVER_2_HOST: news3.example.com
NNTP_SERVER_2_PORT: 119
NNTP_SERVER_2_NAME: "News Server 3"
NNTP_SERVER_2_USERNAME: ${BACKEND_USER_2}
NNTP_SERVER_2_PASSWORD: ${BACKEND_PASS_2}
# Health check
healthcheck:
test:
interval: 30s
timeout: 3s
retries: 3
start_period: 10s
restart: unless-stopped
profiles:
- loadbalanced