Spaces:
Paused
Paused
feat: update Dockerfile and start.sh to use python3 and enhance startup banner
Browse filesFiles changed (2)
- Dockerfile+1
- start.sh+46-15
8 unmodified lines91011121314158 unmodified lines ca-certificates \ curl \ jq \ python3 \ && rm -rf /var/lib/apt/lists/* \ && uv pip install --python /opt/hermes/.venv/bin/python --no-cache-dir huggingface_hub
2 unmodified lines34567891011121311 unmodified lines2526272829303132333435363727383940413 unmodified lines45464737383940414248495051525347545556573 unmodified lines61626357646566671 unmodified line697071657273747514 unmodified lines909192869394959693 unmodified lines19019119219318619419519619753 unmodified lines25125225325425525625725825926026126226326426526626726826927027127227327427527627727825027928028128228328428528628728828929026129129229329410 unmodified lines30530630730830931031120 unmodified lines3323333343043353363373382 unmodified lines
umask 0077
# ════════════════════════════════════════════════════════════════# HuggingMess — Hermes Gateway for HF Spaces# ════════════════════════════════════════════════════════════════
# ── Startup Banner ──APP_DIR="${HUGGINGMESS_APP_DIR:-/opt/huggingmess}"HERMES_HOME="${HERMES_HOME:-/opt/data}"PUBLIC_PORT="${PORT:-7861}"11 unmodified linesexport GATEWAY_HEALTH_URL="${GATEWAY_HEALTH_URL:-http://127.0.0.1:${GATEWAY_API_PORT}}"export TELEGRAM_WEBHOOK_PORT
echo ""echo " ╔══════════════════════════════════════════╗"echo " ║ 💬 HuggingMess Hermes Gateway ║"echo " ╚══════════════════════════════════════════╝"echo ""
if [ -z "${API_SERVER_KEY:-}" ]; then if [ -n "${GATEWAY_TOKEN:-}" ]; then export API_SERVER_KEY="$GATEWAY_TOKEN" else API_SERVER_KEY="$(python - <<'PY' API_SERVER_KEY="$(python3 - <<'PY'import secretsprint(secrets.token_urlsafe(32))PY3 unmodified lines fifi
echo ""echo " =========================================="echo " HuggingMess Hermes Gateway"echo " =========================================="echo ""
# ── Setup directories ──mkdir -p "$HERMES_HOME"/{cron,sessions,logs,hooks,memories,skills,skins,plans,workspace,home}
# ── Restore workspace/state from HF Dataset ──if [ -n "${HF_TOKEN:-}" ]; then echo "Restoring Hermes state from HF Dataset..." python "$APP_DIR/hermes-sync.py" restore || true python3 "$APP_DIR/hermes-sync.py" restore || trueelse echo "HF_TOKEN not set - dataset persistence is disabled."fi3 unmodified linesif [ -n "${CLOUDFLARE_WORKERS_TOKEN:-}" ] || [ -n "${CLOUDFLARE_PROXY_URL:-}" ]; then export CLOUDFLARE_PROXY_DEBUG="${CLOUDFLARE_PROXY_DEBUG:-false}" echo "Preparing Cloudflare Telegram proxy..." python "$APP_DIR/cloudflare-proxy-setup.py" || true python3 "$APP_DIR/cloudflare-proxy-setup.py" || true if [ -f "$CF_PROXY_ENV_FILE" ]; then . "$CF_PROXY_ENV_FILE" fi1 unmodified line
if [ -n "${CLOUDFLARE_WORKERS_TOKEN:-}" ]; then echo "Preparing Cloudflare Keepalive worker..." python "$APP_DIR/cloudflare-keepalive-setup.py" || true python3 "$APP_DIR/cloudflare-keepalive-setup.py" || truefi
if [ -n "${TELEGRAM_USER_IDS:-}" ] && [ -z "${TELEGRAM_ALLOWED_USERS:-}" ]; then14 unmodified lines export TELEGRAM_WEBHOOK_SECRET TELEGRAM_WEBHOOK_SECRET="$(cat "$SECRET_FILE")" else TELEGRAM_WEBHOOK_SECRET="$(python - <<'PY' TELEGRAM_WEBHOOK_SECRET="$(python3 - <<'PY'import secretsprint(secrets.token_hex(32))PY93 unmodified lines export TELEGRAM_BASE_FILE_URL="${CLOUDFLARE_PROXY_URL}/file/bot"fi
# ── Build config ──python - <<'PY'python3 - <<'PY'import osfrom pathlib import Path
53 unmodified linespath.chmod(0o600)PY
# ── Startup Summary ──echo ""echo "Model : ${MODEL_FOR_CONFIG:-unset}"echo "Provider : ${PROVIDER_FOR_CONFIG:-unset}"if [ -n "${TELEGRAM_BOT_TOKEN:-}" ]; then echo "Telegram : enabled"else echo "Telegram : not configured"fiif [ -n "${HF_TOKEN:-}" ]; then echo "Backup : ${BACKUP_DATASET} (every ${SYNC_INTERVAL:-180}s)"else echo "Backup : disabled"fiif [ -n "${CLOUDFLARE_PROXY_URL:-}" ]; then echo "Proxy : ${CLOUDFLARE_PROXY_URL}"fiecho "Dashboard : http://127.0.0.1:${DASHBOARD_PORT}"echo "Gateway : http://127.0.0.1:${GATEWAY_API_PORT}"echo ""
# ── Trap SIGTERM for graceful shutdown ──graceful_shutdown() { echo "Shutting down HuggingMess..." if [ -n "${HF_TOKEN:-}" ]; then python "$APP_DIR/hermes-sync.py" sync-once || echo "Warning: shutdown sync failed." python3 "$APP_DIR/hermes-sync.py" sync-once || echo "Warning: shutdown sync failed." fi kill $(jobs -p) 2>/dev/null || true exit 0}trap graceful_shutdown SIGTERM SIGINT
# ── Start background services ──node "$APP_DIR/health-server.js" &HEALTH_PID=$!
if [ -n "${WEBHOOK_URL:-}" ]; then python - <<'PY' >/dev/null 2>&1 & python3 - <<'PY' >/dev/null 2>&1 &import json, os, urllib.requestbody = json.dumps({ "event": "restart",10 unmodified lines(hermes dashboard --host 127.0.0.1 --insecure 2>&1 | tee -a "$HERMES_HOME/logs/dashboard.log") &DASHBOARD_PID=$!
# ── Launch gateway ──echo "Launching Hermes gateway..."(hermes gateway run 2>&1 | tee -a "$HERMES_HOME/logs/gateway.log") &GATEWAY_PID=$!20 unmodified linesfi
if [ -n "${HF_TOKEN:-}" ]; then python -u "$APP_DIR/hermes-sync.py" loop & python3 -u "$APP_DIR/hermes-sync.py" loop &fi
wait "$GATEWAY_PID"Dockerfile+1
start.sh+46-15