OpenResty-based API Gateway with Auto SSL, Reverse Proxy, and Admin Dashboard
10K+
Complete guide for deploying WSLProxy using Docker in various scenarios.
docker pull bwalia/wslproxy:latest
docker run -d \
--name wslproxy \
-p 80:80 \
-p 443:443 \
-p 8080:8080 \
bwalia/wslproxy:latest
| Image | Purpose | Tags |
|---|---|---|
bwalia/wslproxy | Full WSLProxy OpenResty application | latest, <commit-sha> |
bwalia/wslproxy-alternate | WSLProxy alternate build variant | latest, <commit-sha> |
bwalia/node-app | Node.js sample backend API | latest, <commit-sha> |
bwalia/s3-browser-app | S3 browser application | latest, <commit-sha> |
┌─────────────────────────────────────────────────────────┐
│ wslproxy Container │
├─────────────────────────────────────────────────────────┤
│ │
│ OpenResty (Nginx with Lua) │
│ ├─ SSL/TLS Termination (auto-ssl) │
│ ├─ Lua API Gateway │
│ ├─ Reverse Proxy │
│ ├─ Prometheus Metrics │
│ ├─ Traffic Logging & Analytics │
│ └─ Admin Dashboard (React) │
│ │
│ Port 80 - HTTP │
│ Port 443 - HTTPS │
│ Port 8080 - Admin Dashboard & Metrics │
│ │
└─────────────────────────────────────────────────────────┘
↓ ↓ ↓
Upstream Servers Configuration Redis Cache
Quick local development with hot-reload capabilities:
docker-compose -f docker-compose-dev.yml up -d
See docker-compose-dev.yml below for details.
Features:
Single container production deployment:
docker run -d \
--name wslproxy-prod \
--restart always \
-p 80:80 \
-p 443:443 \
-p 8080:8080 \
-e NGINX_CONFIG_DIR=/opt/nginx \
-v wslproxy-data:/opt/nginx/data \
-v wslproxy-certs:/etc/resty-auto-ssl \
bwalia/wslproxy:latest
With Redis backend:
# Start Redis
docker run -d \
--name wslproxy-redis \
--restart always \
redis:alpine
# Start WSLProxy with Redis
docker run -d \
--name wslproxy-prod \
--restart always \
--link wslproxy-redis:redis \
-p 80:80 \
-p 443:443 \
-p 8080:8080 \
-e REDIS_HOST=redis \
-e REDIS_PORT=6379 \
-v wslproxy-data:/opt/nginx/data \
-v wslproxy-certs:/etc/resty-auto-ssl \
bwalia/wslproxy:latest
Using Helm chart (recommended):
helm install wslproxy ./infra/helm-charts/wslproxy \
-n wslproxy \
--create-namespace \
-f values-prod.yaml
See infra/helm-charts/wslproxy/ for Helm configuration.
Using Docker Compose with shared volumes:
version: '3.8'
services:
wslproxy-1:
image: bwalia/wslproxy:latest
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- wslproxy-config:/opt/nginx
- wslproxy-certs:/etc/resty-auto-ssl
environment:
REDIS_HOST: redis
NGINX_CONFIG_DIR: /opt/nginx
depends_on:
- redis
wslproxy-2:
image: bwalia/wslproxy:latest
ports:
- "8080:80"
- "8443:443"
- "8081:8080"
volumes:
- wslproxy-config:/opt/nginx
- wslproxy-certs:/etc/resty-auto-ssl
environment:
REDIS_HOST: redis
NGINX_CONFIG_DIR: /opt/nginx
depends_on:
- redis
redis:
image: redis:alpine
volumes:
- redis-data:/data
volumes:
wslproxy-config:
wslproxy-certs:
redis-data:
| Variable | Default | Purpose |
|---|---|---|
NGINX_CONFIG_DIR | /opt/nginx | Configuration directory path |
REDIS_HOST | localhost | Redis server hostname |
REDIS_PORT | 6379 | Redis server port |
DNS_RESOLVER | 127.0.0.11 | DNS resolver for requests |
PRIMARY_DNS_RESOLVER | 8.8.8.8 | Primary DNS for ACME |
SECONDARY_DNS_RESOLVER | 8.8.4.4 | Secondary DNS for ACME |
SSL_STAGING | false | Use Let's Encrypt staging environment |
SSL_OCSP_STAPLING | true | Enable OCSP stapling |
# Data persistence
-v /path/to/config:/opt/nginx/data
# SSL certificates (auto-renewing)
-v /path/to/certs:/etc/resty-auto-ssl
# Configuration files
-v /path/to/nginx.conf:/usr/local/openresty/nginx/conf/nginx.conf
# Custom Lua scripts
-v /path/to/api:/usr/local/openresty/nginx/html/api
The container requires a settings.json file in the data volume:
{
"instance_id": "my-proxy",
"instance_name": "My Proxy Instance",
"env_profile": "prod",
"redis_host": "redis",
"storage_type": "disk",
"env_vars": {
"REDIS_HOST": "redis",
"REDIS_PORT": 6379,
"CONTROL_PLANE_API_URL": "https://example.com/api",
"FRONT_URL": "https://example.com"
},
"super_user": {
"email": "[email protected]",
"password": "hashed_password",
"username": "admin"
}
}
| Port | Protocol | Purpose |
|---|---|---|
| 80 | HTTP | Standard web traffic |
| 443 | HTTPS | Encrypted web traffic |
| 8080 | HTTP | Admin Dashboard & Prometheus metrics |
| 8500 | HTTP | Consul API (optional) |
docker exec wslproxy curl -f http://localhost:8080/health || exit 1
docker exec wslproxy openresty -t
curl -s http://localhost:8080/api/health
# Real-time logs
docker logs -f wslproxy
# Last 100 lines
docker logs --tail 100 wslproxy
# With timestamps
docker logs -f -t wslproxy
docker exec wslproxy tail -f /usr/local/openresty/nginx/logs/error.log
docker exec wslproxy tail -f /usr/local/openresty/nginx/logs/access.log
curl http://localhost:8080/metrics
nginx_http_requests_total - Total HTTP requestsnginx_http_request_duration_seconds - Request latencynginx_http_request_size_bytes - Request sizenginx_http_response_size_bytes - Response sizenginx_http_errors_total - Total errors by status codedocker pull bwalia/wslproxy:latest
# Stop old container
docker stop wslproxy
# Remove old container (if needed)
docker rm wslproxy
# Start new container
docker run -d \
--name wslproxy \
-p 80:80 \
-p 443:443 \
-p 8080:8080 \
-v wslproxy-data:/opt/nginx/data \
-v wslproxy-certs:/etc/resty-auto-ssl \
bwalia/wslproxy:latest
# 1. Start new container
docker run -d --name wslproxy-new bwalia/wslproxy:latest
# 2. Point load balancer to new container
# 3. Wait for requests to drain from old container
# 4. Stop old container
docker stop wslproxy
# 5. Rename new container
docker rename wslproxy-new wslproxy
# Check logs
docker logs wslproxy
# Check if Nginx configuration is valid
docker exec wslproxy openresty -t
# Check port availability
netstat -tuln | grep -E ':(80|443|8080)'
# Check memory usage
docker stats wslproxy
# Reduce worker processes
# Modify nginx.conf: worker_processes auto; → worker_processes 2;
# Check certificate directory
docker exec wslproxy ls -la /etc/resty-auto-ssl
# View certificate details
docker exec wslproxy openssl x509 -in /etc/resty-auto-ssl/certs/example.com.crt -text -noout
# Test DNS inside container
docker exec wslproxy nslookup google.com
# Check resolver configuration
docker exec wslproxy cat /usr/local/openresty/nginx/conf/nginx.conf | grep resolver
Use specific image tags (not latest in production)
docker run bwalia/wslproxy:abc123def456
Run as non-root (already configured in image)
docker run --user nobody bwalia/wslproxy:latest
Use read-only filesystem where possible
docker run --read-only --tmpfs /tmp bwalia/wslproxy:latest
Restrict capabilities
docker run --cap-drop=ALL --cap-add=NET_BIND_SERVICE \
bwalia/wslproxy:latest
Use secrets for sensitive data
docker run \
--secret db_password \
-e DB_PASSWORD_FILE=/run/secrets/db_password \
bwalia/wslproxy:latest
Regular updates
docker pull bwalia/wslproxy:latest
docker-compose up -d # Automatically uses latest
version: '3.8'
services:
wslproxy:
build:
context: .
dockerfile: Dockerfile
args:
APP_ENV: dev
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- ./api:/usr/local/openresty/nginx/html/api
- ./html:/usr/local/openresty/nginx/html
- ./openresty-admin/src:/usr/local/openresty/nginx/html/openresty-admin/src
- ./data:/opt/nginx/data
- wslproxy-certs:/etc/resty-auto-ssl
environment:
NGINX_CONFIG_DIR: /opt/nginx
REDIS_HOST: redis
REDIS_PORT: 6379
depends_on:
- redis
redis:
image: redis:alpine
ports:
- "6379:6379"
volumes:
- redis-data:/data
version: '3.8'
services:
wslproxy:
image: bwalia/wslproxy:latest
restart: always
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- wslproxy-data:/opt/nginx/data
- wslproxy-certs:/etc/resty-auto-ssl
environment:
NGINX_CONFIG_DIR: /opt/nginx
REDIS_HOST: redis
REDIS_PORT: 6379
depends_on:
- redis
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
redis:
image: redis:alpine
restart: always
volumes:
- redis-data:/data
command: redis-server --appendonly yes
volumes:
wslproxy-data:
wslproxy-certs:
redis-data:
docker build -t wslproxy:dev .
docker build \
--build-arg APP_ENV=prod \
-t wslproxy:prod \
.
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t bwalia/wslproxy:latest \
--push \
.
Images are automatically built and pushed to Docker Hub on:
main branchSee .github/workflows/k3s-build-push-deploy.yaml for automation details.
bwalia/wslproxy:latest - Latest versionbwalia/wslproxy:<commit-sha> - Specific commitFor issues, bugs, or feature requests:
docker logs wslproxydocker exec wslproxy openresty -tSee LICENSE file for details.
Content type
Image
Digest
sha256:2131b4e35…
Size
638.9 MB
Last updated
about 19 hours ago
docker pull bwalia/wslproxy