Sanyam400 commited on
Commit
d0bbb7c
Β·
verified Β·
1 Parent(s): 9fcc5b0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -31
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  # ============================================================
2
- # Hermes Agent β€” Self-contained HF Spaces deployment (Stable v7.8)
3
  # Single Dockerfile: Gateway + Dashboard + Chat WebUI + Router
4
  #
5
  # HOW TO DEPLOY:
@@ -41,6 +41,7 @@ ENV PYTHONUNBUFFERED=1 \
41
  TERM=xterm-256color \
42
  SHELL=/bin/bash \
43
  SYNC_INTERVAL=30 \
 
44
  # ── BROWSER FIX: Force --no-sandbox + --disable-dev-shm-usage for ALL
45
  # Chromium launches. HuggingFace Spaces (like most containers/VMs) runs
46
  # with AppArmor unprivileged user namespace restrictions enabled, which
@@ -225,10 +226,15 @@ proxy.on('error', function(err, req, res) {
225
  proxy.on('proxyRes', function (proxyRes, req, res) {
226
  var location = proxyRes.headers['location'];
227
  if (location) {
228
- location = location.replace(/^https?:\/\/127\.0\.0\.1:9119/i, '');
229
- location = location.replace(/^https?:\/\/localhost:9119/i, '');
230
- if (location.indexOf('/dashboard') !== 0 && isDashboardPath(req.url)) {
231
- location = '/dashboard' + location;
 
 
 
 
 
232
  }
233
  proxyRes.headers['location'] = location;
234
  }
@@ -258,6 +264,7 @@ function authed(req) {
258
  var params = search.split('&');
259
  for (var i = 0; i < params.length; i++) {
260
  var pair = params[i].split('=');
 
261
  if (pair === 'token' && decodeURIComponent(pair || '').trim() === cleanGatewayToken) {
262
  return true;
263
  }
@@ -552,10 +559,9 @@ mkdir -m 777 -p /tmp/agent-browser-sockets
552
  echo "[boot] πŸ”„ Checking for WebUI updates in background..."
553
  (cd /opt/hermes-webui && git pull >/dev/null 2>&1) &
554
 
555
- # ── 2. HIGH SPEED SELECTIVE EXCLUSION SYNC ────────────────────
556
- # FIX: Direct bucket-only sync. Runs on standard buckets scheme without datasets fallbacks.
557
- # HIGH-SPEED PATCH: We only synchronize DB files, YAML configurations, and memory structures.
558
- # This prevents scanning the other 24,000+ heavy environment files, speeding boot to under 1 second!
559
  if [ -n "${HF_TOKEN:-}" ] && [ -n "${HF_BUCKET:-}" ]; then
560
  echo "[boot] πŸ“¦ Restoring complete old workspace datasets..."
561
 
@@ -563,22 +569,17 @@ if [ -n "${HF_TOKEN:-}" ] && [ -n "${HF_BUCKET:-}" ]; then
563
  HF_TOKEN=$(echo "$HF_TOKEN" | tr -d '\r' | tr -d ' ' | tr -d '\n')
564
  export HF_TOKEN="${HF_TOKEN}"
565
 
566
- SYNC_RESTORE_LOG=$(mktemp)
567
- # Standardize hf sync command with precise includes and glob exclusions for ultra-high speed restoration.
568
  if hf sync "hf://buckets/${HF_BUCKET}" "$HH" \
569
- --include "*.db" \
570
- --include "config.yaml" \
571
- --include "webui_settings.json" \
572
- --include "memory/*.db" \
573
- --include "skills/**" \
574
- --exclude "*" > "$SYNC_RESTORE_LOG" 2>&1; then
575
  echo "[boot] βœ… Old databases, configs, & logs restored instantly"
576
- rm -f "$SYNC_RESTORE_LOG"
577
  else
578
- echo "[boot] ❌ Bucket sync restore failed! Sync error details:"
579
- cat "$SYNC_RESTORE_LOG"
580
- rm -f "$SYNC_RESTORE_LOG"
581
- echo "[boot] Starting fresh with default local configurations."
582
  fi
583
  fi
584
 
@@ -736,7 +737,6 @@ else
736
  echo "[boot] πŸ”§ Appending browser config block to existing config.yaml..."
737
  cat >> "$CFG" << YAML
738
 
739
- # ── BROWSER: container-safe settings (auto-appended by bootloader) ────────────
740
  browser:
741
  command_timeout: 90
742
  inactivity_timeout: 120
@@ -835,16 +835,16 @@ if [ -n "${HF_TOKEN:-}" ] && [ -n "${HF_BUCKET:-}" ]; then
835
  while true; do
836
  sleep "${SYNC_INTERVAL:-30}"
837
 
838
- # Sync and backup exclusively through standard Hugging Face bucket endpoint (hf://buckets/...)
839
- # selectively syncing only DB files, YAML configurations, and custom memory maps.
840
  hf sync "$HH" "hf://buckets/${HF_BUCKET}" \
841
  --delete \
842
- --include "*.db" \
843
- --include "config.yaml" \
844
- --include "webui_settings.json" \
845
- --include "memory/*.db" \
846
- --include "skills/**" \
847
- --exclude "*" >/dev/null 2>&1 || true
848
  done
849
  ) &
850
  fi
 
1
  # ============================================================
2
+ # Hermes Agent β€” Self-contained HF Spaces deployment (Stable v7.9)
3
  # Single Dockerfile: Gateway + Dashboard + Chat WebUI + Router
4
  #
5
  # HOW TO DEPLOY:
 
41
  TERM=xterm-256color \
42
  SHELL=/bin/bash \
43
  SYNC_INTERVAL=30 \
44
+ HF_HOME=/tmp/.hf_home \
45
  # ── BROWSER FIX: Force --no-sandbox + --disable-dev-shm-usage for ALL
46
  # Chromium launches. HuggingFace Spaces (like most containers/VMs) runs
47
  # with AppArmor unprivileged user namespace restrictions enabled, which
 
226
  proxy.on('proxyRes', function (proxyRes, req, res) {
227
  var location = proxyRes.headers['location'];
228
  if (location) {
229
+ // Rewrite absolute loopback redirects to relative paths
230
+ location = location.replace(/^https?:\/\/127\.0\.0\.1:\d+/i, '');
231
+ location = location.replace(/^https?:\/\/localhost:\d+/i, '');
232
+
233
+ // Ensure dashboard sub-pages maintain the /dashboard prefix
234
+ if (isDashboardPath(req.url)) {
235
+ if (location.indexOf('/dashboard') !== 0 && location.indexOf('http') !== 0) {
236
+ location = '/dashboard' + (location.startsWith('/') ? '' : '/') + location;
237
+ }
238
  }
239
  proxyRes.headers['location'] = location;
240
  }
 
264
  var params = search.split('&');
265
  for (var i = 0; i < params.length; i++) {
266
  var pair = params[i].split('=');
267
+ // FIX: Correctly check array key pair elements to support iframe token query parameter bypasses
268
  if (pair === 'token' && decodeURIComponent(pair || '').trim() === cleanGatewayToken) {
269
  return true;
270
  }
 
559
  echo "[boot] πŸ”„ Checking for WebUI updates in background..."
560
  (cd /opt/hermes-webui && git pull >/dev/null 2>&1) &
561
 
562
+ # ── 2. ORIGINAL STABLE BUCKET SYNC (Reverted to standard v6.0 setup) ──────────
563
+ # Runs on standard buckets scheme and performs full synchronization of all files,
564
+ # guaranteeing complete restoration of your workspace configurations and datasets.
 
565
  if [ -n "${HF_TOKEN:-}" ] && [ -n "${HF_BUCKET:-}" ]; then
566
  echo "[boot] πŸ“¦ Restoring complete old workspace datasets..."
567
 
 
569
  HF_TOKEN=$(echo "$HF_TOKEN" | tr -d '\r' | tr -d ' ' | tr -d '\n')
570
  export HF_TOKEN="${HF_TOKEN}"
571
 
572
+ # Standardize hf sync command with simple exclusions for complete restoration.
 
573
  if hf sync "hf://buckets/${HF_BUCKET}" "$HH" \
574
+ --exclude ".venv/**" --exclude "**/venv/**" --exclude "venv/**" \
575
+ --exclude ".cache/**" --exclude "**/.cache/**" \
576
+ --exclude "node_modules/**" --exclude "**/node_modules/**" \
577
+ --exclude "__pycache__/**" --exclude "**/__pycache__/**" \
578
+ --exclude "**/*.pyc" --exclude "**/*.log" --exclude "logs/**" --exclude "**/logs/**" \
579
+ --exclude "**/*.db-wal" --exclude "**/*.db-shm" --exclude "**/*.db-journal"; then
580
  echo "[boot] βœ… Old databases, configs, & logs restored instantly"
 
581
  else
582
+ echo "[boot] ⚠️ Bucket empty or authentication failed β€” starting fresh."
 
 
 
583
  fi
584
  fi
585
 
 
737
  echo "[boot] πŸ”§ Appending browser config block to existing config.yaml..."
738
  cat >> "$CFG" << YAML
739
 
 
740
  browser:
741
  command_timeout: 90
742
  inactivity_timeout: 120
 
835
  while true; do
836
  sleep "${SYNC_INTERVAL:-30}"
837
 
838
+ # FIX: Reverted back to the original full-sync style from v6.0 that synchronized
839
+ # all 24,000+ files in your private bucket correctly without includes or fast excludes.
840
  hf sync "$HH" "hf://buckets/${HF_BUCKET}" \
841
  --delete \
842
+ --exclude ".venv/**" --exclude "**/venv/**" --exclude "venv/**" \
843
+ --exclude ".cache/**" --exclude "**/.cache/**" \
844
+ --exclude "node_modules/**" --exclude "**/node_modules/**" \
845
+ --exclude "__pycache__/**" --exclude "**/__pycache__/**" \
846
+ --exclude "**/*.pyc" --exclude "**/*.log" --exclude "logs/**" --exclude "**/logs/**" \
847
+ --exclude "**/*.db-wal" --exclude "**/*.db-shm" --exclude "**/*.db-journal" >/dev/null 2>&1 || true
848
  done
849
  ) &
850
  fi