Skip to content

Commit 67a8c4d

Browse files
committed
improved production setup instructions
1 parent a759764 commit 67a8c4d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ pnpm install lodash
5050

5151
### Production Setup
5252

53-
For production or containerized environments, you should deploy NPG with persistent storage and custom configuration:
53+
For production or containerized environments, you should deploy NPG with persistent storage and custom configuration.
54+
55+
**⚠️ Important for Production**: Always deploy NPG behind a reverse proxy (traefik, nginx, Cloudflare, etc.) that handles:
56+
- **TLS termination** for secure HTTPS connections
57+
- **Compression** (gzip/brotli) for optimal performance - this is critical for npm metadata. Missing compression can lead to very slow installs.
58+
- **Custom Domain & Path Setup** - e.g. `https://npg.yourdomain.com/npm` - this is crucial for rewriting URLs correctly for npm clients (esp. pnpm).
59+
60+
For now, NPG itself serves uncompressed HTTP traffic and relies on the reverse proxy for these essential production features.
61+
62+
> **Coming Soon**: Docker Compose examples for common production scenarios (traefik reverse proxy, Redis caching, multi-instance deployments) will be added to simplify deployment.
5463
5564
#### 1. Create directories for persistent data
5665
```bash
@@ -75,14 +84,14 @@ docker run -d \
7584
-v $(pwd)/npg-data/storage:/app/var/storage \
7685
-v $(pwd)/npg-data/malware-list:/app/var/malware-list \
7786
-v $(pwd)/npg-data/etc:/app/etc \
78-
-e HTTP_BIND=0.0.0.0 \
87+
-e PROXY_URL=https://npg.yourdomain.com/npm \
7988
ghcr.io/uscreen/npg:latest
8089
```
8190

8291
#### 4. Configure npm/pnpm to use the proxy
8392
```bash
8493
# Point to your Docker host
85-
echo "registry=http://localhost:3000/npm/" >> ~/.npmrc
94+
echo "registry=https://npg.yourdomain.com/npm/" >> ~/.npmrc
8695
```
8796

8897
#### 5. Use npm/pnpm normally
@@ -93,6 +102,7 @@ pnpm install lodash
93102
```
94103

95104
**Docker Environment Variables:**
105+
- `PROXY_URL=https://npg.yourdomain.com/npm` - URL + path to your proxy
96106
- `HTTP_PORT=3000` - Server port (default: 3000)
97107
- `HTTP_BIND=0.0.0.0` - Bind address (important for Docker)
98108
- `LOG_LEVEL=info` - Log level (debug, info, warn, error)
@@ -110,7 +120,7 @@ HTTP_BIND=0.0.0.0
110120

111121
# Registry settings
112122
REGISTRY_URL=https://registry.npmjs.org
113-
PROXY_URL=http://127.0.0.1:3000/npm
123+
PROXY_URL=https://npg.yourdomain.com/npm
114124

115125
# Storage settings
116126
STORAGE_DIR=../var/storage

0 commit comments

Comments
 (0)