fix: remove Python Supabase upload (handled by setup.sh)
Browse files- hermes_run.py +1 -58
hermes_run.py
CHANGED
|
@@ -60,64 +60,7 @@ thread = threading.Thread(target=server.serve_forever, daemon=True)
|
|
| 60 |
thread.start()
|
| 61 |
print('[Hermes] Step 2/6: Health server started on port 7860', flush=True)
|
| 62 |
|
| 63 |
-
print('[Hermes] Step 3/6:
|
| 64 |
-
# Start Supabase upload as background process
|
| 65 |
-
HERMES_DIR = os.getenv('HERMES_HOME', '/root/.hermes')
|
| 66 |
-
SUPABASE_URL = os.getenv('SUPABASE_URL', 'https://mgcfsinockiucyvptluv.supabase.co')
|
| 67 |
-
SUPABASE_KEY = os.getenv('SUPABASE_KEY', '')
|
| 68 |
-
SUPABASE_BUCKET = os.getenv('SUPABASE_BUCKET', 'hermes-agent')
|
| 69 |
-
|
| 70 |
-
if SUPABASE_KEY:
|
| 71 |
-
import subprocess
|
| 72 |
-
import glob
|
| 73 |
-
def upload_loop():
|
| 74 |
-
time.sleep(180) # Wait 3 min before first upload
|
| 75 |
-
while True:
|
| 76 |
-
print(f'[Hermes] [Supabase] Uploading to bucket...', flush=True)
|
| 77 |
-
try:
|
| 78 |
-
import os
|
| 79 |
-
import urllib.request
|
| 80 |
-
import json
|
| 81 |
-
|
| 82 |
-
for root, dirs, files in os.walk(HERMES_DIR):
|
| 83 |
-
for file in files:
|
| 84 |
-
file_path = os.path.join(root, file)
|
| 85 |
-
relative = os.path.relpath(file_path, HERMES_DIR)
|
| 86 |
-
|
| 87 |
-
try:
|
| 88 |
-
size = os.path.getsize(file_path)
|
| 89 |
-
if size > 5 * 1024 * 1024:
|
| 90 |
-
print(f'[Supabase] Skipping large file: {relative} ({size} bytes)')
|
| 91 |
-
continue
|
| 92 |
-
except:
|
| 93 |
-
pass
|
| 94 |
-
|
| 95 |
-
url = f'{SUPABASE_URL}/storage/v1/object/{SUPABASE_BUCKET}/{relative}'
|
| 96 |
-
req = urllib.request.Request(
|
| 97 |
-
url,
|
| 98 |
-
data=open(file_path, 'rb').read(),
|
| 99 |
-
headers={
|
| 100 |
-
'Authorization': f'Bearer {SUPABASE_KEY}',
|
| 101 |
-
'Content-Type': 'application/octet-stream'
|
| 102 |
-
},
|
| 103 |
-
method='PUT'
|
| 104 |
-
)
|
| 105 |
-
try:
|
| 106 |
-
urllib.request.urlopen(req, timeout=30)
|
| 107 |
-
print(f'[Supabase] Uploaded: {relative}')
|
| 108 |
-
except Exception as e:
|
| 109 |
-
print(f'[Supabase] Failed: {relative} - {e}')
|
| 110 |
-
|
| 111 |
-
print(f'[Hermes] [Supabase] Upload complete', flush=True)
|
| 112 |
-
except Exception as e:
|
| 113 |
-
print(f'[Hermes] [Supabase] Error: {e}', flush=True)
|
| 114 |
-
time.sleep(180)
|
| 115 |
-
|
| 116 |
-
upload_thread = threading.Thread(target=upload_loop, daemon=True)
|
| 117 |
-
upload_thread.start()
|
| 118 |
-
print('[Hermes] Step 3/6: Supabase upload started (background)', flush=True)
|
| 119 |
-
else:
|
| 120 |
-
print('[Hermes] Step 3/6: SUPABASE_KEY not set, skipping upload', flush=True)
|
| 121 |
|
| 122 |
print('[Hermes] Step 4/6: Importing gateway.run...', flush=True)
|
| 123 |
import asyncio
|
|
|
|
| 60 |
thread.start()
|
| 61 |
print('[Hermes] Step 2/6: Health server started on port 7860', flush=True)
|
| 62 |
|
| 63 |
+
print('[Hermes] Step 3/6: Supabase upload handled by setup.sh (background process)', flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
print('[Hermes] Step 4/6: Importing gateway.run...', flush=True)
|
| 66 |
import asyncio
|