chore: removed unused code

This commit is contained in:
Nick Taylor
2026-02-13 21:53:04 -05:00
committed by Peter Steinberger
parent 63c1268b2b
commit 83014d9d09
4 changed files with 0 additions and 258 deletions

View File

@@ -1,50 +0,0 @@
FROM node:20-bookworm-slim
# Install dependencies (including jq for JSON handling)
RUN apt-get update && \
apt-get install -y \
git \
curl \
unzip \
iproute2 \
jq \
&& \
rm -rf /var/lib/apt/lists/*
# Install pnpm globally
RUN npm install -g pnpm
# Install Bun (required for OpenClaw build)
RUN curl -fsSL https://bun.sh/install | bash && \
ln -s /root/.bun/bin/bun /usr/local/bin/bun
# Create claw user and directories with proper ownership
RUN useradd -m -d /claw -s /bin/bash claw && \
mkdir -p /claw/workspace && \
mkdir -p /claw/.openclaw && \
chown -R claw:claw /claw
# Clone and build OpenClaw from the trusted-proxy feature branch
WORKDIR /tmp/openclaw-build
RUN git clone --depth 1 --branch feat/trusted-proxy-auth \
https://github.com/nickytonline/openclaw.git . && \
pnpm install && \
pnpm build && \
pnpm pack && \
npm install -g openclaw-*.tgz && \
cd / && \
rm -rf /tmp/openclaw-build
# Copy entrypoint script
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Set working directory
WORKDIR /claw/workspace
# Expose gateway port
EXPOSE 18789
# Run as claw user (ownership set in entrypoint before config commands)
USER root
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

View File

@@ -1,143 +0,0 @@
# Docker Entrypoint Fixes for Trusted-Proxy Authentication
## Summary
This directory contains fixes for critical Docker deployment bugs in the trusted-proxy authentication feature.
## Files
- **`entrypoint.sh`** - Fixed Docker entrypoint script
- **`Dockerfile`** - Updated Dockerfile with proper directory creation and dependencies
- **`README.md`** - This file
## Problems Fixed
### 1. Invalid JSON Array Generation ❌ → ✅
**Before (BROKEN):**
```bash
SUBNETS=$(ip -o -f inet addr show | grep -v "127.0.0.1" | awk '{print $4}' | tr ' ' '|')
# Output: "192.168.86.89/24 10.42.0.1/24"
# tr ' ' '|' produces: "192.168.86.89/24|10.42.0.1/24"
# Result in config: ["192.168.86.89/24"] ["10.42.0.1/24"] ← INVALID JSON!
```
**After (FIXED):**
```bash
SUBNETS=$(ip -o -f inet addr show | grep -v "127.0.0.1" | awk '{print $4}' | paste -sd ',' -)
JSON_ARRAY=$(echo "$SUBNETS" | jq -R 'split(",") | map(select(length > 0))')
# Output: ["192.168.86.89/24","10.42.0.1/24"] ← Valid JSON!
```
**Key changes:**
- `paste -sd ',' -` properly converts newlines to commas
- `jq` generates robust JSON arrays
- Result: Valid JSON that OpenClaw can parse
### 2. Permission Errors ❌ → ✅
**Before (BROKEN):**
```dockerfile
# Dockerfile
RUN useradd -m -d /claw -s /bin/bash claw
# Missing: mkdir -p /claw/.openclaw
# entrypoint.sh (runs config commands BEFORE chown)
su - claw -c "openclaw config set ..." # ← Permission denied!
chown -R claw:claw /claw # ← Too late!
```
**After (FIXED):**
```dockerfile
# Dockerfile
RUN useradd -m -d /claw -s /bin/bash claw && \
mkdir -p /claw/workspace && \
mkdir -p /claw/.openclaw && \
chown -R claw:claw /claw
# entrypoint.sh (chown BEFORE config commands)
chown -R claw:claw /claw # ← Runs first!
su - claw -c "openclaw config set ..." # ← Now it works!
```
## Testing
### Build and Test
```bash
cd /claw/workspace/docker-fixes
# Build the image
docker build -t openclaw-trusted-proxy:fixed .
# Run with Docker Compose (requires Pomerium setup)
docker run -d \
--name openclaw-gateway \
-p 18789:18789 \
-e POMERIUM_CLUSTER_DOMAIN=your-cluster.pomerium.app \
-v openclaw-data:/claw/.openclaw \
openclaw-trusted-proxy:fixed
```
### Expected Output (Success)
```
Detecting Docker networks...
Detected Docker networks: 192.168.86.89/24,10.42.0.1/24,172.17.0.1/16
Setting trustedProxies to: ["192.168.86.89/24","10.42.0.1/24","172.17.0.1/16"]
Updated gateway.trustedProxies. Restart the gateway to apply.
Configuring Control UI allowed origins for Pomerium cluster: your-cluster.pomerium.app
Starting OpenClaw Gateway...
[gateway] listening on ws://0.0.0.0:18789
```
### Verify Configuration
```bash
docker exec openclaw-gateway cat /claw/.openclaw/config.yaml
```
Should show:
```yaml
gateway:
trustedProxies:
- "192.168.86.89/24"
- "10.42.0.1/24"
- "172.17.0.1/16"
auth:
mode: "trusted-proxy"
trustedProxy:
userHeader: "x-pomerium-claim-email"
requiredHeaders:
- "x-pomerium-jwt-assertion"
```
## Dependencies
**Requires PR #1710:** Add trusted-proxy authentication mode
These fixes are specifically for Docker deployments of the trusted-proxy feature.
## Integration
These files should be added to the OpenClaw repository at:
- `docker/entrypoint.sh`
- `docker/Dockerfile.trusted-proxy`
Or create a new PR based on the `feat/trusted-proxy-auth` branch.
## Related Issues
- Main feature: PR #1710
- Docker deployment guide: (to be created)
---
**Status:** Ready for review and testing with Pomerium reverse proxy setup.

View File

@@ -1,29 +0,0 @@
version: "3.8"
services:
openclaw-gateway:
build:
context: .
dockerfile: Dockerfile
container_name: openclaw-gateway
ports:
- "18789:18789"
environment:
# Pomerium cluster domain for CORS configuration
- POMERIUM_CLUSTER_DOMAIN=your-cluster.pomerium.app
volumes:
# Persist OpenClaw configuration
- openclaw-config:/claw/.openclaw
# Persist workspace
- openclaw-workspace:/claw/workspace
restart: unless-stopped
networks:
- openclaw-network
volumes:
openclaw-config:
openclaw-workspace:
networks:
openclaw-network:
driver: bridge

View File

@@ -1,36 +0,0 @@
#!/bin/bash
set -e
# Auto-detect Docker network subnets and configure trustedProxies
echo "Detecting Docker networks..."
SUBNETS=$(ip -o -f inet addr show | grep -v "127.0.0.1" | awk '{print $4}' | paste -sd ',' -)
if [ -n "$SUBNETS" ]; then
echo "Detected Docker networks: $SUBNETS"
# Generate proper JSON array using jq
JSON_ARRAY=$(echo "$SUBNETS" | jq -R 'split(",") | map(select(length > 0))')
echo "Setting trustedProxies to: $JSON_ARRAY"
# Ensure proper ownership BEFORE running config commands
chown -R claw:claw /claw
# Update gateway.trustedProxies with proper JSON array
su - claw -c "openclaw config set gateway.trustedProxies \"$JSON_ARRAY\" --json" || \
echo "Warning: Could not set trustedProxies (config may not exist yet)"
echo "Updated gateway.trustedProxies. Restart the gateway to apply."
fi
# Auto-configure Control UI allowed origins from Pomerium domain
if [ -n "$POMERIUM_CLUSTER_DOMAIN" ]; then
echo "Configuring Control UI allowed origins for Pomerium cluster: $POMERIUM_CLUSTER_DOMAIN"
ALLOWED_ORIGINS="[\"https://$POMERIUM_CLUSTER_DOMAIN\"]"
su - claw -c "openclaw config set gateway.controlUi.allowedOrigins \"$ALLOWED_ORIGINS\" --json" || \
echo "Warning: Could not set allowedOrigins"
fi
# Start the gateway as claw user
echo "Starting OpenClaw Gateway..."
exec su - claw -c "cd /claw/workspace && openclaw gateway"