clawchain/dantegpu-core/setup-nats-streams.sh

1 line
1.3 KiB
Bash
Executable File

#!/bin/bash echo "=== SETTING UP NATS STREAMS FOR DANTEGPU ===" # Function to create a stream via HTTP API create_stream() { local stream_name=$1 local subjects=$2 local storage=$3 echo "Creating stream: $stream_name with subjects: $subjects" curl -X POST http://localhost:8222/api/v1/streams \ -H "Content-Type: application/json" \ -d "{ \"name\": \"$stream_name\", \"subjects\": [$subjects], \"storage\": \"$storage\", \"max_msgs\": 1000000, \"max_bytes\": 104857600, \"max_age\": 86400000000000, \"retention\": \"limits\", \"discard\": \"old\", \"num_replicas\": 1 }" echo "" } # Create required streams for DanteGPU platform # 1. Tasks stream for job dispatch and management create_stream "TASKS" "\"tasks.>\", \"jobs.>\", \"dispatch.>\"" "file" # 2. Billing stream for payment processing create_stream "BILLING" "\"billing.>\", \"payments.>\", \"transactions.>\"" "file" # 3. Monitoring stream for system metrics create_stream "MONITORING" "\"metrics.>\", \"health.>\", \"status.>\"" "file" # 4. GPU stream for GPU-related events create_stream "GPU" "\"gpu.>\", \"provider.>\", \"rental.>\"" "file" # 5. Notifications stream for real-time updates create_stream "NOTIFICATIONS" "\"notifications.>\", \"alerts.>\", \"events.>\"" "file" echo "=== VERIFYING STREAMS ===" curl -X GET http://localhost:8222/jsz | jq '.' echo "=== NATS STREAMS SETUP COMPLETE ==="