Spaces:
Running
Running
feat: migrate OPENCLAW_VERSION to build-time argument and hardcode health server ports
Browse files- .env.example +0 -7
- Dockerfile +5 -2
- README.md +6 -5
- health-server.js +2 -2
- start.sh +1 -0
.env.example
CHANGED
|
@@ -164,13 +164,6 @@ SYNC_INTERVAL=600
|
|
| 164 |
# Webhooks: Standard POST notifications for lifecycle events
|
| 165 |
# WEBHOOK_URL=https://your-webhook-endpoint.com/log
|
| 166 |
|
| 167 |
-
# ββ OPTIONAL: Advanced ββ
|
| 168 |
-
# Pin OpenClaw version. Default: latest
|
| 169 |
-
OPENCLAW_VERSION=latest
|
| 170 |
-
|
| 171 |
-
# Health endpoint port. Default: 7861
|
| 172 |
-
HEALTH_PORT=7861
|
| 173 |
-
|
| 174 |
# Trusted proxies (comma-separated IPs)
|
| 175 |
# Fixes "Proxy headers detected from untrusted address" behind reverse proxies
|
| 176 |
# Only set if you see pairing/auth errors. Find IPs in Space logs (remote=x.x.x.x)
|
|
|
|
| 164 |
# Webhooks: Standard POST notifications for lifecycle events
|
| 165 |
# WEBHOOK_URL=https://your-webhook-endpoint.com/log
|
| 166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
# Trusted proxies (comma-separated IPs)
|
| 168 |
# Fixes "Proxy headers detected from untrusted address" behind reverse proxies
|
| 169 |
# Only set if you see pairing/auth errors. Find IPs in Space logs (remote=x.x.x.x)
|
Dockerfile
CHANGED
|
@@ -4,10 +4,12 @@
|
|
| 4 |
# Multi-stage build: uses pre-built OpenClaw image for fast builds
|
| 5 |
|
| 6 |
# ββ Stage 1: Pull pre-built OpenClaw ββ
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
# ββ Stage 2: Runtime ββ
|
| 10 |
FROM node:22-slim
|
|
|
|
| 11 |
|
| 12 |
# Install system dependencies
|
| 13 |
RUN apt-get update && apt-get install -y \
|
|
@@ -30,7 +32,7 @@ COPY --from=openclaw --chown=1000:1000 /app /home/node/.openclaw/openclaw-app
|
|
| 30 |
|
| 31 |
# Symlink openclaw CLI so it's available globally
|
| 32 |
RUN ln -s /home/node/.openclaw/openclaw-app/openclaw.mjs /usr/local/bin/openclaw 2>/dev/null || \
|
| 33 |
-
npm install -g openclaw@
|
| 34 |
|
| 35 |
# Copy HuggingClaw files
|
| 36 |
COPY --chown=1000:1000 dns-fix.js /opt/dns-fix.js
|
|
@@ -45,6 +47,7 @@ RUN chmod +x /home/node/app/start.sh /home/node/app/keep-alive.sh
|
|
| 45 |
USER node
|
| 46 |
|
| 47 |
ENV HOME=/home/node \
|
|
|
|
| 48 |
PATH=/home/node/.local/bin:/usr/local/bin:$PATH \
|
| 49 |
NODE_OPTIONS="--require /opt/dns-fix.js"
|
| 50 |
|
|
|
|
| 4 |
# Multi-stage build: uses pre-built OpenClaw image for fast builds
|
| 5 |
|
| 6 |
# ββ Stage 1: Pull pre-built OpenClaw ββ
|
| 7 |
+
ARG OPENCLAW_VERSION=latest
|
| 8 |
+
FROM ghcr.io/openclaw/openclaw:${OPENCLAW_VERSION} AS openclaw
|
| 9 |
|
| 10 |
# ββ Stage 2: Runtime ββ
|
| 11 |
FROM node:22-slim
|
| 12 |
+
ARG OPENCLAW_VERSION=latest
|
| 13 |
|
| 14 |
# Install system dependencies
|
| 15 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 32 |
|
| 33 |
# Symlink openclaw CLI so it's available globally
|
| 34 |
RUN ln -s /home/node/.openclaw/openclaw-app/openclaw.mjs /usr/local/bin/openclaw 2>/dev/null || \
|
| 35 |
+
npm install -g openclaw@${OPENCLAW_VERSION}
|
| 36 |
|
| 37 |
# Copy HuggingClaw files
|
| 38 |
COPY --chown=1000:1000 dns-fix.js /opt/dns-fix.js
|
|
|
|
| 47 |
USER node
|
| 48 |
|
| 49 |
ENV HOME=/home/node \
|
| 50 |
+
OPENCLAW_VERSION=${OPENCLAW_VERSION} \
|
| 51 |
PATH=/home/node/.local/bin:/usr/local/bin:$PATH \
|
| 52 |
NODE_OPTIONS="--require /opt/dns-fix.js"
|
| 53 |
|
README.md
CHANGED
|
@@ -75,6 +75,8 @@ Navigate to your new Space's **Settings**, scroll down to the **Variables and se
|
|
| 75 |
> [!TIP]
|
| 76 |
> HuggingClaw is completely flexible! You only need these three secrets to get started. You can set other secrets later.
|
| 77 |
|
|
|
|
|
|
|
| 78 |
### Step 3: Deploy & Run
|
| 79 |
|
| 80 |
That's it! The Space will build the container and start up automatically. You can monitor the build process in the **Logs** tab.
|
|
@@ -126,7 +128,7 @@ Get notified when your Space restarts or if a backup fails:
|
|
| 126 |
|
| 127 |
## βοΈ Full Configuration Reference
|
| 128 |
|
| 129 |
-
See `.env.example` for
|
| 130 |
|
| 131 |
### Core
|
| 132 |
|
|
@@ -165,8 +167,7 @@ See `.env.example` for complete settings. Key environment variables:
|
|
| 165 |
|
| 166 |
| Variable | Default | Description |
|
| 167 |
|--------------------|----------|-------------------------------------|
|
| 168 |
-
| `OPENCLAW_VERSION` | `latest` |
|
| 169 |
-
| `HEALTH_PORT` | `7861` | Public dashboard / proxy port on HF Spaces |
|
| 170 |
|
| 171 |
## π€ LLM Providers
|
| 172 |
|
|
@@ -226,7 +227,7 @@ cp .env.example .env
|
|
| 226 |
**With Docker:**
|
| 227 |
|
| 228 |
```bash
|
| 229 |
-
docker build -t huggingclaw .
|
| 230 |
docker run -p 7861:7861 --env-file .env huggingclaw
|
| 231 |
```
|
| 232 |
|
|
@@ -289,7 +290,7 @@ HuggingClaw keeps the Space awake without external cron tools:
|
|
| 289 |
- **Space keeps sleeping:** Check logs for `Keep-alive` messages. Ensure `KEEP_ALIVE_INTERVAL` isnβt set to `0`.
|
| 290 |
- **Auth errors / proxy:** If you see reverse-proxy auth errors, add the logged IPs under `TRUSTED_PROXIES` (from logs `remote=x.x.x.x`).
|
| 291 |
- **UI blocked (CORS):** Set `ALLOWED_ORIGINS=https://your-space-name.hf.space`.
|
| 292 |
-
- **Version mismatches:**
|
| 293 |
|
| 294 |
## π Links
|
| 295 |
|
|
|
|
| 75 |
> [!TIP]
|
| 76 |
> HuggingClaw is completely flexible! You only need these three secrets to get started. You can set other secrets later.
|
| 77 |
|
| 78 |
+
Optional: if you want to pin a specific OpenClaw release instead of `latest`, add `OPENCLAW_VERSION` under **Variables** in your Space settings. For Docker Spaces, HF passes Variables as build args during image build, so this should be a Variable, not a Secret.
|
| 79 |
+
|
| 80 |
### Step 3: Deploy & Run
|
| 81 |
|
| 82 |
That's it! The Space will build the container and start up automatically. You can monitor the build process in the **Logs** tab.
|
|
|
|
| 128 |
|
| 129 |
## βοΈ Full Configuration Reference
|
| 130 |
|
| 131 |
+
See `.env.example` for runtime settings. Key configuration values:
|
| 132 |
|
| 133 |
### Core
|
| 134 |
|
|
|
|
| 167 |
|
| 168 |
| Variable | Default | Description |
|
| 169 |
|--------------------|----------|-------------------------------------|
|
| 170 |
+
| `OPENCLAW_VERSION` | `latest` | Build-time pin for the OpenClaw image tag |
|
|
|
|
| 171 |
|
| 172 |
## π€ LLM Providers
|
| 173 |
|
|
|
|
| 227 |
**With Docker:**
|
| 228 |
|
| 229 |
```bash
|
| 230 |
+
docker build --build-arg OPENCLAW_VERSION=latest -t huggingclaw .
|
| 231 |
docker run -p 7861:7861 --env-file .env huggingclaw
|
| 232 |
```
|
| 233 |
|
|
|
|
| 290 |
- **Space keeps sleeping:** Check logs for `Keep-alive` messages. Ensure `KEEP_ALIVE_INTERVAL` isnβt set to `0`.
|
| 291 |
- **Auth errors / proxy:** If you see reverse-proxy auth errors, add the logged IPs under `TRUSTED_PROXIES` (from logs `remote=x.x.x.x`).
|
| 292 |
- **UI blocked (CORS):** Set `ALLOWED_ORIGINS=https://your-space-name.hf.space`.
|
| 293 |
+
- **Version mismatches:** Pin a specific OpenClaw build with the `OPENCLAW_VERSION` Variable in HF Spaces, or `--build-arg OPENCLAW_VERSION=...` locally.
|
| 294 |
|
| 295 |
## π Links
|
| 296 |
|
health-server.js
CHANGED
|
@@ -3,8 +3,8 @@ const http = require("http");
|
|
| 3 |
const fs = require("fs");
|
| 4 |
const net = require("net");
|
| 5 |
|
| 6 |
-
const PORT =
|
| 7 |
-
const GATEWAY_PORT =
|
| 8 |
const GATEWAY_HOST = "127.0.0.1";
|
| 9 |
const startTime = Date.now();
|
| 10 |
const LLM_MODEL = process.env.LLM_MODEL || "Not Set";
|
|
|
|
| 3 |
const fs = require("fs");
|
| 4 |
const net = require("net");
|
| 5 |
|
| 6 |
+
const PORT = 7861;
|
| 7 |
+
const GATEWAY_PORT = 7860;
|
| 8 |
const GATEWAY_HOST = "127.0.0.1";
|
| 9 |
const startTime = Date.now();
|
| 10 |
const LLM_MODEL = process.env.LLM_MODEL || "Not Set";
|
start.sh
CHANGED
|
@@ -251,6 +251,7 @@ echo ""
|
|
| 251 |
echo " ββββββββββββββββββββββββββββββββββββββββββββ"
|
| 252 |
echo " β π Configuration Summary β"
|
| 253 |
echo " ββββββββββββββββββββββββββββββββββββββββββββ€"
|
|
|
|
| 254 |
printf " β %-40s β\n" "Model: $LLM_MODEL"
|
| 255 |
if [ -n "$TELEGRAM_BOT_TOKEN" ]; then
|
| 256 |
printf " β %-40s β\n" "Telegram: β
enabled"
|
|
|
|
| 251 |
echo " ββββββββββββββββββββββββββββββββββββββββββββ"
|
| 252 |
echo " β π Configuration Summary β"
|
| 253 |
echo " ββββββββββββββββββββββββββββββββββββββββββββ€"
|
| 254 |
+
printf " β %-40s β\n" "OpenClaw: $OPENCLAW_VERSION"
|
| 255 |
printf " β %-40s β\n" "Model: $LLM_MODEL"
|
| 256 |
if [ -n "$TELEGRAM_BOT_TOKEN" ]; then
|
| 257 |
printf " β %-40s β\n" "Telegram: β
enabled"
|