Files
microdao-daarion/nginx/mvp-routes.conf
Apple 3de3c8cb36 feat: Add presence heartbeat for Matrix online status
- matrix-gateway: POST /internal/matrix/presence/online endpoint
- usePresenceHeartbeat hook with activity tracking
- Auto away after 5 min inactivity
- Offline on page close/visibility change
- Integrated in MatrixChatRoom component
2025-11-27 00:19:40 -08:00

130 lines
4.6 KiB
Plaintext

# ============================================================================
# DAARION MVP Routes — Phase 1-3
# Add these routes to your Nginx config on NODE1
# ============================================================================
# Location: /etc/nginx/sites-available/daarion (or your main nginx config)
# After adding, run: sudo nginx -t && sudo systemctl reload nginx
# ============================================================================
# City Service (7001)
# ============================================================================
location /api/city/ {
proxy_pass http://127.0.0.1:7001/;
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 X-Request-Id $request_id;
# CORS headers (if needed)
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 "Authorization, Content-Type" always;
}
# City WebSocket (for Living Map)
location /ws/city/ {
proxy_pass http://127.0.0.1:7001/ws/city/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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_read_timeout 86400; # 24 hours
proxy_send_timeout 86400;
}
# ============================================================================
# Second Me Service (7003)
# ============================================================================
location /api/secondme/ {
proxy_pass http://127.0.0.1:7003/;
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 X-Request-Id $request_id;
# Increase timeout for AI responses
proxy_read_timeout 60s;
proxy_connect_timeout 10s;
}
# ============================================================================
# Agents Service (7014)
# ============================================================================
location /api/agents/ {
proxy_pass http://127.0.0.1:7014/;
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 X-Request-Id $request_id;
# Increase timeout for agent invocations
proxy_read_timeout 120s;
proxy_connect_timeout 10s;
}
# Agents WebSocket (for events)
location /ws/agents/ {
proxy_pass http://127.0.0.1:7014/ws/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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_read_timeout 86400;
proxy_send_timeout 86400;
}
# ============================================================================
# MicroDAO Service (7015)
# ============================================================================
location /api/microdao/ {
proxy_pass http://127.0.0.1:7015/;
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 X-Request-Id $request_id;
}
# ============================================================================
# Health Checks (for monitoring)
# ============================================================================
location /health/mvp {
access_log off;
return 200 "MVP services healthy\n";
add_header Content-Type text/plain;
}
# ============================================================================
# Rate Limiting (optional but recommended)
# ============================================================================
# Add to http block (not location):
# limit_req_zone $binary_remote_addr zone=mvp_api:10m rate=10r/s;
#
# Then in each location:
# limit_req zone=mvp_api burst=20 nodelay;
# ============================================================================
# END OF MVP ROUTES
# ============================================================================