Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

🔖 Checkpoint: Edit /workspaces/claude-code-flow/examples/litellm/docker/healthcheck.py

rUv1e9a54653611
diff --git a/.claude/checkpoints/1754571146.json b/.claude/checkpoints/1754571146.json
new file mode 100644
index 0000000000..9cb37351d2
--- /dev/null
+++ b/.claude/checkpoints/1754571146.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250807-125226", "file": "/workspaces/claude-code-flow/examples/litellm/config/nginx.conf", "timestamp": "2025-08-07T12:52:26Z", "type": "pre-edit", "original_branch": "alpha-88"}
diff --git a/.claude/checkpoints/1754571148.json b/.claude/checkpoints/1754571148.json
new file mode 100644
index 0000000000..0159f8e2b0
--- /dev/null
+++ b/.claude/checkpoints/1754571148.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250807-125228", "file": "/workspaces/claude-code-flow/examples/litellm/config/nginx.conf", "timestamp": "2025-08-07T12:52:28Z", "type": "post-edit", "branch": "alpha-88", "diff_summary": " .claude-flow/metrics/performance.json | 6 +- .claude-flow/metrics/system-metrics.json | 192 +++++++++++++++++ .claude-flow/metrics/task-metrics.json | 14 +- .claude/checkpoints/1754571142.json | 1 + .claude/checkpoints/1754571144.json | 1 + .../cli/__pycache__/main.cpython-312.pyc | Bin 45867 -> 45867 bytes examples/litellm/config/nginx.conf | 230 +++++++++++++++++++++ hello-bench-test/hello.js | 12 -- hello-bench/hello.mjs | 10 - hello-world-v2/architecture.md | 127 ------------ hello-world-v2/package.json | 35 ---- hello-world-v2/pseudocode.md | 85 -------- hello-world-v2/specification.md | 46 ----- 13 files changed, 430 insertions(+), 329 deletions(-) "}
diff --git a/examples/litellm/docker/healthcheck.py b/examples/litellm/docker/healthcheck.py
new file mode 100644
index 0000000000..1201bfa6fb
--- /dev/null
+++ b/examples/litellm/docker/healthcheck.py
@@ -0,0 +1,88 @@
+#!/usr/bin/env python3
+"""
+Health check script for LiteLLM proxy
+"""
+
+import sys
+import os
+import requests
+import psycopg2
+import redis
+from urllib.parse import urlparse
+
+def check_http_service():
+ """Check if LiteLLM HTTP service is responding"""
+ try:
+ port = os.environ.get('LITELLM_PORT', '4000')
+ response = requests.get(f'http://localhost:{port}/health', timeout=5)
+ return response.status_code == 200
+ except Exception as e:
+ print(f"HTTP service check failed: {e}")
+ return False
+
+def check_database():
+ """Check PostgreSQL connectivity"""
+ try:
+ db_url = os.environ.get('DATABASE_URL', '')
+ if not db_url:
+ return True # Skip if not configured
+
+ # Parse database URL
+ parsed = urlparse(db_url)
+ conn = psycopg2.connect(
+ host=parsed.hostname,
+ port=parsed.port or 5432,
+ database=parsed.path[1:],
+ user=parsed.username,
+ password=parsed.password,
+ connect_timeout=5
+ )
+ conn.close()
+ return True
+ except Exception as e:
+ print(f"Database check failed: {e}")
+ return False
+
+def check_redis():
+ """Check Redis connectivity"""
+ try:
+ redis_url = os.environ.get('REDIS_URL', '')
+ if not redis_url:
+ return True # Skip if not configured
+
+ # Parse Redis URL
+ parsed = urlparse(redis_url)
+ r = redis.Redis(
+ host=parsed.hostname,
+ port=parsed.port or 6379,
+ socket_connect_timeout=5
+ )
+ r.ping()
+ return True
+ except Exception as e:
+ print(f"Redis check failed: {e}")
+ return False
+
+def main():
+ """Run all health checks"""
+ checks = {
+ 'HTTP Service': check_http_service(),
+ 'Database': check_database(),
+ 'Redis': check_redis()
+ }
+
+ # Print status
+ for name, status in checks.items():
+ status_str = "✓" if status else "✗"
+ print(f"{name}: {status_str}")
+
+ # Exit with appropriate code
+ if all(checks.values()):
+ print("\nAll health checks passed!")
+ sys.exit(0)
+ else:
+ print("\nSome health checks failed!")
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file