Spaces:
Sleeping
Sleeping
Update sync_script.sh
Browse files1234567891011121314151617181920212223242526272829303132333435363738#!/bin/bash# 1. Download existing DB using the NEW 'hf' commandmkdir -p /convex/datahf download datasets/leadshello/Agent-Ai --local-dir /convex/data --token $HF_TOKEN || echo "No existing DB found."# 2. Start the Nginx Traffic Copnginx# 2.5 Start the Billing Dashboard Generator in the backgroundpython3 /app/billing_dashboard.py &# 3. Define your Master Password# ... (the rest of your script remains exactly the same) ...# 3. Define your Master Password (Convex reads this specific environment variable)export INSTANCE_SECRET="convex-self-hosted|leadshello-admin-key-2026"# 4. Hunt down the Convex binary (bypassing any $PATH issues) and start itcd /convex/dataecho "Hunting for Convex engine..."CONVEX_BIN=$(find / -type f \( -name "convex-local-backend" -o -name "convex-backend" \) -executable 2>/dev/null | head -n 1)echo "Starting Convex Backend at $CONVEX_BIN..."$CONVEX_BIN &# 5. Give the backend 10 seconds to wake upsleep 10echo "=========================================================="echo "YOUR MASTER PASSWORD IS:"echo "$INSTANCE_SECRET"echo "=========================================================="# 6. Sync the database back to your Dataset every 10 mins using the NEW 'hf' commandwhile true; dosleep 600hf upload datasets/leadshello/Agent-Ai /convex/data . --token $HF_TOKENdone12345678910111213141516171819202122232425262728293031323334353637383940414243#!/bin/bash# 1. Download existing DB directly into Convex's core directoryhf download datasets/leadshello/Agent-Ai --local-dir /convex --token $HF_TOKEN || echo "No existing DB found."# 2. Start the Nginx Traffic Copnginx# 3. Move into the core directory where all binaries livecd /convex# 4. Generate the REAL cryptographic Admin Key (This creates the DB if it's missing)echo "=========================================================="echo "YOUR REAL CRYPTOGRAPHIC MASTER PASSWORD IS:"./generate_admin_key.shecho "=========================================================="# 5. Start the Convex engine safelyecho "Starting Convex Backend..."./convex-local-backend &# 6. Start the Billing Dashboard (if you added the python file)if [ -f "/app/billing_dashboard.py" ]; thenpython3 /app/billing_dashboard.py &fi# 7. Sync the exact database files back to your Datasetwhile true; dosleep 600echo "Syncing database to Hugging Face..."# Upload the main database filehf upload datasets/leadshello/Agent-Ai /convex/convex_local_backend.sqlite3 convex_local_backend.sqlite3 --token $HF_TOKEN# Upload SQLite memory files (Crucial for preventing corruption)[ -f "/convex/convex_local_backend.sqlite3-wal" ] && hf upload datasets/leadshello/Agent-Ai /convex/convex_local_backend.sqlite3-wal convex_local_backend.sqlite3-wal --token $HF_TOKEN[ -f "/convex/convex_local_backend.sqlite3-shm" ] && hf upload datasets/leadshello/Agent-Ai /convex/convex_local_backend.sqlite3-shm convex_local_backend.sqlite3-shm --token $HF_TOKEN# Upload User Media/Filesif [ -d "/convex/convex_local_storage" ]; thenhf upload datasets/leadshello/Agent-Ai /convex/convex_local_storage convex_local_storage --token $HF_TOKENfidone
sync_script.sh+31-26