Spaces:
Running
Running
refactor: remove internal self-ping keep-alive in favor of dashboard-based UptimeRobot setup
Browse files- CHANGELOG.md +19 -1
- CONTRIBUTING.md +1 -1
- Dockerfile +1 -2
- README.md +5 -18
- keep-alive.sh +0 -34
- start.sh +2 -9
CHANGELOG.md
CHANGED
|
@@ -2,9 +2,25 @@
|
|
| 2 |
|
| 3 |
All notable changes to this project will be documented in this file.
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
## [1.1.0] - 2026-03-31
|
| 6 |
|
| 7 |
### Added
|
|
|
|
| 8 |
- **Pre-built Docker image** β uses `ghcr.io/openclaw/openclaw:latest` multi-stage build for much faster builds (minutes instead of 30+)
|
| 9 |
- **Python huggingface_hub sync** β `workspace-sync.py` uses the `huggingface_hub` library for more reliable HF Dataset sync (handles auth, LFS, retries). Falls back to git-based sync automatically
|
| 10 |
- **Password auth** β `OPENCLAW_PASSWORD` for simpler login (optional alternative to token)
|
|
@@ -14,6 +30,7 @@ All notable changes to this project will be documented in this file.
|
|
| 14 |
- **OpenCode Zen/Go** β support for OpenCode's tested model service
|
| 15 |
|
| 16 |
### Changed
|
|
|
|
| 17 |
- Provider detection now uses `case` statement (cleaner, faster) with correct OpenClaw provider IDs
|
| 18 |
- Model IDs now sourced from OpenClaw docs (not OpenRouter) for accuracy
|
| 19 |
- Google API key env var corrected to `GEMINI_API_KEY`
|
|
@@ -23,6 +40,7 @@ All notable changes to this project will be documented in this file.
|
|
| 23 |
### π Initial Release
|
| 24 |
|
| 25 |
#### Features
|
|
|
|
| 26 |
- **Any LLM provider** β Anthropic (Claude), OpenAI (GPT-4), Google (Gemini)
|
| 27 |
- **Telegram integration** β connect via @BotFather, supports multiple users
|
| 28 |
- **Built-in keep-alive** β self-pings to prevent HF Spaces 48h sleep
|
|
@@ -36,8 +54,8 @@ All notable changes to this project will be documented in this file.
|
|
| 36 |
- **Zero-config defaults** β just 2 secrets to get started
|
| 37 |
|
| 38 |
#### Architecture
|
|
|
|
| 39 |
- `start.sh` β config generator + validation + orchestrator
|
| 40 |
-
- `keep-alive.sh` β self-ping background service
|
| 41 |
- `workspace-sync.sh` β periodic workspace backup
|
| 42 |
- `health-server.js` β lightweight health endpoint
|
| 43 |
- `dns-fix.js` β DNS override for HF network restrictions
|
|
|
|
| 2 |
|
| 3 |
All notable changes to this project will be documented in this file.
|
| 4 |
|
| 5 |
+
## [1.2.0] - 2026-04-03
|
| 6 |
+
|
| 7 |
+
### Added
|
| 8 |
+
|
| 9 |
+
- **Dashboard-based UptimeRobot setup** β users can now paste their UptimeRobot Main API key directly in the dashboard and create an external uptime monitor
|
| 10 |
+
- **Optional WhatsApp mode** β WhatsApp now stays fully disabled unless `WHATSAPP_ENABLED=true`
|
| 11 |
+
|
| 12 |
+
### Changed
|
| 13 |
+
|
| 14 |
+
- **Documentation simplified** β README now explains the simple dashboard flow for external keep-alive, which key to use, and where to paste it
|
| 15 |
+
|
| 16 |
+
### Removed
|
| 17 |
+
|
| 18 |
+
- **Internal self-ping keep-alive** β removed `keep-alive.sh` and all startup wiring because internal self-pings do not reliably prevent free-tier HF Space sleep
|
| 19 |
+
|
| 20 |
## [1.1.0] - 2026-03-31
|
| 21 |
|
| 22 |
### Added
|
| 23 |
+
|
| 24 |
- **Pre-built Docker image** β uses `ghcr.io/openclaw/openclaw:latest` multi-stage build for much faster builds (minutes instead of 30+)
|
| 25 |
- **Python huggingface_hub sync** β `workspace-sync.py` uses the `huggingface_hub` library for more reliable HF Dataset sync (handles auth, LFS, retries). Falls back to git-based sync automatically
|
| 26 |
- **Password auth** β `OPENCLAW_PASSWORD` for simpler login (optional alternative to token)
|
|
|
|
| 30 |
- **OpenCode Zen/Go** β support for OpenCode's tested model service
|
| 31 |
|
| 32 |
### Changed
|
| 33 |
+
|
| 34 |
- Provider detection now uses `case` statement (cleaner, faster) with correct OpenClaw provider IDs
|
| 35 |
- Model IDs now sourced from OpenClaw docs (not OpenRouter) for accuracy
|
| 36 |
- Google API key env var corrected to `GEMINI_API_KEY`
|
|
|
|
| 40 |
### π Initial Release
|
| 41 |
|
| 42 |
#### Features
|
| 43 |
+
|
| 44 |
- **Any LLM provider** β Anthropic (Claude), OpenAI (GPT-4), Google (Gemini)
|
| 45 |
- **Telegram integration** β connect via @BotFather, supports multiple users
|
| 46 |
- **Built-in keep-alive** β self-pings to prevent HF Spaces 48h sleep
|
|
|
|
| 54 |
- **Zero-config defaults** β just 2 secrets to get started
|
| 55 |
|
| 56 |
#### Architecture
|
| 57 |
+
|
| 58 |
- `start.sh` β config generator + validation + orchestrator
|
|
|
|
| 59 |
- `workspace-sync.sh` β periodic workspace backup
|
| 60 |
- `health-server.js` β lightweight health endpoint
|
| 61 |
- `dns-fix.js` β DNS override for HF network restrictions
|
CONTRIBUTING.md
CHANGED
|
@@ -30,7 +30,7 @@ Thanks for your interest in contributing! π¦
|
|
| 30 |
- Test with at least one LLM provider (Anthropic, OpenAI, or Google)
|
| 31 |
- Test with and without Telegram enabled
|
| 32 |
- Test with and without workspace backup enabled
|
| 33 |
-
- Verify
|
| 34 |
|
| 35 |
## Development Setup
|
| 36 |
|
|
|
|
| 30 |
- Test with at least one LLM provider (Anthropic, OpenAI, or Google)
|
| 31 |
- Test with and without Telegram enabled
|
| 32 |
- Test with and without workspace backup enabled
|
| 33 |
+
- Verify dashboard setup and auto-sync work
|
| 34 |
|
| 35 |
## Development Setup
|
| 36 |
|
Dockerfile
CHANGED
|
@@ -39,10 +39,9 @@ COPY --chown=1000:1000 dns-fix.js /opt/dns-fix.js
|
|
| 39 |
COPY --chown=1000:1000 health-server.js /home/node/app/health-server.js
|
| 40 |
COPY --chown=1000:1000 iframe-fix.cjs /home/node/app/iframe-fix.cjs
|
| 41 |
COPY --chown=1000:1000 start.sh /home/node/app/start.sh
|
| 42 |
-
COPY --chown=1000:1000 keep-alive.sh /home/node/app/keep-alive.sh
|
| 43 |
COPY --chown=1000:1000 wa-guardian.js /home/node/app/wa-guardian.js
|
| 44 |
COPY --chown=1000:1000 workspace-sync.py /home/node/app/workspace-sync.py
|
| 45 |
-
RUN chmod +x /home/node/app/start.sh
|
| 46 |
|
| 47 |
USER node
|
| 48 |
|
|
|
|
| 39 |
COPY --chown=1000:1000 health-server.js /home/node/app/health-server.js
|
| 40 |
COPY --chown=1000:1000 iframe-fix.cjs /home/node/app/iframe-fix.cjs
|
| 41 |
COPY --chown=1000:1000 start.sh /home/node/app/start.sh
|
|
|
|
| 42 |
COPY --chown=1000:1000 wa-guardian.js /home/node/app/wa-guardian.js
|
| 43 |
COPY --chown=1000:1000 workspace-sync.py /home/node/app/workspace-sync.py
|
| 44 |
+
RUN chmod +x /home/node/app/start.sh
|
| 45 |
|
| 46 |
USER node
|
| 47 |
|
README.md
CHANGED
|
@@ -44,7 +44,7 @@ license: mit
|
|
| 44 |
- β‘ **Zero Config:** Duplicate this Space and set **just three** secrets (LLM_API_KEY, LLM_MODEL, GATEWAY_TOKEN) β no other setup needed.
|
| 45 |
- π³ **Fast Builds:** Uses a pre-built OpenClaw Docker image to deploy in minutes.
|
| 46 |
- πΎ **Workspace Backup:** Chats, settings, and WhatsApp session state sync to a private HF Dataset via the `huggingface_hub` (Git fallback), preserving data automatically.
|
| 47 |
-
-
|
| 48 |
- π₯ **Multi-User Messaging:** Support for Telegram (multi-user) and WhatsApp (pairing).
|
| 49 |
- π **Visual Dashboard:** Beautiful Web UI to monitor uptime, sync status, and active models.
|
| 50 |
- π **Webhooks:** Get notified on restarts or backup failures via standard webhooks.
|
|
@@ -127,9 +127,9 @@ For persistent chat history and configuration, HuggingClaw can sync your workspa
|
|
| 127 |
> [!TIP]
|
| 128 |
> This backup also stores a hidden copy of your WhatsApp session credentials, allowing paired logins to survive Space restarts automatically.
|
| 129 |
|
| 130 |
-
##
|
| 131 |
|
| 132 |
-
Free Hugging Face Spaces can still sleep. To keep your Space awake, set up an external UptimeRobot monitor from the dashboard.
|
| 133 |
|
| 134 |
Use the **Main API key** from UptimeRobot.
|
| 135 |
Do **not** use the `Read-only API key` or a `Monitor-specific API key`.
|
|
@@ -254,7 +254,6 @@ openclaw channels login --gateway https://YOUR_SPACE_NAME.hf.space
|
|
| 254 |
HuggingClaw/
|
| 255 |
βββ Dockerfile # Multi-stage build using pre-built OpenClaw image
|
| 256 |
βββ start.sh # Config generator, validator, and orchestrator
|
| 257 |
-
βββ keep-alive.sh # Self-ping to prevent HF Space sleep
|
| 258 |
βββ workspace-sync.py # Syncs workspace to HF Datasets (with Git fallback)
|
| 259 |
βββ health-server.js # /health endpoint for uptime checks
|
| 260 |
βββ dns-fix.js # DNS-over-HTTPS fallback (for blocked domains)
|
|
@@ -268,29 +267,17 @@ HuggingClaw/
|
|
| 268 |
4. Restore workspace from HF Dataset.
|
| 269 |
5. Generate `openclaw.json` from environment variables.
|
| 270 |
6. Print startup summary.
|
| 271 |
-
7. Launch background tasks (
|
| 272 |
8. Launch the OpenClaw gateway (start listening).
|
| 273 |
9. On `SIGTERM`, save workspace and exit cleanly.
|
| 274 |
```
|
| 275 |
|
| 276 |
-
## π Staying Alive
|
| 277 |
-
|
| 278 |
-
HuggingClaw keeps the Space awake without external cron tools:
|
| 279 |
-
|
| 280 |
-
- **Self-ping:** It periodically sends HTTP requests to its own URL (default every 5 minutes).
|
| 281 |
-
- **Health endpoint:** `/health` returns `200 OK` and uptime info.
|
| 282 |
-
- **No external deps:** Fully managed within HF Spaces (no outside pingers or servers).
|
| 283 |
-
|
| 284 |
-
| Variable | Default | Description |
|
| 285 |
-
| :--- | :--- | :--- |
|
| 286 |
-
| `KEEP_ALIVE_INTERVAL` | `300` | Self-ping interval in seconds (0 to disable) |
|
| 287 |
-
|
| 288 |
## π Troubleshooting
|
| 289 |
|
| 290 |
- **Missing secrets:** Ensure `LLM_API_KEY`, `LLM_MODEL`, and `GATEWAY_TOKEN` are set in your Space **Settings β Secrets**.
|
| 291 |
- **Telegram bot issues:** Verify your `TELEGRAM_BOT_TOKEN`. Check Space logs for lines like `π± Enabling Telegram`.
|
| 292 |
- **Backup restore failing:** Make sure `HF_USERNAME` and `HF_TOKEN` are correct (token needs write access to your Dataset).
|
| 293 |
-
- **Space keeps sleeping:**
|
| 294 |
- **Auth errors / proxy:** If you see reverse-proxy auth errors, add the logged IPs under `TRUSTED_PROXIES` (from logs `remote=x.x.x.x`).
|
| 295 |
- **Control UI says too many failed authentication attempts:** Wait for the retry window to expire, then open the Space in an incognito window or clear site storage for your Space before logging in again with `GATEWAY_TOKEN`.
|
| 296 |
- **WhatsApp lost its session after restart:** Make sure `HF_USERNAME` and `HF_TOKEN` are configured so the hidden session backup can be restored on boot.
|
|
|
|
| 44 |
- β‘ **Zero Config:** Duplicate this Space and set **just three** secrets (LLM_API_KEY, LLM_MODEL, GATEWAY_TOKEN) β no other setup needed.
|
| 45 |
- π³ **Fast Builds:** Uses a pre-built OpenClaw Docker image to deploy in minutes.
|
| 46 |
- πΎ **Workspace Backup:** Chats, settings, and WhatsApp session state sync to a private HF Dataset via the `huggingface_hub` (Git fallback), preserving data automatically.
|
| 47 |
+
- β° **External Keep-Alive:** Set up a one-time UptimeRobot monitor from the dashboard to help keep free HF Spaces awake.
|
| 48 |
- π₯ **Multi-User Messaging:** Support for Telegram (multi-user) and WhatsApp (pairing).
|
| 49 |
- π **Visual Dashboard:** Beautiful Web UI to monitor uptime, sync status, and active models.
|
| 50 |
- π **Webhooks:** Get notified on restarts or backup failures via standard webhooks.
|
|
|
|
| 127 |
> [!TIP]
|
| 128 |
> This backup also stores a hidden copy of your WhatsApp session credentials, allowing paired logins to survive Space restarts automatically.
|
| 129 |
|
| 130 |
+
## π Staying Alive *(Recommended on Free HF Spaces)*
|
| 131 |
|
| 132 |
+
Free Hugging Face Spaces can still sleep. HuggingClaw does not rely on internal self-pings anymore. To help keep your Space awake, set up an external UptimeRobot monitor from the dashboard.
|
| 133 |
|
| 134 |
Use the **Main API key** from UptimeRobot.
|
| 135 |
Do **not** use the `Read-only API key` or a `Monitor-specific API key`.
|
|
|
|
| 254 |
HuggingClaw/
|
| 255 |
βββ Dockerfile # Multi-stage build using pre-built OpenClaw image
|
| 256 |
βββ start.sh # Config generator, validator, and orchestrator
|
|
|
|
| 257 |
βββ workspace-sync.py # Syncs workspace to HF Datasets (with Git fallback)
|
| 258 |
βββ health-server.js # /health endpoint for uptime checks
|
| 259 |
βββ dns-fix.js # DNS-over-HTTPS fallback (for blocked domains)
|
|
|
|
| 267 |
4. Restore workspace from HF Dataset.
|
| 268 |
5. Generate `openclaw.json` from environment variables.
|
| 269 |
6. Print startup summary.
|
| 270 |
+
7. Launch background tasks (auto-sync and optional channel helpers).
|
| 271 |
8. Launch the OpenClaw gateway (start listening).
|
| 272 |
9. On `SIGTERM`, save workspace and exit cleanly.
|
| 273 |
```
|
| 274 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
## π Troubleshooting
|
| 276 |
|
| 277 |
- **Missing secrets:** Ensure `LLM_API_KEY`, `LLM_MODEL`, and `GATEWAY_TOKEN` are set in your Space **Settings β Secrets**.
|
| 278 |
- **Telegram bot issues:** Verify your `TELEGRAM_BOT_TOKEN`. Check Space logs for lines like `π± Enabling Telegram`.
|
| 279 |
- **Backup restore failing:** Make sure `HF_USERNAME` and `HF_TOKEN` are correct (token needs write access to your Dataset).
|
| 280 |
+
- **Space keeps sleeping:** Open `/dashboard` and use `Keep Space Awake` to create the external monitor.
|
| 281 |
- **Auth errors / proxy:** If you see reverse-proxy auth errors, add the logged IPs under `TRUSTED_PROXIES` (from logs `remote=x.x.x.x`).
|
| 282 |
- **Control UI says too many failed authentication attempts:** Wait for the retry window to expire, then open the Space in an incognito window or clear site storage for your Space before logging in again with `GATEWAY_TOKEN`.
|
| 283 |
- **WhatsApp lost its session after restart:** Make sure `HF_USERNAME` and `HF_TOKEN` are configured so the hidden session backup can be restored on boot.
|
keep-alive.sh
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
# Self-ping keep-alive for HF Spaces
|
| 3 |
-
# HF Spaces sleeps after 48h of inactivity (no HTTP requests)
|
| 4 |
-
# This script pings the Space's own URL to prevent that
|
| 5 |
-
#
|
| 6 |
-
# HF provides SPACE_HOST env var automatically (e.g., "username-spacename.hf.space")
|
| 7 |
-
# Runs as a background process alongside the gateway
|
| 8 |
-
|
| 9 |
-
INTERVAL="${KEEP_ALIVE_INTERVAL:-300}" # Default: every 5 minutes
|
| 10 |
-
|
| 11 |
-
if [ "$INTERVAL" = "0" ]; then
|
| 12 |
-
echo "βΈοΈ Keep-alive: disabled (KEEP_ALIVE_INTERVAL=0)"
|
| 13 |
-
exit 0
|
| 14 |
-
fi
|
| 15 |
-
|
| 16 |
-
if [ -z "$SPACE_HOST" ]; then
|
| 17 |
-
echo "βΈοΈ Keep-alive: SPACE_HOST not set (not on HF Spaces?), skipping."
|
| 18 |
-
exit 0
|
| 19 |
-
fi
|
| 20 |
-
|
| 21 |
-
# Ping the health endpoint so we keep the Space warm without touching the gateway
|
| 22 |
-
PING_URL="https://${SPACE_HOST}/health"
|
| 23 |
-
|
| 24 |
-
echo "π Keep-alive started: pinging ${PING_URL} every ${INTERVAL}s"
|
| 25 |
-
|
| 26 |
-
while true; do
|
| 27 |
-
sleep "$INTERVAL"
|
| 28 |
-
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$PING_URL" 2>/dev/null)
|
| 29 |
-
if [ "$HTTP_CODE" = "000" ]; then
|
| 30 |
-
echo "π Keep-alive: ping failed (network error), retrying next cycle..."
|
| 31 |
-
else
|
| 32 |
-
echo "π Keep-alive: OK"
|
| 33 |
-
fi
|
| 34 |
-
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start.sh
CHANGED
|
@@ -331,11 +331,8 @@ else
|
|
| 331 |
printf " β %-40s β\n" "Auth: π token"
|
| 332 |
fi
|
| 333 |
if [ -n "$SPACE_HOST" ]; then
|
| 334 |
-
printf " β %-40s β\n" "Keep-alive: β
every ${KEEP_ALIVE_INTERVAL:-300}s"
|
| 335 |
printf " β %-40s β\n" "Control UI: https://${SPACE_HOST}"
|
| 336 |
printf " β %-40s β\n" "Dashboard: https://${SPACE_HOST}/dashboard"
|
| 337 |
-
else
|
| 338 |
-
printf " β %-40s β\n" "Keep-alive: βΈοΈ local mode"
|
| 339 |
fi
|
| 340 |
SYNC_STATUS="β disabled"
|
| 341 |
if [ -n "$HF_USERNAME" ] && [ -n "$HF_TOKEN" ]; then
|
|
@@ -388,10 +385,6 @@ export LLM_MODEL="$LLM_MODEL"
|
|
| 388 |
node /home/node/app/health-server.js &
|
| 389 |
HEALTH_PID=$!
|
| 390 |
|
| 391 |
-
# 11. Start HF keep-alive
|
| 392 |
-
/home/node/app/keep-alive.sh &
|
| 393 |
-
KEEP_ALIVE_PID=$!
|
| 394 |
-
|
| 395 |
# ββ Launch gateway ββ
|
| 396 |
echo "π Launching OpenClaw gateway on port 7860..."
|
| 397 |
echo ""
|
|
@@ -415,14 +408,14 @@ if ! kill -0 $GATEWAY_PID 2>/dev/null; then
|
|
| 415 |
exit 1
|
| 416 |
fi
|
| 417 |
|
| 418 |
-
#
|
| 419 |
if [ "$WHATSAPP_ENABLED_NORMALIZED" = "true" ]; then
|
| 420 |
node /home/node/app/wa-guardian.js &
|
| 421 |
GUARDIAN_PID=$!
|
| 422 |
echo "π‘οΈ WhatsApp Guardian started (PID: $GUARDIAN_PID)"
|
| 423 |
fi
|
| 424 |
|
| 425 |
-
#
|
| 426 |
python3 -u /home/node/app/workspace-sync.py &
|
| 427 |
|
| 428 |
# Wait for gateway (allows trap to fire)
|
|
|
|
| 331 |
printf " β %-40s β\n" "Auth: π token"
|
| 332 |
fi
|
| 333 |
if [ -n "$SPACE_HOST" ]; then
|
|
|
|
| 334 |
printf " β %-40s β\n" "Control UI: https://${SPACE_HOST}"
|
| 335 |
printf " β %-40s β\n" "Dashboard: https://${SPACE_HOST}/dashboard"
|
|
|
|
|
|
|
| 336 |
fi
|
| 337 |
SYNC_STATUS="β disabled"
|
| 338 |
if [ -n "$HF_USERNAME" ] && [ -n "$HF_TOKEN" ]; then
|
|
|
|
| 385 |
node /home/node/app/health-server.js &
|
| 386 |
HEALTH_PID=$!
|
| 387 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 388 |
# ββ Launch gateway ββ
|
| 389 |
echo "π Launching OpenClaw gateway on port 7860..."
|
| 390 |
echo ""
|
|
|
|
| 408 |
exit 1
|
| 409 |
fi
|
| 410 |
|
| 411 |
+
# 11. Start WhatsApp Guardian after the gateway is accepting connections
|
| 412 |
if [ "$WHATSAPP_ENABLED_NORMALIZED" = "true" ]; then
|
| 413 |
node /home/node/app/wa-guardian.js &
|
| 414 |
GUARDIAN_PID=$!
|
| 415 |
echo "π‘οΈ WhatsApp Guardian started (PID: $GUARDIAN_PID)"
|
| 416 |
fi
|
| 417 |
|
| 418 |
+
# 12. Start Workspace Sync after startup settles
|
| 419 |
python3 -u /home/node/app/workspace-sync.py &
|
| 420 |
|
| 421 |
# Wait for gateway (allows trap to fire)
|