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/config/nginx.conf

rUvbe0301d239f9
diff --git a/.claude/checkpoints/1754571142.json b/.claude/checkpoints/1754571142.json
new file mode 100644
index 0000000000..9076499289
--- /dev/null
+++ b/.claude/checkpoints/1754571142.json
@@ -0,0 +1 @@
+{"branch": "checkpoint/pre-edit-20250807-125222", "file": "/workspaces/claude-code-flow/examples/litellm/config/prometheus.yml", "timestamp": "2025-08-07T12:52:22Z", "type": "pre-edit", "original_branch": "alpha-88"}
diff --git a/.claude/checkpoints/1754571144.json b/.claude/checkpoints/1754571144.json
new file mode 100644
index 0000000000..5d960dcda2
--- /dev/null
+++ b/.claude/checkpoints/1754571144.json
@@ -0,0 +1 @@
+{"tag": "checkpoint-20250807-125224", "file": "/workspaces/claude-code-flow/examples/litellm/config/prometheus.yml", "timestamp": "2025-08-07T12:52:24Z", "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/1754571069.json | 1 + .claude/checkpoints/1754571071.json | 1 + .../cli/__pycache__/main.cpython-312.pyc | Bin 45867 -> 45867 bytes examples/litellm/config/prometheus.yml | 68 ++++++++ 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, 268 insertions(+), 329 deletions(-) "}
diff --git a/examples/litellm/config/nginx.conf b/examples/litellm/config/nginx.conf
new file mode 100644
index 0000000000..a2ab3a0b42
--- /dev/null
+++ b/examples/litellm/config/nginx.conf
@@ -0,0 +1,230 @@
+user nginx;
+worker_processes auto;
+error_log /var/log/nginx/error.log warn;
+pid /var/run/nginx.pid;
+
+events {
+ worker_connections 4096;
+ use epoll;
+ multi_accept on;
+}
+
+http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+
+ # Logging
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for" '
+ 'rt=$request_time uct="$upstream_connect_time" '
+ 'uht="$upstream_header_time" urt="$upstream_response_time"';
+
+ access_log /var/log/nginx/access.log main;
+
+ # Performance optimizations
+ sendfile on;
+ tcp_nopush on;
+ tcp_nodelay on;
+ keepalive_timeout 65;
+ keepalive_requests 100;
+ reset_timedout_connection on;
+ client_body_timeout 10;
+ send_timeout 10;
+
+ # Buffers
+ client_body_buffer_size 128k;
+ client_max_body_size 50m;
+ client_header_buffer_size 1k;
+ large_client_header_buffers 4 16k;
+ output_buffers 1 32k;
+ postpone_output 1460;
+
+ # Gzip compression
+ gzip on;
+ gzip_vary on;
+ gzip_proxied any;
+ gzip_comp_level 6;
+ gzip_types text/plain text/css text/xml text/javascript
+ application/json application/javascript application/xml+rss
+ application/rss+xml application/atom+xml image/svg+xml
+ text/x-js text/x-cross-domain-policy application/x-font-ttf
+ application/x-font-opentype application/vnd.ms-fontobject
+ image/x-icon;
+
+ # Rate limiting zones
+ limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;
+ limit_req_zone $http_x_api_key zone=tenant_limit:10m rate=100r/s;
+ limit_conn_zone $binary_remote_addr zone=conn_limit:10m;
+
+ # Upstream configuration for LiteLLM proxies
+ upstream litellm_backend {
+ least_conn;
+
+ server litellm-1:4000 max_fails=3 fail_timeout=30s;
+ server litellm-2:4000 max_fails=3 fail_timeout=30s;
+ server litellm-3:4000 max_fails=3 fail_timeout=30s;
+
+ keepalive 32;
+ keepalive_requests 100;
+ keepalive_timeout 60s;
+ }
+
+ # HTTP server - redirect to HTTPS in production
+ server {
+ listen 80;
+ server_name litellm.local localhost;
+
+ # Health check endpoint
+ location /health {
+ access_log off;
+ return 200 "healthy\n";
+ add_header Content-Type text/plain;
+ }
+
+ # Metrics endpoint for monitoring
+ location /nginx_status {
+ stub_status;
+ allow 127.0.0.1;
+ allow 172.25.0.0/16;
+ deny all;
+ }
+
+ # Main proxy configuration
+ location / {
+ # Rate limiting
+ limit_req zone=api_limit burst=20 nodelay;
+ limit_conn conn_limit 50;
+
+ # CORS headers
+ add_header 'Access-Control-Allow-Origin' '*' always;
+ add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
+ add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-API-Key' always;
+ add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
+
+ # Handle OPTIONS requests
+ if ($request_method = 'OPTIONS') {
+ add_header 'Access-Control-Max-Age' 1728000;
+ add_header 'Content-Type' 'text/plain; charset=utf-8';
+ add_header 'Content-Length' 0;
+ return 204;
+ }
+
+ # Proxy settings
+ proxy_pass http://litellm_backend;
+ proxy_http_version 1.1;
+
+ # Headers
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header Connection "";
+
+ # Timeouts for long-running LLM requests
+ proxy_connect_timeout 10s;
+ proxy_send_timeout 600s;
+ proxy_read_timeout 600s;
+
+ # Buffering
+ proxy_buffering off;
+ proxy_request_buffering off;
+
+ # WebSocket support for streaming
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection "upgrade";
+
+ # Error handling
+ proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
+ proxy_next_upstream_tries 3;
+ proxy_next_upstream_timeout 10s;
+ }
+
+ # Special handling for SSE/streaming endpoints
+ location ~ ^/(v1/)?chat/completions$ {
+ limit_req zone=api_limit burst=10 nodelay;
+
+ proxy_pass http://litellm_backend;
+ proxy_http_version 1.1;
+
+ # SSE specific settings
+ proxy_set_header Connection "";
+ proxy_set_header Cache-Control "no-cache";
+ proxy_set_header X-Accel-Buffering "no";
+
+ # Disable buffering for streaming
+ proxy_buffering off;
+ proxy_cache off;
+
+ # Extended timeout for streaming
+ proxy_read_timeout 3600s;
+
+ # Headers
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+
+ # CORS for streaming
+ add_header 'Access-Control-Allow-Origin' '*' always;
+ add_header 'Access-Control-Allow-Credentials' 'true' always;
+ }
+
+ # Admin endpoints (restricted)
+ location /admin {
+ allow 127.0.0.1;
+ allow 10.0.0.0/8;
+ allow 172.16.0.0/12;
+ allow 192.168.0.0/16;
+ deny all;
+
+ proxy_pass http://litellm_backend;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ }
+ }
+
+ # HTTPS server (for production)
+ server {
+ listen 443 ssl http2;
+ server_name litellm.local;
+
+ # SSL configuration
+ ssl_certificate /etc/nginx/certs/litellm.crt;
+ ssl_certificate_key /etc/nginx/certs/litellm.key;
+ ssl_session_timeout 1d;
+ ssl_session_cache shared:SSL:50m;
+ ssl_session_tickets off;
+
+ # Modern SSL configuration
+ ssl_protocols TLSv1.2 TLSv1.3;
+ ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
+ ssl_prefer_server_ciphers off;
+
+ # HSTS
+ add_header Strict-Transport-Security "max-age=63072000" always;
+
+ # Same location blocks as HTTP server
+ location / {
+ limit_req zone=api_limit burst=20 nodelay;
+ limit_conn conn_limit 50;
+
+ proxy_pass http://litellm_backend;
+ proxy_http_version 1.1;
+
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ proxy_set_header Connection "";
+
+ proxy_connect_timeout 10s;
+ proxy_send_timeout 600s;
+ proxy_read_timeout 600s;
+
+ proxy_buffering off;
+ proxy_request_buffering off;
+ }
+ }
+}
\ No newline at end of file