feat(manager): add remote VM support via NEXUS_SERVER_HOST
- config.py: add NEXUS_SERVER_HOST env var for cross-VM deployment - health_service.py: graceful Redis failure when only localhost-bound - systemd service: document remote VM configuration - README: add dedicated 'VM separada' installation section - .env.example: new file with remote connection examples
This commit is contained in:
@@ -8,7 +8,7 @@ import psycopg2
|
||||
import redis
|
||||
from config import (
|
||||
MASTER_DB_URL, REDIS_URL, POS_URL, DASHBOARD_URL, QUART_URL,
|
||||
TENANT_DB_URL_TEMPLATE
|
||||
TENANT_DB_URL_TEMPLATE, NEXUS_SERVER_HOST
|
||||
)
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ def check_postgresql():
|
||||
|
||||
|
||||
def check_redis():
|
||||
"""Check Redis connectivity."""
|
||||
"""Check Redis connectivity. May be unreachable if Redis only binds to localhost."""
|
||||
try:
|
||||
r = redis.from_url(REDIS_URL, socket_connect_timeout=3)
|
||||
info = r.info()
|
||||
@@ -41,6 +41,11 @@ def check_redis():
|
||||
"used_memory_human": info.get("used_memory_human", "?"),
|
||||
"connected_clients": info.get("connected_clients", 0)
|
||||
}
|
||||
except redis.ConnectionError:
|
||||
return {
|
||||
"status": "warning",
|
||||
"error": "Redis unreachable. If manager runs on a separate VM, ensure Redis binds to 0.0.0.0 or a VPN interface, or that a tunnel is active."
|
||||
}
|
||||
except Exception as e:
|
||||
return {"status": "error", "error": str(e)}
|
||||
|
||||
@@ -121,6 +126,10 @@ def check_systemd_service(service_name):
|
||||
def get_full_health_report():
|
||||
"""Aggregate health report for all services."""
|
||||
return {
|
||||
"_meta": {
|
||||
"nexus_server_host": NEXUS_SERVER_HOST,
|
||||
"note": "disk/memory are local to this manager VM. PostgreSQL/HTTP checks target the remote Nexus server."
|
||||
},
|
||||
"postgresql": check_postgresql(),
|
||||
"redis": check_redis(),
|
||||
"pos": check_http_service("pos", POS_URL),
|
||||
|
||||
Reference in New Issue
Block a user